Motr  M0
pmach.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 #pragma once
23 
24 #ifndef __MOTR___DTM0_PMACH_H__
25 #define __MOTR___DTM0_PMACH_H__
26 
33 /*
34  * DTM0 Persistentcy machine (pmach)
35  * ---------------------------------
36  *
37  * Pmach is a component responsible for handling of P (PERSISTENT) messages.
38  * P messages are produced and consumed by DTM0 log and DTM0 network components.
39  * The machine serves as "converter" that turns incoming P messages produced
40  * by DTM0 network into calls to the corresponding log API, and vice-versa --
41  * it turns notifications received from the log into a call or a series of
42  * calls to DTM0 network component.
43  * Pmach may group and buffer incoming Pmsgs. For example, a set of Pmsgs
44  * from DTM0 log (set of participants lists) could be transposed into a set of
45  * Pmsgs for network (set of vectors of dtx ids).
46  * Pmach uses internal FOMs to buffer Pmsgs. For example, when a local BE
47  * transaction gets logged, the state transition may cause the FOM to post
48  * a message into DTM0 network (transport). If DTM0 network queue is full,
49  * then the FOM goes to still until a free buffer appears. Pmach cannot push
50  * back DTM0 log (be transactions get logged without any restrictions) but
51  * it may be "pressed" by another Pmach though DTM0 network.
52  * When a remote participant goes TRANSIENT, Pmach gets a notification from
53  * the HA. In this case, the machine removes any pending P messages that would
54  * be sent to the participant if it was not TRANSIENT. The same principle
55  * applies to FAILED (permanent failure) notification.
56  *
57  * Interaction with other DTM0 components (net, HA, log):
58  *
59  * +----+ +--------+ +------+
60  * | HA | ----- F/T -----> | Pmach | <-- Pmsg --> | Net |
61  * +----+ +--------+ +------+
62  * /|\ |
63  * +-----+ | [tid]
64  * | Log | -- [tx_desc] -------+ |
65  * +-----+ <-----------------------+
66  */
67 
68 
69 struct m0_dtm0_pmach {
70 };
71 
73 };
74 
75 M0_INTERNAL int m0_dtm0_pmach_init(struct m0_dtm0_pmach *drm,
76  struct m0_dtm0_pmach_cfg *drm_cfg);
77 M0_INTERNAL void m0_dtm0_pmach_fini(struct m0_dtm0_pmach *drm);
78 M0_INTERNAL void m0_dtm0_pmach_start(struct m0_dtm0_pmach *drm);
79 M0_INTERNAL void m0_dtm0_pmach_stop(struct m0_dtm0_pmach *drm);
80 
82 #endif /* __MOTR___DTM0_PMACH_H__ */
83 
84 /*
85  * Local variables:
86  * c-indentation-style: "K&R"
87  * c-basic-offset: 8
88  * tab-width: 8
89  * fill-column: 80
90  * scroll-step: 1
91  * End:
92  */
93 /*
94  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
95  */
M0_INTERNAL int m0_dtm0_pmach_init(struct m0_dtm0_pmach *drm, struct m0_dtm0_pmach_cfg *drm_cfg)
Definition: pmach.c:34
M0_INTERNAL void m0_dtm0_pmach_start(struct m0_dtm0_pmach *drm)
Definition: pmach.c:44
M0_INTERNAL void m0_dtm0_pmach_stop(struct m0_dtm0_pmach *drm)
Definition: pmach.c:48
M0_INTERNAL void m0_dtm0_pmach_fini(struct m0_dtm0_pmach *drm)
Definition: pmach.c:40