bg

BangDB Resource Manager (Embedded)

chevron

BangDBResourceManager Type

For embedded BangDB

BangDB Resource Manager (BRS) is a type to allow users to deal with large files and objects. Users can store and fetch large files in the buckets.

C++

Selected

Java

Selected

To get instance of BangDBResourceManager

BangDBResourceManager(BangDBDatabase *bdb);
To initialize the BRS
int init_brs_meta();
To create a bucket
int create_bucket(char *bucket_info); This creates a bucket as defined by the bucket_info which looks like following; {access_key:, secret_key:, bucket_name:} It returns -1 for error
To get list of buckets present in BRS for a user
char *list_buckets(char *user_info); It returns NULL for error else the list of the buckets. Users should use delete[] the returned string
To get list of buckets present in BRS
char *list_all_buckets(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(char *bucket_info); It returns -1 for error else 0 or more than 0
To upload an object into a bucket
long put_object(char *bucket_info, char *key, 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(char *bucket_info, char *key, char **data, long *datlen); returns the current number of objects for the bucket if successful else -1
To upload a file into a bucket
long put_file(char *bucket_info, char *key, char *fpath, InsertOptions iop, bool force = false); InsertOptions is an enum with following: INSERT_UNIQUE, //if non-existing then insert else return UPDATE_EXISTING, //if existing then update else return INSERT_UPDATE, //insert if non-existing else update DELETE_EXISTING, //delete if existing UPDATE_EXISTING_INPLACE, //only for inplace update INSERT_UPDATE_INPLACE, //only for inplace update Please see more on this at bangdb common It returns -1 for error else 0 or more than 0
To download a file from a bucket to local system
long get_file(char *bucket_info, char *key, char *fname, 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(char *bucket_info, char *key); It returns -1 for error else 0 or more than 0
To count the number of slices of an objects present in a bucket
int count_slices(char *bucket_info, char *key); It returns -1 for error else the slice count
To count current number of objects for the bucket
long count_objects(char *bucket_info); It returns -1 for error else the slice count
To list all object present
char *list_objects(char *bucket_info); 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(char *bucket_info); It returns -1 for error else 0 or positive number
To closed resource manager
int close_resource_manager(CloseType closetype = DEFAULT, bool force = false); ClosedType is enum with following values; DEFAULT_AT_CLIENT CONSERVATIVE_AT_SERVER OPTIMISTIC_AT_SERVER, CLEANCLOSE_AT_SERVER, SIMPLECLOSE_AT_SERVER, DEFAULT_AT_SERVER Please see more on this at bangdb common It returns -1 for error or 0 or positive number