Motr  M0
conn_pool.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_RPC_CONN_POOL_H__
26 #define __MOTR_RPC_CONN_POOL_H__
27 
28 #include "rpc/conn.h"
29 #include "rpc/session.h"
30 #include "rpc/rpc_machine.h"
31 #include "rpc/link.h"
32 
33 struct m0_rpc_conn_pool;
34 
37  struct m0_chan cpi_chan;
43  uint64_t cpi_magic;
44 };
45 
47  struct m0_tl cp_items;
53  struct m0_sm_ast cp_ast;
54 };
55 
56 M0_INTERNAL int m0_rpc_conn_pool_init(
57  struct m0_rpc_conn_pool *pool,
58  struct m0_rpc_machine *rpc_mach,
59  m0_time_t conn_timeout,
60  uint64_t max_rpcs_in_flight);
61 
62 M0_INTERNAL void m0_rpc_conn_pool_fini(struct m0_rpc_conn_pool *pool);
63 
64 M0_INTERNAL int m0_rpc_conn_pool_get_sync(
65  struct m0_rpc_conn_pool *pool,
66  const char *remote_ep,
67  struct m0_rpc_session **session);
68 
73 M0_INTERNAL int m0_rpc_conn_pool_get_async(
74  struct m0_rpc_conn_pool *pool,
75  const char *remote_ep,
76  struct m0_rpc_session **session);
77 
78 M0_INTERNAL void m0_rpc_conn_pool_put(
79  struct m0_rpc_conn_pool *pool,
80  struct m0_rpc_session *session);
81 
82 M0_INTERNAL
84 
89  struct m0_rpc_session *session);
90 
94 M0_INTERNAL void m0_rpc_conn_pool_destroy(struct m0_rpc_conn_pool *pool,
95  struct m0_rpc_session *session);
96 #endif /* __MOTR_RPC_CONN_POOL_H__ */
97 
98 /*
99  * Local variables:
100  * c-indentation-style: "K&R"
101  * c-basic-offset: 8
102  * tab-width: 8
103  * fill-column: 80
104  * scroll-step: 1
105  * End:
106  */
107 /*
108  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
109  */
M0_INTERNAL void m0_rpc_conn_pool_fini(struct m0_rpc_conn_pool *pool)
Definition: conn_pool.c:345
struct m0_rpc_link cpi_rpc_link
Definition: conn_pool.h:36
M0_INTERNAL int m0_rpc_conn_pool_init(struct m0_rpc_conn_pool *pool, struct m0_rpc_machine *rpc_mach, m0_time_t conn_timeout, uint64_t max_rpcs_in_flight)
Definition: conn_pool.c:325
M0_INTERNAL void m0_rpc_conn_pool_put(struct m0_rpc_conn_pool *pool, struct m0_rpc_session *session)
Definition: conn_pool.c:288
uint64_t m0_time_t
Definition: time.h:37
M0_INTERNAL void m0_rpc_conn_pool_destroy(struct m0_rpc_conn_pool *pool, struct m0_rpc_session *session)
Definition: conn_pool.c:450
Definition: sm.h:504
static struct m0_rpc_session session
Definition: formation2.c:38
M0_INTERNAL struct m0_chan * m0_rpc_conn_pool_session_chan(struct m0_rpc_session *session)
Definition: conn_pool.c:304
M0_INTERNAL int m0_rpc_conn_pool_get_async(struct m0_rpc_conn_pool *pool, const char *remote_ep, struct m0_rpc_session **session)
Definition: conn_pool.c:230
struct m0_rpc_machine * cp_rpc_mach
Definition: conn_pool.h:48
M0_INTERNAL int m0_rpc_conn_pool_get_sync(struct m0_rpc_conn_pool *pool, const char *remote_ep, struct m0_rpc_session **session)
Definition: conn_pool.c:197
struct m0_rpc_conn_pool * cpi_pool
Definition: conn_pool.h:42
Definition: tlist.h:251
struct m0_tl cp_items
Definition: conn_pool.h:47
struct m0_mutex cp_mutex
Definition: conn_pool.h:49
m0_time_t cp_timeout
Definition: conn_pool.h:51
Definition: chan.h:229
static struct m0_pool pool
Definition: iter_ut.c:58
struct m0_clink cpi_clink
Definition: conn_pool.h:38
struct m0_tlink cpi_linkage
Definition: conn_pool.h:41
struct m0_mutex cp_ch_mutex
Definition: conn_pool.h:50
M0_INTERNAL bool m0_rpc_conn_pool_session_established(struct m0_rpc_session *session)
Definition: conn_pool.c:310
uint64_t cp_max_rpcs_in_flight
Definition: conn_pool.h:52
struct m0_chan cpi_chan
Definition: conn_pool.h:37
Definition: mutex.h:47
struct m0_sm_ast cp_ast
Definition: conn_pool.h:53