Motr  M0
active_record.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2017-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_BE_ACT_RECORD_H__
26 #define __MOTR_BE_ACT_RECORD_H__
27 
34 #include "be/list.h"
35 #include "lib/buf.h"
36 #include "lib/chan.h"
37 #include "lib/mutex.h"
38 
43 };
44 
47  uint64_t ar_tx_id;
56  uint64_t ar_magic;
57 };
58 
60  char rds_name[32];
62  /* link into m0_be_active_record_domain::ard_list */
64  uint64_t rds_magic;
65 
66  /* volatile fields */
68  struct m0_chan rds_chan;
69 };
70 
73  struct m0_be_seg *ard_seg;
74 };
75 
79 };
80 
86 };
87 
88 /* ----------------------------------------------------------------------
89  * struct m0_be_active_record_domain
90  * ---------------------------------------------------------------------- */
91 
92 M0_INTERNAL void
94  struct m0_be_seg *seg);
95 M0_INTERNAL void
97 M0_INTERNAL bool
99 
100 #define m0_be_active_record_domain_create(dom, tx, seg, ...) \
101  m0_be_active_record_domain__create((dom), (tx), (seg), \
102  (const struct m0_buf []){ \
103  __VA_ARGS__, M0_BUF_INIT0 })
104 
105 /* @pre m0_be_active_record_domain_init() is called */
106 M0_INTERNAL int
108  struct m0_be_tx *tx,
109  struct m0_be_seg *seg,
110  const struct m0_buf *path);
111 M0_INTERNAL int
113  struct m0_be_tx *tx);
114 
115 M0_INTERNAL void
118  uint8_t subsys_nr,
119  struct m0_be_tx_credit *accum);
120 
121 /* ----------------------------------------------------------------------
122  * struct m0_be_active_record
123  * ---------------------------------------------------------------------- */
124 
125 M0_INTERNAL void
127  struct m0_be_active_record_domain *ar_dom);
128 M0_INTERNAL void
130 M0_INTERNAL bool
132 
133 M0_INTERNAL int
135  struct m0_be_tx *tx,
136  struct m0_be_active_record_domain *ar_dom);
137 M0_INTERNAL int
139  struct m0_be_tx *tx);
140 
141 M0_INTERNAL void
144  struct m0_be_tx_credit *accum);
145 
146 M0_INTERNAL int
147 m0_be_active_record_add(const char *subsys,
148  struct m0_be_active_record *rec,
149  struct m0_be_tx *tx);
150 
151 M0_INTERNAL int
152 m0_be_active_record_del(const char *subsys,
153  struct m0_be_active_record *rec,
154  struct m0_be_tx *tx);
155 
156 
158 #endif /* __MOTR_BE_ACT_RECORD_H__ */
159 
160 /*
161  * Local variables:
162  * c-indentation-style: "K&R"
163  * c-basic-offset: 8
164  * tab-width: 8
165  * fill-column: 80
166  * scroll-step: 1
167  * End:
168  */
169 /*
170  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
171  */
struct m0_be_list ard_list
Definition: active_record.h:72
struct m0_buf ar_payload
Definition: active_record.h:55
M0_INTERNAL bool m0_be_active_record_domain__invariant(struct m0_be_active_record_domain *dom)
M0_INTERNAL void m0_be_active_record_domain_fini(struct m0_be_active_record_domain *dom)
m0_be_active_record_domain_op
Definition: active_record.h:76
M0_INTERNAL void m0_be_active_record_domain_init(struct m0_be_active_record_domain *dom, struct m0_be_seg *seg)
Definition: active_record.c:98
M0_INTERNAL int m0_be_active_record_del(const char *subsys, struct m0_be_active_record *rec, struct m0_be_tx *tx)
op
Definition: libdemo.c:64
Definition: buf.h:37
M0_INTERNAL void m0_be_active_record_credit(struct m0_be_active_record *rec, enum m0_be_active_record_op op, struct m0_be_tx_credit *accum)
M0_INTERNAL int m0_be_active_record_destroy(struct m0_be_active_record *rec, struct m0_be_tx *tx)
M0_INTERNAL int m0_be_active_record_add(const char *subsys, struct m0_be_active_record *rec, struct m0_be_tx *tx)
static struct m0_stob_domain * dom
Definition: storage.c:38
M0_INTERNAL int m0_be_active_record_domain__create(struct m0_be_active_record_domain **dom, struct m0_be_tx *tx, struct m0_be_seg *seg, const struct m0_buf *path)
m0_be_active_record_type
Definition: active_record.h:39
Definition: chan.h:229
struct m0_be_active_record_domain * ar_dom
Definition: active_record.h:49
struct m0_be_list_link ar_link
Definition: active_record.h:46
Definition: seg.h:66
M0_INTERNAL void m0_be_active_record_domain_credit(struct m0_be_active_record_domain *dom, enum m0_be_active_record_domain_op op, uint8_t subsys_nr, struct m0_be_tx_credit *accum)
struct m0_be_list_link rds_link
Definition: active_record.h:63
M0_INTERNAL void m0_be_active_record_init(struct m0_be_active_record *rec, struct m0_be_active_record_domain *ar_dom)
M0_INTERNAL int m0_be_active_record_domain_destroy(struct m0_be_active_record_domain *dom, struct m0_be_tx *tx)
m0_be_active_record_op
Definition: active_record.h:81
static struct m0_be_seg * seg
Definition: btree.c:40
M0_INTERNAL bool m0_be_active_record__invariant(struct m0_be_active_record *rec)
Definition: mutex.h:47
struct m0_be_seg * ard_seg
Definition: active_record.h:73
M0_INTERNAL void m0_be_active_record_fini(struct m0_be_active_record *rec)
enum m0_be_active_record_type ar_rec_type
Definition: active_record.h:48
Definition: tx.h:280
M0_INTERNAL int m0_be_active_record_create(struct m0_be_active_record **rec, struct m0_be_tx *tx, struct m0_be_active_record_domain *ar_dom)