forked from Seagate/cortx-motr-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
c0appz.h
221 lines (192 loc) · 6.48 KB
/
c0appz.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
/* -*- C -*- */
/*
* COPYRIGHT 2014 SEAGATE LLC
*
* THIS DRAWING/DOCUMENT, ITS SPECIFICATIONS, AND THE DATA CONTAINED
* HEREIN, ARE THE EXCLUSIVE PROPERTY OF SEAGATE LLC,
* ISSUED IN STRICT CONFIDENCE AND SHALL NOT, WITHOUT
* THE PRIOR WRITTEN PERMISSION OF SEAGATE TECHNOLOGY LIMITED,
* BE REPRODUCED, COPIED, OR DISCLOSED TO A THIRD PARTY, OR
* USED FOR ANY PURPOSE WHATSOEVER, OR STORED IN A RETRIEVAL SYSTEM
* EXCEPT AS ALLOWED BY THE TERMS OF SEAGATE LICENSES AND AGREEMENTS.
*
* YOU SHOULD HAVE RECEIVED A COPY OF SEAGATE'S LICENSE ALONG WITH
* THIS RELEASE. IF NOT PLEASE CONTACT A SEAGATE REPRESENTATIVE
* http://www.xyratex.com/contact
*
* Original author: Ganesan Umanesan <[email protected]>
* Original creation date: 10-Jan-2017
*/
#pragma once
#ifndef __C0APPZ_H__
#define __C0APPZ_H__
#include <stdint.h>
#include "clovis/clovis.h"
#include "lib/types.h" /* uint32_t */
int c0appz_init(int idx);
int c0appz_free(void);
/**
* Open Clovis entity (object)
*
* @retval 0 on success
*/
int open_entity(struct m0_clovis_entity *entity);
/**
* Calculate the optimal block size for the object store I/O
*
* @param idhi high number of the object id
* @param idlo low number of the object id
* @param obj_sz estimated total object size
* @param pool pool id in the object store
*
* @retval 0 on error
*/
uint64_t c0appz_m0bs(uint64_t idhi, uint64_t idlo, uint64_t obj_sz,
struct m0_fid *pool);
/**
* Create object in the object store
*
* @param idhi high number of the object id
* @param idlo low number of the object id
* @param pool pool id in the object store
* @param m0bs block size for the object store I/O,
* used to set the optimal object's unit size,
* refer to c0appz_m0bs()
*
* @retval 0 on success
* @retval 1 the object already exists
* @retval <0 error code
*/
int c0appz_cr(uint64_t idhi, uint64_t idlo, struct m0_fid *pool, uint64_t m0bs);
/**
* Remove object
*/
int c0appz_rm(uint64_t idhi, uint64_t idlo);
/**
* Check whether the object exists
*
* @param idhi high number of the object id
* @param idlo low number of the object id
* @param obj_out returned if not NULL and obj exists
*
* @retval 1 yes, the object exists
* @retval 0 no such object
*/
int c0appz_ex(uint64_t idhi, uint64_t idlo, struct m0_clovis_obj *obj_out);
/**
* Copy file to the object store
*
* The object should be created beforehand with c0appz_cr().
*
* @param filename where to copy the data from
* @param bsz block size for I/O on the file, must be
* multiple of PAGE_SIZE (4K)
* @param cnt number of bsz-blocks to do
* @param m0bs block size for the object store I/O, must be
* multiple of bsz, refer to c0appz_m0bs().
*
* @retval 0 on success
*/
int c0appz_cp(uint64_t idhi, uint64_t idlo, char *filename,
uint64_t bsz, uint64_t cnt, uint64_t m0bs);
/**
* Cat/read into file from the object store
*
* @param filename where to read the data to
* @param bsz block size for I/O on the file, must be
* multiple of PAGE_SIZE (4K)
* @param cnt number of bsz-blocks to do
* @param m0bs block size for the object store I/O, must be
* multiple of bsz, refer to c0appz_m0bs().
*
* @retval 0 on success
*/
int c0appz_ct(uint64_t idhi, uint64_t idlo, char *filename,
uint64_t bsz, uint64_t cnt, uint64_t m0bs);
/**
* Copy file to the object store asynchronously in batches
*
* @param filename where to copy the data from
* @param bsz block size for I/O on the file
* @param cnt total number of blocks to do, must be
* multiple of op_cnt
* @param op_cnt number of operations in a batch
* @param m0bs block size for the object store I/O, must be
* multiple of bsz, refer to c0appz_m0bs().
*
* @retval 0 on success
*/
int c0appz_cp_async(uint64_t idhi, uint64_t idlo, char *filename, uint64_t bsz,
uint64_t cnt, uint32_t op_cnt, uint64_t m0bs);
int c0appz_setrc(char *rcfile);
int c0appz_putrc(void);
int c0appz_timeout(uint64_t sz);
int c0appz_timein();
int c0appz_dump_perf(void);
/* qos */
int qos_pthread_wait();
int qos_pthread_start();
int qos_pthread_stop();
int qos_pthread_cond_signal();
int qos_pthread_cond_wait();
/* pool */
int c0appz_pool_ini(void);
int c0appz_pool_set(int pid);
int c0appz_fw(char *buf, char *ouf, uint64_t bsz, uint64_t cnt);
int c0appz_fr(char *buf, char *inf, uint64_t bsz, uint64_t cnt);
int c0appz_mr(char *buf, uint64_t idhi, uint64_t idlo, uint64_t off,
uint64_t bsz, uint64_t cnt, uint64_t m0bs);
int c0appz_mw(const char *buf, uint64_t idhi, uint64_t idlo, uint64_t off,
uint64_t bsz, uint64_t cnt, uint64_t m0bs);
int c0appz_mw_async(const char *buf, uint64_t idhi, uint64_t idlo, uint64_t off,
uint64_t bsz, uint64_t cnt, uint32_t op_cnt, uint64_t m0bs);
int write_data_to_object(struct m0_clovis_obj *o, struct m0_indexvec *ext,
struct m0_bufvec *data, struct m0_bufvec *attr);
int read_data_from_object(struct m0_clovis_obj *o, struct m0_indexvec *ext,
struct m0_bufvec *data,struct m0_bufvec *attr);
int ppf(const char *fmt, ...);
/**
* Loads a library in all available m0ds.
*/
/* Import */
struct m0_fid;
struct c0appz_isc_req;
struct m0_buf;
struct m0_rpc_link;
enum m0_conf_service_type;
/*
** ECMWF REQUIREMENTS
** synchronous/asynchronous get/put etc.
** Note to Nikita: c0appz uses int64_t idhi, int64_t idlo to refer Mero object
** ids due to popular demand from other Sage developers. Please use the same
** convention below. ECMWF has been informed about it.
*/
#if 0
/* generate a unique object id */
int c0appz_generate_id(struct m0_uint128* id);
/* synchronous put a full object */
int c0appz_put(char* buffer, size_t size, struct m0_uint128* id);
/* synchronous get a full object */
int c0appz_get(char* buffer, size_t* size, struct m0_uint128* id);
/* asynchronous put a full object, allocates op */
struct m0_clovis_op* c0appz_async_put(char* buffer, size_t size, struct m0_uint128* id);
/* asynchronous get a full object, allocates op */
struct m0_clovis_op* c0appz_async_get(char* buffer, size_t size, struct m0_uint128* id);
/* wait for an operation to complete and check status */
int c0appz_wait(struct m0_clovis_op* op);
/* free ops */
void c0appz_free_op(struct m0_clovis_op*);
/* flush list of objects */
int c0appz_flush(struct m0_uint128* id, size_t size);
#endif
int c0appz_generate_id(int64_t *idh, int64_t *idl);
#endif /* __C0APPZ_H__ */
/*
* Local variables:
* c-indentation-style: "K&R"
* c-basic-offset: 8
* tab-width: 8
* fill-column: 80
* scroll-step: 1
* End:
*/