Motr  M0
storage.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2015-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_ADDB2_STORAGE_H__
26 #define __MOTR_ADDB2_STORAGE_H__
27 
49 /* import */
50 #include "lib/types.h"
51 #include "fid/fid.h"
52 #include "fid/fid_xc.h"
53 #include "xcode/xcode_attr.h"
54 #include "format/format.h"
55 #include "format/format_xc.h"
56 struct m0_stob;
57 struct m0_addb2_trace_obj;
58 struct m0_addb2_record;
59 
60 /* export */
61 struct m0_addb2_storage;
64 struct m0_addb2_sit;
65 
74  void (*sto_idle)(struct m0_addb2_storage *stor);
78  void (*sto_done)(struct m0_addb2_storage *stor,
79  struct m0_addb2_trace_obj *obj);
84  void (*sto_commit)(struct m0_addb2_storage *stor,
85  const struct m0_addb2_frame_header *anchor);
86 };
87 
100 M0_INTERNAL struct m0_addb2_storage *
101 m0_addb2_storage_init(const char *location, uint64_t key, bool mkfs, bool force,
102  const struct m0_addb2_storage_ops *ops, m0_bcount_t size,
103  void *cookie);
104 
108 M0_INTERNAL void *m0_addb2_storage_cookie(const struct m0_addb2_storage *stor);
109 
116 M0_INTERNAL void m0_addb2_storage_stop(struct m0_addb2_storage *stor);
117 
121 M0_INTERNAL void m0_addb2_storage_fini(struct m0_addb2_storage *stor);
122 
126 M0_INTERNAL int m0_addb2_storage_submit(struct m0_addb2_storage *stor,
127  struct m0_addb2_trace_obj *obj);
133  uint64_t he_seqno;
134  uint64_t he_offset;
135  uint64_t he_prev_offset;
136  uint32_t he_trace_nr;
137  uint32_t he_size;
138  uint64_t he_time;
139  uint64_t he_stob_size;
140  uint64_t he_magix;
141  struct m0_fid he_fid;
143 } M0_XCA_RECORD;
144 
147 
148  /*
149  * future versions, uncomment and update
150  * M0_ADDB2_FRAME_HEADER_FORMAT_VERSION
151  */
152  /*M0_ADDB2_FRAME_HEADER_FORMAT_VERSION_2,*/
153  /*M0_ADDB2_FRAME_HEADER_FORMAT_VERSION_3,*/
154 
157 };
158 
162 M0_INTERNAL int m0_addb2_storage_header(struct m0_stob *stob,
163  struct m0_addb2_frame_header *h);
164 /*
165  * Storage offline CONSUMER interface.
166  */
167 
171 int m0_addb2_sit_init(struct m0_addb2_sit **out, struct m0_stob *stob,
178 int m0_addb2_sit_next(struct m0_addb2_sit *it, struct m0_addb2_record **out);
179 void m0_addb2_sit_fini(struct m0_addb2_sit *it);
180 
185 
187 #endif /* __MOTR_ADDB2_STORAGE_H__ */
188 
189 /*
190  * Local variables:
191  * c-indentation-style: "K&R"
192  * c-basic-offset: 8
193  * tab-width: 8
194  * fill-column: 80
195  * scroll-step: 1
196  * End:
197  */
198 /*
199  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
200  */
struct m0_format_footer he_footer
Definition: storage.h:142
static struct m0_addb2_storage * stor
Definition: storage.c:41
uint64_t he_prev_offset
Definition: storage.h:135
uint64_t he_stob_size
Definition: storage.h:139
struct m0_fid he_fid
Definition: storage.h:141
void(* sto_idle)(struct m0_addb2_storage *stor)
Definition: storage.h:74
struct m0_format_header he_header
Definition: storage.h:132
M0_INTERNAL void * m0_addb2_storage_cookie(const struct m0_addb2_storage *stor)
Definition: kaddb2.c:57
static struct m0_be_emap_cursor it
Definition: extmap.c:46
M0_INTERNAL void m0_addb2_storage_stop(struct m0_addb2_storage *stor)
Definition: kaddb2.c:66
uint64_t m0_bindex_t
Definition: types.h:80
uint64_t m0_bcount_t
Definition: types.h:77
static struct foo * obj
Definition: tlist.c:302
const char * location
Definition: storage.c:50
M0_INTERNAL void m0_addb2_storage_fini(struct m0_addb2_storage *stor)
Definition: kaddb2.c:63
struct m0_addb2_source * m0_addb2_sit_source(struct m0_addb2_sit *it)
Definition: sit.c:173
Definition: stob.h:163
static struct m0_stob * stob
Definition: storage.c:39
m0_addb2_frame_header_format_version
Definition: storage.h:145
uint64_t he_offset
Definition: storage.h:134
int m0_addb2_sit_init(struct m0_addb2_sit **out, struct m0_stob *stob, m0_bindex_t start)
Definition: sit.c:108
void(* sto_commit)(struct m0_addb2_storage *stor, const struct m0_addb2_frame_header *anchor)
Definition: storage.h:84
uint32_t he_trace_nr
Definition: storage.h:136
void(* sto_done)(struct m0_addb2_storage *stor, struct m0_addb2_trace_obj *obj)
Definition: storage.h:78
M0_INTERNAL struct m0_addb2_storage * m0_addb2_storage_init(const char *location, uint64_t key, bool mkfs, bool force, const struct m0_addb2_storage_ops *ops, m0_bcount_t size, void *cookie)
Definition: kaddb2.c:42
Definition: fid.h:38
int m0_addb2_sit_next(struct m0_addb2_sit *it, struct m0_addb2_record **out)
Definition: sit.c:148
M0_INTERNAL int m0_addb2_storage_submit(struct m0_addb2_storage *stor, struct m0_addb2_trace_obj *obj)
Definition: kaddb2.c:50
m0_bcount_t size
Definition: di.c:39
static int start(struct m0_fom *fom)
Definition: trigger_fom.c:321
#define out(...)
Definition: gen.c:41
struct m0_fom_ops ops
Definition: io_foms.c:623
M0_INTERNAL int m0_addb2_storage_header(struct m0_stob *stob, struct m0_addb2_frame_header *h)
Definition: sit.c:179
Definition: idx_mock.c:47
void m0_addb2_sit_fini(struct m0_addb2_sit *it)
Definition: sit.c:139