Motr  M0
link.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2014-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 
24 #pragma once
25 
26 #ifndef __MOTR_RPC_LINK_H__
27 #define __MOTR_RPC_LINK_H__
28 
29 #include "fop/fom.h"
30 #include "lib/chan.h"
31 #include "lib/mutex.h"
32 #include "lib/time.h" /* m0_time_t */
33 #include "lib/tlist.h"
34 #include "rpc/conn.h"
35 #include "rpc/session.h"
36 
37 struct m0_rpc_machine;
38 
45 struct m0_rpc_link {
48  int rlk_rc;
49  /* private */
50  struct m0_fom rlk_fom;
52  struct m0_chan rlk_wait;
56 };
57 
59  /* Common */
64  /* Connect */
67  /* Disconnect */
71 };
72 
73 M0_INTERNAL int m0_rpc_link_module_init(void);
74 M0_INTERNAL void m0_rpc_link_module_fini(void);
75 
83 M0_INTERNAL int m0_rpc_link_init(struct m0_rpc_link *rlink,
84  struct m0_rpc_machine *mach,
85  struct m0_fid *svc_fid,
86  const char *ep,
87  uint64_t max_rpcs_in_flight);
88 M0_INTERNAL void m0_rpc_link_fini(struct m0_rpc_link *rlink);
89 M0_INTERNAL void m0_rpc_link_reset(struct m0_rpc_link *rlink);
90 
97 M0_INTERNAL void m0_rpc_link_connect_async(struct m0_rpc_link *rlink,
98  m0_time_t abs_timeout,
99  struct m0_clink *wait_clink);
100 M0_INTERNAL int m0_rpc_link_connect_sync(struct m0_rpc_link *rlink,
101  m0_time_t abs_timeout);
108 M0_INTERNAL void m0_rpc_link_disconnect_async(struct m0_rpc_link *rlink,
109  m0_time_t abs_timeout,
110  struct m0_clink *wait_clink);
111 M0_INTERNAL int m0_rpc_link_disconnect_sync(struct m0_rpc_link *rlink,
112  m0_time_t abs_timeout);
113 
114 M0_INTERNAL bool m0_rpc_link_is_connected(const struct m0_rpc_link *rlink);
115 M0_INTERNAL const char *m0_rpc_link_end_point(const struct m0_rpc_link *rlink);
116 
119 #endif /* __MOTR_RPC_LINK_H__ */
120 
121 /*
122  * Local variables:
123  * c-indentation-style: "K&R"
124  * c-basic-offset: 8
125  * tab-width: 8
126  * fill-column: 80
127  * scroll-step: 1
128  * End:
129  */
130 /*
131  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
132  */
uint64_t m0_time_t
Definition: time.h:37
static struct m0_addb2_mach * mach
Definition: storage.c:42
Definition: sock.c:754
Definition: chan.h:229
Definition: fom.h:481
Definition: fid.h:38
Definition: mutex.h:47