Motr  M0
epoch.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2013-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_HA_EPOCH_H__
26 #define __MOTR_HA_EPOCH_H__
27 
28 
70 /* import */
71 #include "lib/types.h"
72 #include "lib/tlist.h"
73 #include "lib/rwlock.h"
74 struct m0_rpc_item;
75 struct m0_confc;
76 
77 /* export */
78 struct m0_ha_domain;
79 
91  int (*hem_past)(struct m0_ha_epoch_monitor *self, uint64_t epoch,
92  const struct m0_rpc_item *item);
97  int (*hem_future)(struct m0_ha_epoch_monitor *self, uint64_t epoch,
98  const struct m0_rpc_item *item);
103  uint64_t hem_magix;
104 };
105 
111 struct m0_ha_domain {
113  uint64_t hdo_epoch;
124 };
125 
152 };
153 
157 M0_EXTERN const uint64_t M0_HA_EPOCH_NONE;
158 
162 M0_INTERNAL void m0_ha_domain_init(struct m0_ha_domain *dom, uint64_t epoch);
163 M0_INTERNAL void m0_ha_domain_fini(struct m0_ha_domain *dom);
164 
165 M0_INTERNAL void m0_ha_domain_monitor_add(struct m0_ha_domain *dom,
166  struct m0_ha_epoch_monitor *mon);
167 M0_INTERNAL void m0_ha_domain_monitor_del(struct m0_ha_domain *dom,
168  struct m0_ha_epoch_monitor *mon);
169 
176 M0_INTERNAL uint64_t m0_ha_domain_get_read(struct m0_ha_domain *dom);
177 
181 M0_INTERNAL void m0_ha_domain_put_read(struct m0_ha_domain *dom);
182 
189 M0_INTERNAL uint64_t m0_ha_domain_get_write(struct m0_ha_domain *dom);
190 
202 M0_INTERNAL void m0_ha_domain_put_write(struct m0_ha_domain *dom, uint64_t epoch);
203 
204 M0_INTERNAL int m0_ha_global_init(void);
205 M0_INTERNAL void m0_ha_global_fini(void);
206 
225 M0_INTERNAL int m0_ha_client_add(struct m0_confc *confc);
226 
231 M0_INTERNAL int m0_ha_client_del(struct m0_confc *confc);
232 
236 typedef void (*m0_ha_client_cb_t)(void *client,
237  const void *data,
238  uint64_t data2);
239 
248 M0_INTERNAL void m0_ha_clients_iterate(m0_ha_client_cb_t iter,
249  const void *data,
250  uint64_t data2);
251 
252 M0_INTERNAL int m0_ha_epoch_check(const struct m0_rpc_item *item);
253 
256 #endif /* __MOTR_HA_EPOCH_H__ */
257 
258 /*
259  * Local variables:
260  * c-indentation-style: "K&R"
261  * c-basic-offset: 8
262  * tab-width: 8
263  * fill-column: 80
264  * scroll-step: 1
265  * End:
266  */
267 /*
268  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
269  */
uint64_t hdo_epoch
Definition: epoch.h:113
M0_INTERNAL void m0_ha_global_fini(void)
Definition: epoch.c:157
M0_INTERNAL void m0_ha_domain_put_read(struct m0_ha_domain *dom)
Definition: epoch.c:125
M0_INTERNAL int m0_ha_client_del(struct m0_confc *confc)
Definition: epoch.c:232
struct m0_bufvec data
Definition: di.c:40
M0_INTERNAL void m0_ha_clients_iterate(m0_ha_client_cb_t iter, const void *data, uint64_t data2)
Definition: epoch.c:251
static struct m0_rpc_item * item
Definition: item.c:56
M0_INTERNAL uint64_t m0_ha_domain_get_read(struct m0_ha_domain *dom)
Definition: epoch.c:119
M0_INTERNAL void m0_ha_domain_fini(struct m0_ha_domain *dom)
Definition: epoch.c:96
M0_INTERNAL int m0_ha_global_init(void)
Definition: epoch.c:144
void client(struct client_params *params)
Definition: main.c:233
static struct m0_confc * confc
Definition: file.c:94
Definition: tlist.h:251
static struct m0_stob_domain * dom
Definition: storage.c:38
M0_INTERNAL int m0_ha_epoch_check(const struct m0_rpc_item *item)
Definition: epoch.c:266
M0_INTERNAL void m0_ha_domain_put_write(struct m0_ha_domain *dom, uint64_t epoch)
Definition: epoch.c:136
M0_INTERNAL void m0_ha_domain_init(struct m0_ha_domain *dom, uint64_t epoch)
Definition: epoch.c:85
struct m0_ha_epoch_monitor hdo_default_mon
Definition: epoch.h:123
M0_EXTERN const uint64_t M0_HA_EPOCH_NONE
Definition: epoch.h:157
m0_ha_epoch_outcome
Definition: epoch.h:129
struct m0_rwlock hdo_lock
Definition: epoch.h:116
uint64_t hem_magix
Definition: epoch.h:103
int(* hem_past)(struct m0_ha_epoch_monitor *self, uint64_t epoch, const struct m0_rpc_item *item)
Definition: epoch.h:91
int(* hem_future)(struct m0_ha_epoch_monitor *self, uint64_t epoch, const struct m0_rpc_item *item)
Definition: epoch.h:97
struct m0_ha_domain * hem_domain
Definition: epoch.h:102
struct m0_tlink hem_linkage
Definition: epoch.h:100
M0_INTERNAL int m0_ha_client_add(struct m0_confc *confc)
Definition: epoch.c:191
M0_INTERNAL uint64_t m0_ha_domain_get_write(struct m0_ha_domain *dom)
Definition: epoch.c:130
M0_INTERNAL void m0_ha_domain_monitor_del(struct m0_ha_domain *dom, struct m0_ha_epoch_monitor *mon)
Definition: epoch.c:111
M0_INTERNAL void m0_ha_domain_monitor_add(struct m0_ha_domain *dom, struct m0_ha_epoch_monitor *mon)
Definition: epoch.c:103
void(* m0_ha_client_cb_t)(void *client, const void *data, uint64_t data2)
Definition: epoch.h:236
struct m0_tl hdo_monitors
Definition: epoch.h:122