Motr  M0
log.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_LOG_H__
25 #define __MOTR___DTM0_LOG_H__
26 
27 #include "dtm0/tx_desc.h" /* m0_dtm0_tx_desc */
28 #include "lib/buf.h" /* m0_buf */
29 
30 
37 /*
38  * DTM0 log overview
39  * -----------------
40  *
41  * DTM0 log is a persistent or volatile storage for log records.
42  * Functionally, log provides a way to add records and receive notifications
43  * about their persistence. Logically, DTM0 log is formed as a threaded
44  * B tree on the server side or as a threaded hashtable on the client side
45  * (TODO). Each "thread" of such a structure forms a list. Server-side log
46  * has N+K "threads" (lists). One list for originator/pruner, and N+K-1 lists
47  * for the remote participants of a dtx.
48  * DTM0 log inputs are REDO messages and P (PERSISTENT) messages. When
49  * a REDO message is inserted into the tree/htable, it is also gets linked
50  * to the originator's list and to each remote participant's list. When
51  * a P message is received, then the log entry gets removed from the
52  * corresponding participant's list. Once the record becomes STABLE,
53  * it is removed from the originator's list and inserted into the log
54  * pruner list (re-using the link).
55  * DTM0 log has no FOMs. It reacts to the incoming events re-using
56  * their sm groups. The log has one single lock that protects container
57  * from modification. Individual log records has no lock protection.
58  */
59 
60 struct m0_be_op;
61 struct m0_be_tx;
62 struct m0_be_tx_credit;
63 
65 };
66 
68 };
69 
70 struct m0_dtm0_log {
71 };
72 
75  struct m0_buf lr_data;
76 };
77 
78 
79 M0_INTERNAL int m0_dtm0_log_init(struct m0_dtm0_log *dol,
80  struct m0_dtm0_log_cfg *dol_cfg);
81 
82 M0_INTERNAL void m0_dtm0_log_fini(struct m0_dtm0_log *dol);
83 
84 M0_INTERNAL int m0_dtm0_log__create(struct m0_dtm0_log *dol,
85  struct m0_dtm0_log_create_cfg *dlc_cfg);
86 
87 M0_INTERNAL void m0_dtm0_log_destroy(struct m0_dtm0_log *dol);
88 
89 M0_INTERNAL void m0_dtm0_log_update_credit(struct m0_dtm0_log *dol,
90  struct m0_dtm0_log_record *rec,
91  struct m0_be_tx_credit *accum);
92 
93 M0_INTERNAL int m0_dtm0_log_update(struct m0_dtm0_log *dol,
94  struct m0_be_tx *tx,
95  struct m0_be_op *op,
96  const struct m0_dtm0_log_record *rec,
97  bool is_redo);
98 
99 
101 #endif /* __MOTR___DTM0_LOG_H__ */
102 
103 /*
104  * Local variables:
105  * c-indentation-style: "K&R"
106  * c-basic-offset: 8
107  * tab-width: 8
108  * fill-column: 80
109  * scroll-step: 1
110  * End:
111  */
112 /*
113  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
114  */
M0_INTERNAL void m0_dtm0_log_fini(struct m0_dtm0_log *dol)
Definition: log.c:39
M0_INTERNAL int m0_dtm0_log__create(struct m0_dtm0_log *dol, struct m0_dtm0_log_create_cfg *dlc_cfg)
Definition: log.c:43
M0_INTERNAL void m0_dtm0_log_update_credit(struct m0_dtm0_log *dol, struct m0_dtm0_log_record *rec, struct m0_be_tx_credit *accum)
struct m0_buf lr_data
Definition: log.h:75
op
Definition: libdemo.c:64
Definition: buf.h:37
struct m0_dtm0_tx_desc lr_desc
Definition: log.h:74
M0_INTERNAL int m0_dtm0_log_init(struct m0_dtm0_log *dol, struct m0_dtm0_log_cfg *dol_cfg)
Definition: log.c:33
M0_INTERNAL void m0_dtm0_log_destroy(struct m0_dtm0_log *dol)
Definition: log.c:49
M0_INTERNAL int m0_dtm0_log_update(struct m0_dtm0_log *dol, struct m0_be_tx *tx, struct m0_be_op *op, const struct m0_dtm0_log_record *rec, bool is_redo)
Definition: op.h:74
Definition: tx.h:280