DAOS API: src/include/daos_s3.h Source File

| DAOS API (v2.1 - dev)

Loading...
Searching...
No Matches
daos_s3.h
Go to the documentation of this file.
1/*
2 * (C) Copyright 2022 Intel Corporation.
3 *
4 * SPDX-License-Identifier: BSD-2-Clause-Patent
5 */
14
15#ifndef __DAOS_S3_H__
16#define __DAOS_S3_H__
17
18#if defined(__cplusplus)
19extern "C" {
20#endif
21
22#include <daos_event.h>
23#include <daos_fs.h>
24
26#define DS3_MAX_BUCKET_NAME DAOS_PROP_MAX_LABEL_BUF_LEN
27
29#define DS3_MAX_KEY (DFS_MAX_PATH - 8)
30
32#define DS3_MAX_KEY_BUFF DFS_MAX_PATH
33
35#define DS3_MAX_USER_NAME DFS_MAX_NAME
36
38#define DS3_MAX_UPLOAD_ID 35
39
41#define DS3_MAX_ENCODED_LEN DFS_MAX_XATTR_LEN
42
44#define DS3_LATEST_INSTANCE "latest"
45
47 typedef struct ds3 ds3_t;
48
50 typedef struct ds3_bucket ds3_bucket_t;
51
53 typedef struct ds3_obj ds3_obj_t;
54
56 typedef struct ds3_part ds3_part_t;
57
59 struct ds3_user_info {
61 const char *name;
63 const char *email;
65 const char **access_ids;
67 const size_t access_ids_nr;
69 void *encoded;
71 size_t encoded_length;
72};
73
75 struct ds3_bucket_info {
77 char name[DS3_MAX_BUCKET_NAME];
79 void *encoded;
81 size_t encoded_length;
82};
83
85 struct ds3_object_info {
87 char key[DS3_MAX_KEY_BUFF];
89 void *encoded;
91 size_t encoded_length;
92};
93
95 struct ds3_common_prefix_info {
97 char prefix[DS3_MAX_KEY_BUFF];
98};
99
101 struct ds3_multipart_upload_info {
103 char upload_id[DS3_MAX_UPLOAD_ID];
105 char key[DS3_MAX_KEY_BUFF];
107 void *encoded;
109 size_t encoded_length;
110};
111
113 struct ds3_multipart_part_info {
115 uint64_t part_num;
117 void *encoded;
119 size_t encoded_length;
120};
121
122/* General S3 */
123
129int
130ds3_init();
131
137int
138ds3_fini();
139
153int
154ds3_connect(const char *pool, const char *sys, ds3_t **ds3, daos_event_t *ev);
155
165int
166ds3_disconnect(ds3_t *ds3, daos_event_t *ev);
167
168/* S3 users */
169
182int
183ds3_user_set(const char *name, struct ds3_user_info *info, struct ds3_user_info *old_info,
184 ds3_t *ds3, daos_event_t *ev);
185
197int
198ds3_user_remove(const char *name, struct ds3_user_info *info, ds3_t *ds3, daos_event_t *ev);
199
211int
212ds3_user_get(const char *name, struct ds3_user_info *info, ds3_t *ds3, daos_event_t *ev);
213
225int
226ds3_user_get_by_email(const char *email, struct ds3_user_info *info, ds3_t *ds3, daos_event_t *ev);
227
239int
240ds3_user_get_by_key(const char *key, struct ds3_user_info *info, ds3_t *ds3, daos_event_t *ev);
241
242/* S3 Buckets */
243
261int
262ds3_bucket_list(daos_size_t *nbuck, struct ds3_bucket_info *buf, char *marker, bool *is_truncated,
263 ds3_t *ds3, daos_event_t *ev);
264
279int
280ds3_bucket_create(const char *name, struct ds3_bucket_info *info, dfs_attr_t *attr, ds3_t *ds3,
281 daos_event_t *ev);
282
294int
295ds3_bucket_destroy(const char *name, bool force, ds3_t *ds3, daos_event_t *ev);
296
308int
309ds3_bucket_open(const char *name, ds3_bucket_t **ds3b, ds3_t *ds3, daos_event_t *ev);
310
320int
321ds3_bucket_close(ds3_bucket_t *ds3b, daos_event_t *ev);
322
333int
334ds3_bucket_get_info(struct ds3_bucket_info *info, ds3_bucket_t *ds3b, daos_event_t *ev);
335
346int
347ds3_bucket_set_info(struct ds3_bucket_info *info, ds3_bucket_t *ds3b, daos_event_t *ev);
348
371int
372ds3_bucket_list_obj(uint32_t *nobj, struct ds3_object_info *objs, uint32_t *ncp,
373 struct ds3_common_prefix_info *cps, const char *prefix, const char *delim,
374 char *marker, bool list_versions, bool *is_truncated, ds3_bucket_t *ds3b);
375
376/* S3 Objects */
377
387int
388ds3_obj_create(const char *key, ds3_obj_t **ds3o, ds3_bucket_t *ds3b);
389
399int
400ds3_obj_open(const char *key, ds3_obj_t **ds3o, ds3_bucket_t *ds3b);
401
409int
410ds3_obj_close(ds3_obj_t *ds3o);
411
421int
422ds3_obj_get_info(struct ds3_object_info *info, ds3_bucket_t *ds3b, ds3_obj_t *ds3o);
423
433int
434ds3_obj_set_info(struct ds3_object_info *info, ds3_bucket_t *ds3b, ds3_obj_t *ds3o);
435
453int
454ds3_obj_read(void *buf, daos_off_t off, daos_size_t *size, ds3_bucket_t *ds3b, ds3_obj_t *ds3o,
455 daos_event_t *ev);
456
465int
466ds3_obj_destroy(const char *key, ds3_bucket_t *ds3b);
467
483int
484ds3_obj_write(void *buf, daos_off_t off, daos_size_t *size, ds3_bucket_t *ds3b, ds3_obj_t *ds3o,
485 daos_event_t *ev);
486
495int
496ds3_obj_mark_latest(const char *key, ds3_bucket_t *ds3b);
497
498/* S3 Multipart api */
499
523int
524ds3_bucket_list_multipart(const char *bucket_name, uint32_t *nmp,
525 struct ds3_multipart_upload_info *mps, uint32_t *ncp,
526 struct ds3_common_prefix_info *cps, const char *prefix, const char *delim,
527 char *marker, bool *is_truncated, ds3_t *ds3);
528
547int
548ds3_upload_list_parts(const char *bucket_name, const char *upload_id, uint32_t *npart,
549 struct ds3_multipart_part_info *parts, uint32_t *marker, bool *is_truncated,
550 ds3_t *ds3);
551
561int
562ds3_upload_init(struct ds3_multipart_upload_info *info, const char *bucket_name, ds3_t *ds3);
563
574int
575ds3_upload_remove(const char *bucket_name, const char *upload_id, ds3_t *ds3);
576
588int
589ds3_upload_get_info(struct ds3_multipart_upload_info *info, const char *bucket_name,
590 const char *upload_id, ds3_t *ds3);
591
604int
605ds3_part_open(const char *bucket_name, const char *upload_id, uint64_t part_num, bool truncate,
606 ds3_part_t **ds3p, ds3_t *ds3);
607
615int
616ds3_part_close(ds3_part_t *ds3p);
617
633int
634ds3_part_write(void *buf, daos_off_t off, daos_size_t *size, ds3_part_t *ds3p, ds3_t *ds3,
635 daos_event_t *ev);
636
652int
653ds3_part_read(void *buf, daos_off_t off, daos_size_t *size, ds3_part_t *ds3p, ds3_t *ds3,
654 daos_event_t *ev);
655
667int
668ds3_part_set_info(struct ds3_multipart_part_info *info, ds3_part_t *ds3p, ds3_t *ds3,
669 daos_event_t *ev);
670
671#if defined(__cplusplus)
672}
673#endif
674
675#endif /* __DAOS_S3_H__ */
daos_fs.h
ds3_bucket_set_info
int ds3_bucket_set_info(struct ds3_bucket_info *info, ds3_bucket_t *ds3b, daos_event_t *ev)
ds3_obj_open
int ds3_obj_open(const char *key, ds3_obj_t **ds3o, ds3_bucket_t *ds3b)
ds3_bucket_open
int ds3_bucket_open(const char *name, ds3_bucket_t **ds3b, ds3_t *ds3, daos_event_t *ev)
ds3_bucket_close
int ds3_bucket_close(ds3_bucket_t *ds3b, daos_event_t *ev)
ds3_upload_get_info
int ds3_upload_get_info(struct ds3_multipart_upload_info *info, const char *bucket_name, const char *upload_id, ds3_t *ds3)
ds3_user_get_by_email
int ds3_user_get_by_email(const char *email, struct ds3_user_info *info, ds3_t *ds3, daos_event_t *ev)
ds3_user_get_by_key
int ds3_user_get_by_key(const char *key, struct ds3_user_info *info, ds3_t *ds3, daos_event_t *ev)
ds3_bucket_create
int ds3_bucket_create(const char *name, struct ds3_bucket_info *info, dfs_attr_t *attr, ds3_t *ds3, daos_event_t *ev)
ds3_part_open
int ds3_part_open(const char *bucket_name, const char *upload_id, uint64_t part_num, bool truncate, ds3_part_t **ds3p, ds3_t *ds3)
ds3_part_write
int ds3_part_write(void *buf, daos_off_t off, daos_size_t *size, ds3_part_t *ds3p, ds3_t *ds3, daos_event_t *ev)
ds3_fini
int ds3_fini()
ds3_user_set
int ds3_user_set(const char *name, struct ds3_user_info *info, struct ds3_user_info *old_info, ds3_t *ds3, daos_event_t *ev)
ds3_init
int ds3_init()
ds3_part_close
int ds3_part_close(ds3_part_t *ds3p)
ds3_bucket_list_multipart
int ds3_bucket_list_multipart(const char *bucket_name, uint32_t *nmp, struct ds3_multipart_upload_info *mps, uint32_t *ncp, struct ds3_common_prefix_info *cps, const char *prefix, const char *delim, char *marker, bool *is_truncated, ds3_t *ds3)
ds3_obj_get_info
int ds3_obj_get_info(struct ds3_object_info *info, ds3_bucket_t *ds3b, ds3_obj_t *ds3o)
ds3_upload_init
int ds3_upload_init(struct ds3_multipart_upload_info *info, const char *bucket_name, ds3_t *ds3)
ds3_disconnect
int ds3_disconnect(ds3_t *ds3, daos_event_t *ev)
DS3_MAX_BUCKET_NAME
#define DS3_MAX_BUCKET_NAME
Definition daos_s3.h:26
ds3_bucket_destroy
int ds3_bucket_destroy(const char *name, bool force, ds3_t *ds3, daos_event_t *ev)
ds3_obj_read
int ds3_obj_read(void *buf, daos_off_t off, daos_size_t *size, ds3_bucket_t *ds3b, ds3_obj_t *ds3o, daos_event_t *ev)
ds3_obj_mark_latest
int ds3_obj_mark_latest(const char *key, ds3_bucket_t *ds3b)
ds3_obj_close
int ds3_obj_close(ds3_obj_t *ds3o)
ds3_part_t
struct ds3_part ds3_part_t
Definition daos_s3.h:56
ds3_obj_write
int ds3_obj_write(void *buf, daos_off_t off, daos_size_t *size, ds3_bucket_t *ds3b, ds3_obj_t *ds3o, daos_event_t *ev)
ds3_obj_t
struct ds3_obj ds3_obj_t
Definition daos_s3.h:53
ds3_upload_remove
int ds3_upload_remove(const char *bucket_name, const char *upload_id, ds3_t *ds3)
ds3_t
struct ds3 ds3_t
Definition daos_s3.h:47
ds3_obj_create
int ds3_obj_create(const char *key, ds3_obj_t **ds3o, ds3_bucket_t *ds3b)
DS3_MAX_KEY_BUFF
#define DS3_MAX_KEY_BUFF
Definition daos_s3.h:32
ds3_upload_list_parts
int ds3_upload_list_parts(const char *bucket_name, const char *upload_id, uint32_t *npart, struct ds3_multipart_part_info *parts, uint32_t *marker, bool *is_truncated, ds3_t *ds3)
ds3_connect
int ds3_connect(const char *pool, const char *sys, ds3_t **ds3, daos_event_t *ev)
ds3_obj_set_info
int ds3_obj_set_info(struct ds3_object_info *info, ds3_bucket_t *ds3b, ds3_obj_t *ds3o)
ds3_bucket_get_info
int ds3_bucket_get_info(struct ds3_bucket_info *info, ds3_bucket_t *ds3b, daos_event_t *ev)
ds3_user_get
int ds3_user_get(const char *name, struct ds3_user_info *info, ds3_t *ds3, daos_event_t *ev)
ds3_bucket_list_obj
int ds3_bucket_list_obj(uint32_t *nobj, struct ds3_object_info *objs, uint32_t *ncp, struct ds3_common_prefix_info *cps, const char *prefix, const char *delim, char *marker, bool list_versions, bool *is_truncated, ds3_bucket_t *ds3b)
ds3_bucket_t
struct ds3_bucket ds3_bucket_t
Definition daos_s3.h:50
ds3_bucket_list
int ds3_bucket_list(daos_size_t *nbuck, struct ds3_bucket_info *buf, char *marker, bool *is_truncated, ds3_t *ds3, daos_event_t *ev)
ds3_part_read
int ds3_part_read(void *buf, daos_off_t off, daos_size_t *size, ds3_part_t *ds3p, ds3_t *ds3, daos_event_t *ev)
ds3_user_remove
int ds3_user_remove(const char *name, struct ds3_user_info *info, ds3_t *ds3, daos_event_t *ev)
ds3_part_set_info
int ds3_part_set_info(struct ds3_multipart_part_info *info, ds3_part_t *ds3p, ds3_t *ds3, daos_event_t *ev)
ds3_obj_destroy
int ds3_obj_destroy(const char *key, ds3_bucket_t *ds3b)
DS3_MAX_UPLOAD_ID
#define DS3_MAX_UPLOAD_ID
Definition daos_s3.h:38
dfs_attr_t
Definition daos_fs.h:62
ds3_bucket_info
Definition daos_s3.h:75
ds3_bucket_info::encoded
void * encoded
Definition daos_s3.h:79
ds3_bucket_info::encoded_length
size_t encoded_length
Definition daos_s3.h:81
ds3_bucket_info::name
char name[DS3_MAX_BUCKET_NAME]
Definition daos_s3.h:77
ds3_common_prefix_info
Definition daos_s3.h:95
ds3_common_prefix_info::prefix
char prefix[DS3_MAX_KEY_BUFF]
Definition daos_s3.h:97
ds3_multipart_part_info
Definition daos_s3.h:113
ds3_multipart_part_info::encoded
void * encoded
Definition daos_s3.h:117
ds3_multipart_part_info::part_num
uint64_t part_num
Definition daos_s3.h:115
ds3_multipart_part_info::encoded_length
size_t encoded_length
Definition daos_s3.h:119
ds3_multipart_upload_info
Definition daos_s3.h:101
ds3_multipart_upload_info::encoded
void * encoded
Definition daos_s3.h:107
ds3_multipart_upload_info::key
char key[DS3_MAX_KEY_BUFF]
Definition daos_s3.h:105
ds3_multipart_upload_info::encoded_length
size_t encoded_length
Definition daos_s3.h:109
ds3_multipart_upload_info::upload_id
char upload_id[DS3_MAX_UPLOAD_ID]
Definition daos_s3.h:103
ds3_object_info
Definition daos_s3.h:85
ds3_object_info::encoded
void * encoded
Definition daos_s3.h:89
ds3_object_info::key
char key[DS3_MAX_KEY_BUFF]
Definition daos_s3.h:87
ds3_object_info::encoded_length
size_t encoded_length
Definition daos_s3.h:91
ds3_user_info
Definition daos_s3.h:59
ds3_user_info::access_ids_nr
const size_t access_ids_nr
Definition daos_s3.h:67
ds3_user_info::encoded
void * encoded
Definition daos_s3.h:69
ds3_user_info::email
const char * email
Definition daos_s3.h:63
ds3_user_info::encoded_length
size_t encoded_length
Definition daos_s3.h:71
ds3_user_info::name
const char * name
Definition daos_s3.h:61
ds3_user_info::access_ids
const char ** access_ids
Definition daos_s3.h:65