DAOS API (v2.1 - dev)
|
Go to the source code of this file.
Data Structures | |
struct | ds3_user_info |
struct | ds3_bucket_info |
struct | ds3_object_info |
struct | ds3_common_prefix_info |
struct | ds3_multipart_upload_info |
struct | ds3_multipart_part_info |
Macros | |
#define | DS3_MAX_BUCKET_NAME DAOS_PROP_MAX_LABEL_BUF_LEN |
#define | DS3_MAX_KEY (DFS_MAX_PATH - 8) |
#define | DS3_MAX_KEY_BUFF DFS_MAX_PATH |
#define | DS3_MAX_USER_NAME DFS_MAX_NAME |
#define | DS3_MAX_UPLOAD_ID 35 |
#define | DS3_MAX_ENCODED_LEN DFS_MAX_XATTR_LEN |
#define | DS3_LATEST_INSTANCE "latest" |
Typedefs | |
typedef struct ds3 | ds3_t |
typedef struct ds3_bucket | ds3_bucket_t |
typedef struct ds3_obj | ds3_obj_t |
typedef struct ds3_part | ds3_part_t |
Functions | |
int | ds3_init () |
int | ds3_fini () |
int | ds3_connect (const char *pool, const char *sys, ds3_t **ds3, daos_event_t *ev) |
int | ds3_disconnect (ds3_t *ds3, daos_event_t *ev) |
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) |
int | ds3_user_remove (const char *name, struct ds3_user_info *info, ds3_t *ds3, daos_event_t *ev) |
int | ds3_user_get (const char *name, struct ds3_user_info *info, ds3_t *ds3, daos_event_t *ev) |
int | ds3_user_get_by_email (const char *email, struct ds3_user_info *info, ds3_t *ds3, daos_event_t *ev) |
int | ds3_user_get_by_key (const char *key, struct ds3_user_info *info, ds3_t *ds3, daos_event_t *ev) |
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) |
int | ds3_bucket_create (const char *name, struct ds3_bucket_info *info, dfs_attr_t *attr, ds3_t *ds3, daos_event_t *ev) |
int | ds3_bucket_destroy (const char *name, bool force, ds3_t *ds3, daos_event_t *ev) |
int | ds3_bucket_open (const char *name, ds3_bucket_t **ds3b, ds3_t *ds3, daos_event_t *ev) |
int | ds3_bucket_close (ds3_bucket_t *ds3b, daos_event_t *ev) |
int | ds3_bucket_get_info (struct ds3_bucket_info *info, ds3_bucket_t *ds3b, daos_event_t *ev) |
int | ds3_bucket_set_info (struct ds3_bucket_info *info, ds3_bucket_t *ds3b, daos_event_t *ev) |
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) |
int | ds3_obj_create (const char *key, ds3_obj_t **ds3o, ds3_bucket_t *ds3b) |
int | ds3_obj_open (const char *key, ds3_obj_t **ds3o, ds3_bucket_t *ds3b) |
int | ds3_obj_close (ds3_obj_t *ds3o) |
int | ds3_obj_get_info (struct ds3_object_info *info, ds3_bucket_t *ds3b, ds3_obj_t *ds3o) |
int | ds3_obj_set_info (struct ds3_object_info *info, ds3_bucket_t *ds3b, ds3_obj_t *ds3o) |
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) |
int | ds3_obj_destroy (const char *key, ds3_bucket_t *ds3b) |
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) |
int | ds3_obj_mark_latest (const char *key, ds3_bucket_t *ds3b) |
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) |
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) |
int | ds3_upload_init (struct ds3_multipart_upload_info *info, const char *bucket_name, ds3_t *ds3) |
int | ds3_upload_remove (const char *bucket_name, const char *upload_id, ds3_t *ds3) |
int | ds3_upload_get_info (struct ds3_multipart_upload_info *info, const char *bucket_name, const char *upload_id, ds3_t *ds3) |
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) |
int | ds3_part_close (ds3_part_t *ds3p) |
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) |
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) |
int | ds3_part_set_info (struct ds3_multipart_part_info *info, ds3_part_t *ds3p, ds3_t *ds3, daos_event_t *ev) |
DAOS S3 API
The DS3 API provides an emulation of the S3 API over DAOS. An S3 bucket map to one container.
Definition in file daos_s3.h.
#define DS3_MAX_BUCKET_NAME DAOS_PROP_MAX_LABEL_BUF_LEN |
#define DS3_MAX_ENCODED_LEN DFS_MAX_XATTR_LEN |
#define DS3_MAX_KEY (DFS_MAX_PATH - 8) |
#define DS3_MAX_KEY_BUFF DFS_MAX_PATH |
#define DS3_MAX_USER_NAME DFS_MAX_NAME |
typedef struct ds3_bucket ds3_bucket_t |
typedef struct ds3_part ds3_part_t |
int ds3_bucket_close | ( | ds3_bucket_t * | ds3b, |
daos_event_t * | ev ) |
Close an S3 bucket handle.
[in] | ds3b | S3 bucket handle to close. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
int ds3_bucket_create | ( | const char * | name, |
struct ds3_bucket_info * | info, | ||
dfs_attr_t * | attr, | ||
ds3_t * | ds3, | ||
daos_event_t * | ev ) |
Create a bucket in the DAOS pool identified by ds3. Optionally set attributes for hints on the container.
[in] | name | Bucket name. Must be unique in the pool. |
[in] | info | Bucket info to be added to the bucket. |
[in] | attr | Optional set of properties and attributes to set on the container. Pass NULL if none. |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
int ds3_bucket_destroy | ( | const char * | name, |
bool | force, | ||
ds3_t * | ds3, | ||
daos_event_t * | ev ) |
Destroy a bucket in the DAOS pool identified by ds3.
[in] | name | Name of the bucket to destroy. |
[in] | force | If true, remove bucket even if non-empty. |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
int ds3_bucket_get_info | ( | struct ds3_bucket_info * | info, |
ds3_bucket_t * | ds3b, | ||
daos_event_t * | ev ) |
Get S3 bucket info.
[out] | info | Returned S3 bucket info. |
[in] | ds3b | Pointer to the S3 bucket handle to use. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
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 ) |
List buckets stored in the DAOS pool identified by ds3.
[in,out] | nbuck | [in]: buf length in items. [out]: Number of buckets returned. |
[out] | buf | Array of bucket info structures. |
[in,out] | marker | [in]: Start listing from marker key [out]: Returned marker key for next call |
[out] | is_truncated | Are the results truncated |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
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 ) |
List S3 multipart uploads pending in the S3 bucket identified by bucket_name.
[in] | bucket_name | Name of the bucket. |
[in,out] | nmp | [in]: mps length in items. [out]: Number of multipart uploads returned. |
[out] | mps | Array of object info structures. |
[in,out] | ncp | [in]: cps length in items. [out]: Number of common prefixes returned. |
[out] | cps | Array of common prefix info structures. |
[in] | prefix | (Optional) List multipart uploads that start with this prefix. |
[in] | delim | (Optional) Divide results by delim. |
[in,out] | marker | [in]: Start listing from marker key. [out]: Next marker to be used by subsequent calls. |
[out] | is_truncated | Are the results truncated |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
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 ) |
List S3 objects stored in the S3 bucket identified by ds3b.
[in,out] | nobj | [in]: objs length in items. [out]: Number of objects returned. |
[out] | objs | Array of object info structures. |
[in,out] | ncp | [in]: cps length in items. [out]: Number of common prefixes returned. |
[out] | cps | Array of common prefix info structures. |
[in] | prefix | (Optional) List objects that start with this prefix. |
[in] | delim | (Optional) Divide results by delim. |
[in,out] | marker | [in]: Start listing from marker key. [out]: Next marker to be used by subsequent calls. |
[in] | list_versions | Also include versions |
[out] | is_truncated | Are the results truncated |
[in] | ds3b | Pointer to the S3 bucket handle to use. |
int ds3_bucket_open | ( | const char * | name, |
ds3_bucket_t ** | ds3b, | ||
ds3_t * | ds3, | ||
daos_event_t * | ev ) |
Open an S3 bucket identified by name.
[in] | name | Name of the bucket to open. |
[out] | ds3b | Returned S3 bucket handle. |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
int ds3_bucket_set_info | ( | struct ds3_bucket_info * | info, |
ds3_bucket_t * | ds3b, | ||
daos_event_t * | ev ) |
Set S3 bucket info.
[in] | info | S3 bucket info. |
[in] | ds3b | Pointer to the S3 bucket handle to use. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
int ds3_connect | ( | const char * | pool, |
const char * | sys, | ||
ds3_t ** | ds3, | ||
daos_event_t * | ev ) |
Connect to the pool where all buckets are/will be stored and return a ds3 handle.
[in] | pool | Pool label or UUID string to connect to. |
[in] | sys | DAOS system name to use for the pool connect. Pass NULL to use the default system. |
[out] | ds3 | Pointer to the created DAOS S3 pool handle |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
int ds3_disconnect | ( | ds3_t * | ds3, |
daos_event_t * | ev ) |
Release the DAOS S3 pool handle.
[in] | ds3 | Pointer to the DAOS S3 pool handle to release. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
int ds3_fini | ( | ) |
Finalize the relevant DAOS libraries if necessary.
int ds3_init | ( | ) |
Initialize all the relevant DAOS libraries.
int ds3_obj_close | ( | ds3_obj_t * | ds3o | ) |
Close an object handle.
[in] | ds3o | S3 object handle to close. |
int ds3_obj_create | ( | const char * | key, |
ds3_obj_t ** | ds3o, | ||
ds3_bucket_t * | ds3b ) |
Create an S3 Object in the S3 bucket identified by ds3b.
[in] | key | Key of the S3 object to destroy. |
[out] | ds3o | Returned S3 object handle. |
[in] | ds3b | Pointer to the S3 bucket handle to use. |
int ds3_obj_destroy | ( | const char * | key, |
ds3_bucket_t * | ds3b ) |
Destroy an S3 object in the S3 bucket identified by ds3b.
[in] | key | Key of the S3 object to destroy. |
[in] | ds3b | Pointer to the S3 bucket handle to use. |
int ds3_obj_get_info | ( | struct ds3_object_info * | info, |
ds3_bucket_t * | ds3b, | ||
ds3_obj_t * | ds3o ) |
Get S3 object info.
[out] | info | Returned S3 object info. |
[in] | ds3b | Pointer to the S3 bucket handle to use. |
[in] | ds3o | Pointer to the S3 object handle to use. |
int ds3_obj_mark_latest | ( | const char * | key, |
ds3_bucket_t * | ds3b ) |
Mark an S3 object in the S3 bucket identified by ds3b as being the latest version.
[in] | key | Key of the S3 object to mark as latest. |
[in] | ds3b | Pointer to the S3 bucket handle to use. |
int ds3_obj_open | ( | const char * | key, |
ds3_obj_t ** | ds3o, | ||
ds3_bucket_t * | ds3b ) |
Open an S3 object.
[in] | key | Key of the object to open. |
[out] | ds3o | Returned S3 object handle. |
[in] | ds3b | Pointer to the S3 bucket handle to use. |
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 ) |
Read S3 object data.
[in,out] | buf | [in]: Allocated buffer for data. [out]: Actual data read. |
[in] | off | Offset into the file to read from. |
[in,out] | size | [in]: Size of buffer passed in. [out]: Actual size of data read. |
[in] | ds3b | ds3b Pointer to the S3 bucket handle to use. |
[in] | ds3o | S3 object handle to read from. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
int ds3_obj_set_info | ( | struct ds3_object_info * | info, |
ds3_bucket_t * | ds3b, | ||
ds3_obj_t * | ds3o ) |
Set S3 object info.
[in] | info | S3 object info. |
[in] | ds3b | Pointer to the S3 bucket handle to use. |
[in] | ds3o | Pointer to the S3 object handle to use. |
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 ) |
Write S3 object data.
[in] | buf | Data to write. |
[in] | off | Offset into the file to write to. |
[in,out] | size | [in]: Size of buffer passed in. [out]: Actual size of data written. |
[in] | ds3b | Pointer to the S3 bucket handle to use. |
[in] | ds3o | S3 object handle to read from. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
int ds3_part_close | ( | ds3_part_t * | ds3p | ) |
Close a part handle.
[in] | ds3p | S3 part handle to close. |
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 ) |
Open an S3 multipart part identified by part_num.
[in] | bucket_name | Name of the bucket. |
[in] | upload_id | ID of the upload. |
[in] | part_num | The part number. |
[in] | truncate | whether to truncate the part object. |
[out] | ds3p | Returned S3 object handle. |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
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 ) |
Read S3 part data.
[in] | buf | Data to read. |
[in] | off | Offset into the file to read from. |
[in,out] | size | [in]: Size of buffer passed in. [out]: Actual size of data read. |
[in] | ds3p | S3 part handle to read from. |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
int ds3_part_set_info | ( | struct ds3_multipart_part_info * | info, |
ds3_part_t * | ds3p, | ||
ds3_t * | ds3, | ||
daos_event_t * | ev ) |
Set S3 part info.
[in] | info | S3 multipart upload part info. |
[in] | ds3p | Pointer to the S3 part handle to use. |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
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 ) |
Write S3 part data.
[in] | buf | Data to write. |
[in] | off | Offset into the file to write to. |
[in,out] | size | [in]: Size of buffer passed in. [out]: Actual size of data written. |
[in] | ds3p | S3 part handle to read from. |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
int ds3_upload_get_info | ( | struct ds3_multipart_upload_info * | info, |
const char * | bucket_name, | ||
const char * | upload_id, | ||
ds3_t * | ds3 ) |
Gwt S3 multipart upload info identified by upload_id in the bucket identified by bucket_name
[in] | info | S3 upload info. |
[in] | bucket_name | Name of the bucket. |
[in] | upload_id | ID of the upload. |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
int ds3_upload_init | ( | struct ds3_multipart_upload_info * | info, |
const char * | bucket_name, | ||
ds3_t * | ds3 ) |
Init an S3 upload in the S3 bucket identified by bucket_name
[in] | info | S3 upload info. |
[in] | bucket_name | Name of the bucket. |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
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 ) |
List S3 multipart uploaded parts related to upload_id in the bucket identified by bucket_name
[in] | bucket_name | Name of the bucket. |
[in] | upload_id | ID of the upload. |
[in,out] | npart | [in]: parts length in items. [out]: Number of parts returned. |
[out] | parts | Array of multipart part info structures. |
[in,out] | marker | [in]: Start listing from marker key. [out]: Next marker to be used by subsequent calls. |
[out] | is_truncated | Are the results truncated |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
int ds3_upload_remove | ( | const char * | bucket_name, |
const char * | upload_id, | ||
ds3_t * | ds3 ) |
Remove the S3 multipart upload identified by upload_id in the bucket identified by bucket_name
[in] | bucket_name | Name of the bucket. |
[in] | upload_id | ID of the upload. |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
int ds3_user_get | ( | const char * | name, |
struct ds3_user_info * | info, | ||
ds3_t * | ds3, | ||
daos_event_t * | ev ) |
Look-up S3 user information by name.
[in] | name | Name of the S3 user to look up. |
[in] | info | User info. |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
int ds3_user_get_by_email | ( | const char * | email, |
struct ds3_user_info * | info, | ||
ds3_t * | ds3, | ||
daos_event_t * | ev ) |
Look-up S3 user information by email.
[in] | Email of the S3 user to look up. | |
[in] | info | User info. |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
int ds3_user_get_by_key | ( | const char * | key, |
struct ds3_user_info * | info, | ||
ds3_t * | ds3, | ||
daos_event_t * | ev ) |
Look-up S3 user information by key.
[in] | key | Key associated with the S3 user to look up. |
[in] | info | User info. |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
int ds3_user_remove | ( | const char * | name, |
struct ds3_user_info * | info, | ||
ds3_t * | ds3, | ||
daos_event_t * | ev ) |
Remove user from S3 user database.
[in] | name | Name of the S3 user to look up. |
[in] | info | User info. Necessary to remove symlinks |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |
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 ) |
Add/update user information in the S3 user database.
[in] | name | Name of the S3 user to look up. |
[in] | info | User info. |
[in] | old_info | (Optional) Old user info. |
[in] | ds3 | Pointer to the DAOS S3 pool handle to use. |
[in] | ev | Completion event, it is optional and can be NULL. Function will run in blocking mode if ev is NULL. |