Motr  M0
formation2_internal.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2012-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_FORMATION2_H__
26 #define __MOTR_RPC_FORMATION2_H__
27 
77 #include "lib/types.h"
78 #include "lib/tlist.h"
79 
80 /* Imports */
81 struct m0_rpc_packet;
82 struct m0_rpc_item;
83 struct m0_rpc_session;
84 
85 /* Forward references */
86 struct m0_rpc_frm_ops;
87 
92 
98 
106 
112 
119 };
120 
126 enum frm_state {
137 };
138 
154 };
155 
194 struct m0_rpc_frm {
204 
217 
219  uint64_t f_nr_items;
220 
223 
226 
229 
230  const struct m0_rpc_frm_ops *f_ops;
231 
233  uint64_t f_magic;
234 };
235 
255 };
256 
260 extern const struct m0_rpc_frm_ops m0_rpc_frm_default_ops;
261 
266 M0_INTERNAL void
268 
277 M0_INTERNAL void m0_rpc_frm_init(struct m0_rpc_frm *frm,
279  const struct m0_rpc_frm_ops *ops);
280 
287 M0_INTERNAL void m0_rpc_frm_fini(struct m0_rpc_frm *frm);
288 
292 M0_INTERNAL void m0_rpc_frm_enq_item(struct m0_rpc_frm *frm,
293  struct m0_rpc_item *item);
294 M0_INTERNAL void m0_rpc_frm_remove_item(struct m0_rpc_frm *frm,
295  struct m0_rpc_item *item);
296 
297 M0_INTERNAL void m0_rpc_frm_item_deadline_passed(struct m0_rpc_frm *frm,
298  struct m0_rpc_item *item);
299 
303 M0_INTERNAL void m0_rpc_frm_packet_done(struct m0_rpc_packet *packet);
304 
308 M0_INTERNAL void m0_rpc_frm_run_formation(struct m0_rpc_frm *frm);
309 
310 M0_INTERNAL struct m0_rpc_frm *session_frm(const struct m0_rpc_session *s);
311 
312 M0_TL_DESCR_DECLARE(itemq, M0_EXTERN);
313 M0_TL_DECLARE(itemq, M0_INTERNAL, struct m0_rpc_item);
314 
315 M0_INTERNAL struct m0_rpc_chan *frm_rchan(const struct m0_rpc_frm *frm);
316 M0_INTERNAL struct m0_rpc_machine *frm_rmachine(const struct m0_rpc_frm *frm);
317 
318 M0_INTERNAL bool item_is_in_waiting_queue(const struct m0_rpc_item *item,
319  const struct m0_rpc_frm *frm);
320 
322 #endif /* __MOTR_RPC_FORMATION2_H__ */
M0_INTERNAL void m0_rpc_frm_fini(struct m0_rpc_frm *frm)
Definition: formation2.c:222
static struct m0_addb2_philter p
Definition: consumer.c:40
struct m0_rpc_frm_constraints f_constraints
M0_INTERNAL void m0_rpc_frm_packet_done(struct m0_rpc_packet *p)
Definition: formation2.c:698
M0_INTERNAL struct m0_rpc_frm * session_frm(const struct m0_rpc_session *s)
Definition: formation2.c:721
static struct m0_rpc_frm_constraints constraints
Definition: formation2.c:35
uint64_t m0_bcount_t
Definition: types.h:77
static struct m0_rpc_item * item
Definition: item.c:56
M0_INTERNAL struct m0_rpc_chan * frm_rchan(const struct m0_rpc_frm *frm)
Definition: formation2.c:156
M0_INTERNAL void m0_rpc_frm_init(struct m0_rpc_frm *frm, struct m0_rpc_frm_constraints *constraints, const struct m0_rpc_frm_ops *ops)
Definition: formation2.c:197
M0_TL_DECLARE(itemq, M0_INTERNAL, struct m0_rpc_item)
m0_bcount_t f_nr_bytes_accumulated
M0_INTERNAL struct m0_rpc_machine * frm_rmachine(const struct m0_rpc_frm *frm)
Definition: formation2.c:161
M0_INTERNAL void m0_rpc_frm_item_deadline_passed(struct m0_rpc_frm *frm, struct m0_rpc_item *item)
Definition: formation2.c:384
Definition: tlist.h:251
Definition: xcode.h:95
M0_INTERNAL void m0_rpc_frm_remove_item(struct m0_rpc_frm *frm, struct m0_rpc_item *item)
Definition: formation2.c:626
M0_TL_DESCR_DECLARE(itemq, M0_EXTERN)
struct m0_tl f_itemq[FRMQ_NR_QUEUES]
int(* fo_packet_ready)(struct m0_rpc_packet *p)
M0_INTERNAL void m0_rpc_frm_run_formation(struct m0_rpc_frm *frm)
Definition: formation2.c:684
m0_rpc_frm_itemq_type
enum frm_state f_state
M0_INTERNAL void m0_rpc_frm_constraints_get_defaults(struct m0_rpc_frm_constraints *c)
Definition: formation2.c:171
uint64_t f_nr_packets_enqed
M0_INTERNAL void m0_rpc_frm_enq_item(struct m0_rpc_frm *frm, struct m0_rpc_item *item)
Definition: formation2.c:260
static struct m0_rpc_frm * frm
Definition: formation2.c:34
m0_bcount_t fc_max_nr_bytes_accumulated
M0_INTERNAL bool item_is_in_waiting_queue(const struct m0_rpc_item *item, const struct m0_rpc_frm *frm)
Definition: formation2.c:327
const struct m0_rpc_frm_ops * f_ops
struct m0_fom_ops ops
Definition: io_foms.c:623
static struct m0_addb2_source * s
Definition: consumer.c:39
const struct m0_rpc_frm_ops m0_rpc_frm_default_ops
Definition: frmops.c:65