Resource Manager
To get instance of BangDB Resource Manager
BangDB Resource Manager (BangDBEnv *bdb);
To initialize the BRS
int init_brs_meta();
To create a bucket
int create_bucket(const char *bucket_info);
bucket_info
is the name of the bucket to be created. It returns -1 for error.
To get list of buckets present in BRS
char *list_all_buckets(const char *user_info);
It returns NULL for error else the list of the buckets. Users should use delete[]
the returned string.
To count the number of buckets present in the BRS
long count_buckets();
It returns -1 for error else the count.
To delete a bucket
int delete_bucket(const char *bucket_info);
It returns -1 for error else 0 or more than 0.
To upload an object into a bucket
long put_object(const char *bucket_info, const char *key, const char *data, long datlen, bool force = false);
Here, bucket_info
is the bucket name and key is the unique name given by the user to the object to be uploaded. It returns -1 for error else 0 or more than 0.
To download an object from a bucket in BRS
long get_object(const char *bucket_info, const char *key, char **data, long *datlen);
It returns -1 for error else 0 or more than 0. Users should delete or free the returned data using delete[]
.
To upload a file into a bucket
long put_file(const char *bucket_info, const char *key, const char *fpath, InsertOptions iop, bool force = false);
It returns -1 for error else 0 or more than 0.
To download a file from a bucket to local system
long get_file(const char *bucket_info, const char *key, const char *fname, const char *fpath);
Key is the unique name/id provided by user or bangdb to refre that file and fpath is the location where the file will be downloaded with fname as file name. It returns -1 for error else 0 or more than 0.
To delete an object in a bucket
int del_object(const char *bucket_info, const char *key);
It returns -1 for error else 0 or more than 0.
To count the number of large objects present in a bucket
int count_slices(const char *bucket_info, const char *key);
It returns -1 for error else the slice count.
To count current number of objects for the bucket
long count_objects(const char *bucket_info);
It returns -1 for error else the slice count.
To list all object present
char *list_objects(const char *bucket_info, const char *skey, int list_size_mb);
It returns NULL for error or the list of objects. Users should free the returned data using delete[]
.
To closed a bucket
int close_bucket(const char *bucket_info);
It returns -1 for error else 0 or positive number.
To closed resource manager
int close_resource_manager(CloseType closetype = DEFAULT_AT_CLIENT, bool force = false);
It returns -1 for error or 0 or positive number.