Motr  M0
operation.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 
24 #pragma once
25 
26 #ifndef __MOTR_DTM_OPERATION_H__
27 #define __MOTR_DTM_OPERATION_H__
28 
29 
36 /* import */
37 #include "dtm/nucleus.h"
38 #include "dtm/update.h"
39 #include "dtm/update_xc.h"
40 struct m0_dtm_remote;
41 struct m0_dtm;
42 struct m0_tl;
43 
44 /* export */
45 struct m0_dtm_oper;
46 
47 struct m0_dtm_oper {
49  struct m0_tl oprt_uu;
50  uint64_t oprt_flags;
51 };
52 M0_INTERNAL bool m0_dtm_oper_invariant(const struct m0_dtm_oper *oper);
53 
55  M0_DOF_CLOSED = 1 << 0,
56  M0_DOF_LAST = 1 << 1,
57  M0_DOF_SENT = 1 << 2
58 };
59 
61  uint32_t ou_nr;
63 } M0_XCA_SEQUENCE M0_XCA_DOMAIN(rpc);
64 
67 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
68 
69 M0_INTERNAL void m0_dtm_oper_init(struct m0_dtm_oper *oper, struct m0_dtm *dtm,
70  struct m0_tl *uu);
71 M0_INTERNAL void m0_dtm_oper_fini(struct m0_dtm_oper *oper);
72 M0_INTERNAL void m0_dtm_oper_close(struct m0_dtm_oper *oper);
73 M0_INTERNAL void m0_dtm_oper_prepared(const struct m0_dtm_oper *oper,
74  const struct m0_dtm_remote *rem);
75 M0_INTERNAL void m0_dtm_oper_done(const struct m0_dtm_oper *oper,
76  const struct m0_dtm_remote *rem);
77 M0_INTERNAL void m0_dtm_oper_pack(struct m0_dtm_oper *oper,
78  const struct m0_dtm_remote *rem,
79  struct m0_dtm_oper_descr *ode);
80 M0_INTERNAL void m0_dtm_oper_unpack(struct m0_dtm_oper *oper,
81  const struct m0_dtm_oper_descr *ode);
82 M0_INTERNAL int m0_dtm_oper_build(struct m0_dtm_oper *oper, struct m0_tl *uu,
83  const struct m0_dtm_oper_descr *ode);
84 M0_INTERNAL void m0_dtm_reply_pack(const struct m0_dtm_oper *oper,
85  const struct m0_dtm_oper_descr *request,
86  struct m0_dtm_oper_descr *reply);
87 M0_INTERNAL void m0_dtm_reply_unpack(struct m0_dtm_oper *oper,
88  const struct m0_dtm_oper_descr *reply);
89 
90 M0_INTERNAL struct m0_dtm_update *m0_dtm_oper_get(const struct m0_dtm_oper *oper,
91  uint32_t label);
92 
95 #endif /* __MOTR_DTM_OPERATION_H__ */
96 
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  */
static struct m0_dtm_oper_descr ode[REM_NR][OPER_NR]
Definition: dtx.c:68
M0_INTERNAL void m0_dtm_oper_init(struct m0_dtm_oper *oper, struct m0_dtm *dtm, struct m0_tl *uu)
Definition: operation.c:44
struct m0_dtm_op oprt_op
Definition: operation.h:48
M0_INTERNAL void m0_dtm_oper_prepared(const struct m0_dtm_oper *oper, const struct m0_dtm_remote *rem)
Definition: operation.c:122
M0_INTERNAL void m0_dtm_oper_done(const struct m0_dtm_oper *oper, const struct m0_dtm_remote *rem)
Definition: operation.c:144
M0_INTERNAL int m0_dtm_oper_build(struct m0_dtm_oper *oper, struct m0_tl *uu, const struct m0_dtm_oper_descr *ode)
Definition: operation.c:183
M0_INTERNAL void m0_dtm_oper_unpack(struct m0_dtm_oper *oper, const struct m0_dtm_oper_descr *ode)
M0_INTERNAL void m0_dtm_oper_pack(struct m0_dtm_oper *oper, const struct m0_dtm_remote *rem, struct m0_dtm_oper_descr *ode)
Definition: operation.c:161
Definition: tlist.h:251
struct m0_dtm_update_descr * ou_update
Definition: operation.h:62
M0_INTERNAL struct m0_dtm_update * m0_dtm_oper_get(const struct m0_dtm_oper *oper, uint32_t label)
Definition: operation.c:259
M0_INTERNAL void m0_dtm_reply_unpack(struct m0_dtm_oper *oper, const struct m0_dtm_oper_descr *reply)
Definition: operation.c:236
uint64_t oprt_flags
Definition: operation.h:50
struct m0_tl oprt_uu
Definition: operation.h:49
M0_INTERNAL void m0_dtm_oper_close(struct m0_dtm_oper *oper)
Definition: operation.c:83
m0_dtm_oper_flags
Definition: operation.h:54
struct m0_dtm_oper_updates M0_XCA_DOMAIN(rpc)
Definition: dtm.h:529
M0_INTERNAL void m0_dtm_oper_fini(struct m0_dtm_oper *oper)
Definition: operation.c:58
static struct m0_tl uu
Definition: dtx.c:65
struct m0_dtm_oper_updates od_updates
Definition: operation.h:66
static struct m0_dtm_oper_descr reply
Definition: transmit.c:94
M0_INTERNAL bool m0_dtm_oper_invariant(const struct m0_dtm_oper *oper)
Definition: operation.c:69
M0_INTERNAL void m0_dtm_reply_pack(const struct m0_dtm_oper *oper, const struct m0_dtm_oper_descr *request, struct m0_dtm_oper_descr *reply)
Definition: operation.c:209