Motr  M0
entrypoint_fops.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2016-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_ENTRYPOINT_FOPS_H__
26 #define __MOTR_HA_ENTRYPOINT_FOPS_H__
27 
34 #include "xcode/xcode_attr.h" /* M0_XCA_RECORD */
35 
36 #include "lib/types.h" /* int32_t */
37 #include "lib/buf.h" /* m0_buf */
38 #include "fid/fid.h" /* m0_fid */
39 #include "ha/link_fops.h" /* m0_ha_link_parameters */
40 #include "ha/cookie.h" /* m0_ha_cookie */
41 
42 /*
43  * The following includes are needed only for entrypoint_fops_xc.h compilation.
44  */
45 #include "lib/buf_xc.h" /* m0_buf_xc */
46 #include "lib/types_xc.h" /* m0_uint128_xc */
47 #include "fid/fid_xc.h" /* m0_fid_xc */
48 #include "ha/link_fops_xc.h" /* m0_ha_link_parameters_xc */
49 #include "ha/cookie_xc.h" /* m0_ha_cookie_xc_xc */
50 
60 #if 0 /*
61  * XXX: Possible way to introduce explicit delay. The entry implies the
62  * value to be transformed to M0_HA_ENTRYPOINT_QUERY immediately in the
63  * interface API m0_halon_interface_entrypoint_reply() along with
64  * setting delay value correspondingly.
65  */
66  M0_HA_ENTRYPOINT_QUERY_1SEC,
67  /*
68  * Other ways to introduce the delay between HA client queries:
69  * - add explicit delay_ns parameter to the Halon interface API
70  * m0_halon_interface_entrypoint_reply(), or
71  * - synthesize delay value on HA client side based on some policy
72  * (predefined constant, or algorithmic, or statistics-based), or
73  * - transform control values like M0_HA_ENTRYPOINT_QUERY_1SEC to
74  * M0_HA_ENTRYPOINT_QUERY and delay on HA client side.
75  */
76 #endif
77 };
78 
89  uint32_t hbp_quorum;
107 
109  uint32_t hbp_control;
110 
111  /* link parameters */
114 
115  /*
116  * If it is set then the link has been disconnected some time ago.
117  * There is no way to re-establish the link and the process that has
118  * sent the entrypoint request has to be restarted.
119  */
121 
122  /* A cookie to check if entrypoint server is still the same */
124 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
125 
128  uint64_t erf_generation;
132  uint64_t erf_pid;
134 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
135 
142  uint64_t heq_generation;
146  /* m0_build_info::bi_git_rev_id */
147  const char *heq_git_rev_id;
148  uint64_t heq_pid;
150 };
151 
153  uint32_t hae_quorum;
155  const char **hae_confd_eps;
160  /* link parameters */
165 };
166 
169 
170 M0_INTERNAL void m0_ha_entrypoint_fops_init(void);
171 M0_INTERNAL void m0_ha_entrypoint_fops_fini(void);
172 
173 
174 M0_INTERNAL int
176  struct m0_ha_entrypoint_req_fop *req_fop);
177 M0_INTERNAL int
179  const char *rpc_endpoint,
180  struct m0_ha_entrypoint_req *req);
181 
182 M0_INTERNAL int
184  struct m0_ha_entrypoint_rep *rep);
185 M0_INTERNAL int
188 
189 M0_INTERNAL void m0_ha_entrypoint_rep_free(struct m0_ha_entrypoint_rep *rep);
190 M0_INTERNAL void m0_ha_entrypoint_req_free(struct m0_ha_entrypoint_req *req);
191 M0_INTERNAL int m0_ha_entrypoint_rep_copy(struct m0_ha_entrypoint_rep *to,
192  struct m0_ha_entrypoint_rep *from);
193 
195 #endif /* __MOTR_HA_ENTRYPOINT_FOPS_H__ */
196 
197 /*
198  * Local variables:
199  * c-indentation-style: "K&R"
200  * c-basic-offset: 8
201  * tab-width: 8
202  * fill-column: 80
203  * scroll-step: 1
204  * End:
205  */
206 /*
207  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
208  */
struct m0_ha_link_params heq_link_params
struct m0_fid heq_process_fid
struct m0_fid hae_active_rm_fid
M0_INTERNAL int m0_ha_entrypoint_rep_copy(struct m0_ha_entrypoint_rep *to, struct m0_ha_entrypoint_rep *from)
static struct io_request req
Definition: file.c:100
const char ** hae_confd_eps
struct m0_ha_link_params hae_link_params
M0_INTERNAL int m0_ha_entrypoint_fop2req(const struct m0_ha_entrypoint_req_fop *req_fop, const char *rpc_endpoint, struct m0_ha_entrypoint_req *req)
struct m0_bufs hbp_confd_eps
struct m0_fop_getxattr_rep * rep
Definition: dir.c:455
struct m0_fop_type m0_ha_entrypoint_rep_fopt
struct m0_fid_arr hbp_confd_fids
struct m0_fop_type m0_ha_entrypoint_req_fopt
Definition: buf.h:37
M0_INTERNAL int m0_ha_entrypoint_req2fop(const struct m0_ha_entrypoint_req *req, struct m0_ha_entrypoint_req_fop *req_fop)
M0_INTERNAL void m0_ha_entrypoint_fops_init(void)
struct m0_ha_cookie hae_cookie_actual
Definition: fid.h:43
M0_INTERNAL int m0_ha_entrypoint_rep2fop(const struct m0_ha_entrypoint_rep *rep, struct m0_ha_entrypoint_rep_fop *rep_fop)
M0_INTERNAL int m0_ha_entrypoint_fop2rep(const struct m0_ha_entrypoint_rep_fop *rep_fop, struct m0_ha_entrypoint_rep *rep)
enum m0_ha_entrypoint_control hae_control
struct m0_ha_entrypoint_req M0_XCA_DOMAIN
struct m0_fid hbp_active_rm_fid
struct m0_ha_cookie_xc hbp_cookie_actual
struct m0_ha_cookie_xc erf_cookie_expected
M0_INTERNAL void m0_ha_entrypoint_req_free(struct m0_ha_entrypoint_req *req)
Definition: fid.h:38
struct m0_ha_cookie heq_cookie_expected
M0_INTERNAL void m0_ha_entrypoint_rep_free(struct m0_ha_entrypoint_rep *rep)
M0_INTERNAL void m0_ha_entrypoint_fops_fini(void)
Definition: buf.h:43
struct m0_fid_arr hae_confd_fids
const char * heq_git_rev_id
struct m0_ha_link_params erf_link_params
m0_ha_entrypoint_control
struct m0_ha_link_params hbp_link_params
struct m0_fop * rep_fop
Definition: dir.c:334
struct m0_buf hbp_active_rm_ep