diff --git a/modules/global-db/dap_chain_global_db.c b/modules/global-db/dap_chain_global_db.c index b10bd0088ad5a4bc590bbe431ef9ba02ebdf90a5..ab5582616ac3be4e051be1bc8e62316b5a604e6c 100644 --- a/modules/global-db/dap_chain_global_db.c +++ b/modules/global-db/dap_chain_global_db.c @@ -51,13 +51,13 @@ // for access from several streams //static pthread_mutex_t ldb_mutex_ = PTHREAD_MUTEX_INITIALIZER; -//Do nothing +// The function does nothing static inline void lock() { //pthread_mutex_lock(&ldb_mutex_); } -//Do nothing +// The function does nothing static inline void unlock() { //pthread_mutex_unlock(&ldb_mutex_); @@ -79,9 +79,11 @@ static sync_group_item_t *s_sync_group_extra_items = NULL; static bool s_track_history = false; /** - * @brief dap_chain_global_db_add_sync_group - * @details Add group name for synchronization - * @param a_group_prefix + * @brief Adds a group name for synchronization. + * @param a_group_prefix a prefix of the group name + * @param a_callback a callback function + * @param a_arg a pointer to an argument + * @return (none) */ void dap_chain_global_db_add_sync_group(const char *a_group_prefix, dap_global_db_obj_callback_notify_t a_callback, void *a_arg) { @@ -94,9 +96,11 @@ void dap_chain_global_db_add_sync_group(const char *a_group_prefix, dap_global_d } /** - * @brief dap_chain_global_db_add_sync_extra_group - * @details Add group name for synchronization with especially node addresses - * @param a_group_prefix + * @brief Adds a group name for synchronization with especially node addresses. + * @param a_group_mask a group mask string + * @param a_callback a callabck function + * @param a_arg a pointer to an argument + * @return (none) */ void dap_chain_global_db_add_sync_extra_group(const char *a_group_mask, dap_global_db_obj_callback_notify_t a_callback, void *a_arg) { @@ -108,6 +112,11 @@ void dap_chain_global_db_add_sync_extra_group(const char *a_group_mask, dap_glob HASH_ADD_STR(s_sync_group_extra_items, group_mask, l_item); } +/** + * @brief Gets a list of a group mask. + * @param a_table a table + * @return Returns a pointer to a list of a group mask. + */ dap_list_t *dap_chain_db_get_sync_groups_internal(sync_group_item_t *a_table) { dap_list_t *l_ret = NULL; @@ -118,19 +127,29 @@ dap_list_t *dap_chain_db_get_sync_groups_internal(sync_group_item_t *a_table) return l_ret; } +/** + * @brief Gets a list of a group mask for s_sync_group_items. + * @return Returns a pointer to a list of a group mask. + */ dap_list_t *dap_chain_db_get_sync_groups() { return dap_chain_db_get_sync_groups_internal(s_sync_group_items); } +/** + * @brief Gets a list of a group mask for s_sync_group_items. + * @param a_table a table + * @return Returns a pointer to a list of a group mask. + */ dap_list_t *dap_chain_db_get_sync_extra_groups() { return dap_chain_db_get_sync_groups_internal(s_sync_group_extra_items); } /** - * @brief Deallocates memory of key and value members of a item. - * @param obj A pointer to the item + * @brief Deallocates memory of a key and a value members of an obj structure. + * @param obj a pointer to the structure + * @return (none) */ void dap_chain_global_db_obj_clean(dap_global_db_obj_t *obj) { @@ -143,8 +162,9 @@ void dap_chain_global_db_obj_clean(dap_global_db_obj_t *obj) } /** - * @brief Deallocates memory of a item. - * @param obj A pointer to the item + * @brief Deallocates memory of an obj structure. + * @param obj a pointer to the object + * @return (none) */ void dap_chain_global_db_obj_delete(dap_global_db_obj_t *obj) { @@ -153,9 +173,10 @@ void dap_chain_global_db_obj_delete(dap_global_db_obj_t *obj) } /** - * @brief Deallocates memory of array of items. - * @param objs an array of items - * @param a_count A aount of items in the array. + * @brief Deallocates memory of an objs array. + * @param objs a pointer to the first object of the array + * @param a_count a number of objects in the array + * @return (none) */ void dap_chain_global_db_objs_delete(dap_global_db_obj_t *objs, size_t a_count) { @@ -166,9 +187,10 @@ void dap_chain_global_db_objs_delete(dap_global_db_obj_t *objs, size_t a_count) } /** - * @brief Initialise a datebase. Befor using must call this fuction. - * @param g_config a pointer to a congiguration struct - * @return 0 if success, otherwise error, + * @brief Initializes a database by g_config structure. + * @note You should call this function before calling any other functions in this library. + * @param g_config a pointer to the configuration structure + * @return Returns 0 if successful; otherwise, <0. */ int dap_chain_global_db_init(dap_config_t * g_config) { @@ -187,7 +209,9 @@ int dap_chain_global_db_init(dap_config_t * g_config) } /** - * @brief Deinitialise a datebase. + * @brief Deinitialize a database. + * @note You should call this function at the end. + * @return (none) */ void dap_chain_global_db_deinit(void) { @@ -213,7 +237,7 @@ void dap_chain_global_db_deinit(void) } /** - * @brief Flushes a datebase. + * @brief Flushes a database cahce to disk. * @return 0 */ int dap_chain_global_db_flush(void){ @@ -224,10 +248,10 @@ int dap_chain_global_db_flush(void){ } /** - * @brief Gets an item from a datebase by a_key and a_group - * @param a_key a key - * @param a_group the group name - * @return If successful, a pointer to an array of items, otherwise NULL. + * @brief Gets an object from a database by a_key and a_group arguments. + * @param a_key an object key string + * @param a_group a group name string + * @return If successful, returns a pointer to the item, otherwise NULL. */ void* dap_chain_global_db_obj_get(const char *a_key, const char *a_group) { @@ -238,11 +262,12 @@ void* dap_chain_global_db_obj_get(const char *a_key, const char *a_group) } /** - * @brief dap_chain_global_db_obj_gr_get - * @param a_key - * @param a_data_out - * @param a_group - * @return + * @brief Gets an array consisting of a_data_len_out objects from a database by a_key and a_group arguments. + * @param a_key an object key string + * @param a_data_len_out[in] a number of objects to be gotten, if NULL - no limits + * @param a_data_len_out[out] a number of objects that were gotten + * @param a_group a group name string + * @return If successful, returns a pointer to the first item in the array; otherwise NULL. */ dap_store_obj_t* dap_chain_global_db_obj_gr_get(const char *a_key, size_t *a_data_len_out, const char *a_group) { @@ -259,11 +284,12 @@ dap_store_obj_t* dap_chain_global_db_obj_gr_get(const char *a_key, size_t *a_dat } /** - * @brief dap_chain_global_db_gr_get - * @param a_key - * @param a_data_out - * @param a_group - * @return + * @brief Gets an object value from database by a_key and a_group. + * @param a_key an object key string + * @param a_data_out[in] a number of objects to be gotten, if NULL - no limits + * @param a_data_out[out] a length of values that were gotten + * @param a_group a group name string + * @return If successful, returns a pointer to the object value. */ uint8_t * dap_chain_global_db_gr_get(const char *a_key, size_t *a_data_len_out, const char *a_group) { @@ -284,6 +310,13 @@ uint8_t * dap_chain_global_db_gr_get(const char *a_key, size_t *a_data_len_out, return l_ret_value; } + +/** + * @brief Gets an object value from database by a_key for the "local.general" group. + * @param a_key an object key string + * @param a_data_out a length of value that were gotten + * @return If successful, returns a pointer to the object value, otherwise NULL. + */ uint8_t * dap_chain_global_db_get(const char *a_key, size_t *a_data_out) { return dap_chain_global_db_gr_get(a_key, a_data_out, GROUP_LOCAL_GENERAL); @@ -291,7 +324,11 @@ uint8_t * dap_chain_global_db_get(const char *a_key, size_t *a_data_out) /** - * Add info about the deleted entry to the base + * @brief Adds info about the deleted entry to the database. + * @param a_key an object key string + * @param a_group a group name string + * @param a_timestamp an object time stamp + * @return True if successful, false otherwise. */ static bool global_db_gr_del_add(char *a_key,const char *a_group, time_t a_timestamp) { @@ -318,12 +355,10 @@ static bool global_db_gr_del_add(char *a_key,const char *a_group, time_t a_times /** - * @brief global_db_gr_del_del: - * Delete info about the deleted entry from the base - * @param a_key - key, looked like "0x8FAFBD00B..." - * @param a_group - group name, for example "kelvin-testnet.nodes" - * @return true - * @return false + * @brief Deletes info about the deleted object from the database + * @param a_key an object key string, looked like "0x8FAFBD00B..." + * @param a_group a group name string, for example "kelvin-testnet.nodes" + * @return If successful, returns true; otherwise, false. */ static bool global_db_gr_del_del(char *a_key, const char *a_group) { @@ -348,9 +383,9 @@ static bool global_db_gr_del_del(char *a_key, const char *a_group) /** - * @brief Gets time stamp of the deleted item by a_group and a_key - * @param a_group a group name, for example "kelvin-testnet.nodes" - * @param a_key a key, looked like "0x8FAFBD00B..." + * @brief Gets time stamp of the deleted object by a_group and a_key arguments. + * @param a_group a group name sring, for example "kelvin-testnet.nodes" + * @param a_key an object key string, looked like "0x8FAFBD00B..." * @return If successful, a time stamp, otherwise 0. */ time_t global_db_gr_del_get_timestamp(const char *a_group, char *a_key) @@ -378,9 +413,9 @@ time_t global_db_gr_del_get_timestamp(const char *a_group, char *a_key) } /** - * @brief Call dap_chain_global_db_gr_del(a_key, GROUP_LOCAL_GENERAL). - * @param a_key key - * @return True or false + * @brief Deletes item from a database by a a_key for the "local.general" group. + * @param a_key an object key string + * @return True if successful, false otherwise. */ bool dap_chain_global_db_del(char *a_key) { @@ -389,9 +424,9 @@ bool dap_chain_global_db_del(char *a_key) /** - * @brief Gets a last item from a datebase by a_group. - * @param a_group a group name - * @return If successful, a pointer to item; otherwise NULL. + * @brief Gets a last item from a database by a_group. + * @param a_group a group name string + * @return If successful, a pointer to the object; otherwise NULL. */ dap_store_obj_t* dap_chain_global_db_get_last(const char *a_group) { @@ -403,12 +438,12 @@ dap_store_obj_t* dap_chain_global_db_get_last(const char *a_group) } /** - * @brief Gets items from a database by a_group_name and a_first_id. - * @param a_group a group name + * @brief Gets objects from a database by a_group_name and a_first_id. + * @param a_group a group name string * @param a_first_id a first id - * @param a_objs_count[in] a count items to read, if 0 - no limits - * @param a_objs_count[out] a count items were read - * @return If successful, a pointer to items; otherwise NULL. + * @param a_objs_count[in] a number of object to be read, if 0 - no limits + * @param a_objs_count[out] a number of object were read + * @return If successful, a pointer to objects; otherwise NULL. */ dap_store_obj_t* dap_chain_global_db_cond_load(const char *a_group, uint64_t a_first_id, size_t *a_objs_count) { @@ -420,10 +455,10 @@ dap_store_obj_t* dap_chain_global_db_cond_load(const char *a_group, uint64_t a_f } /** - * @brief Gets all data from a database by a_group - * @param a_group a group name - * @param a_data_size[in] a poiter to return a count of data - * @param a_data_size[out] a count of data + * @brief Gets all data from a database by a_group. + * @param a_group a group name string + * @param a_data_size[in] a poiter to return a number of data + * @param a_data_size[out] a number of data * @return If successful, a pointer to data; otherwise NULL. */ dap_global_db_obj_t* dap_chain_global_db_gr_load(const char *a_group, size_t *a_data_size_out) @@ -452,7 +487,7 @@ dap_global_db_obj_t* dap_chain_global_db_gr_load(const char *a_group, size_t *a_ } /** - * @brief Calls a dap_chain_global_db_gr_load(GROUP_LOCAL_GENERAL, a_data_size_out). + * @brief Gets all data from a database for the "local.general" group */ dap_global_db_obj_t* dap_chain_global_db_load(size_t *a_data_size_out) { @@ -460,9 +495,10 @@ dap_global_db_obj_t* dap_chain_global_db_load(size_t *a_data_size_out) } /** - * @brief Finds item by a_group - * @param a_group - * @return + * @brief Finds item by a_items and a_group + * @param a_items items + * @param a_group a group name string + * @return */ static sync_group_item_t *find_item_by_mask(sync_group_item_t *a_items, const char *a_group) { @@ -474,7 +510,12 @@ static sync_group_item_t *find_item_by_mask(sync_group_item_t *a_items, const ch return NULL; } - +/** + * @brief Adds data to the history log + * + * @param a_store_data a pointer to an object + * @return (none) + */ void dap_global_db_obj_track_history(void* a_store_data) { dap_store_obj_t *l_obj = (dap_store_obj_t *)a_store_data; @@ -519,13 +560,13 @@ void dap_global_db_obj_track_history(void* a_store_data) /** - * @brief Adds a value to a datebase. - * @param a_key a key + * @brief Adds a value to a database. + * @param a_key a object key string * @param a_value a value to be added - * @param a_value_len length of value. If a_value_len=-1, counts it in function - * @param a_group a group name + * @param a_value_len length of value. If a_value_len=-1, the function calculates length. + * @param a_group a group name string * @details Set one entry to base. IMPORTANT: a_key and a_value should be passed without free after (it will be released by gdb itself) - * @return + * @return True if successful, false otherwise. */ bool dap_chain_global_db_gr_set(char *a_key, void *a_value, size_t a_value_len, const char *a_group) { @@ -557,18 +598,21 @@ bool dap_chain_global_db_gr_set(char *a_key, void *a_value, size_t a_value_len, } /** - * @breif Calls dap_chain_global_db_gr_set(a_key, a_value, a_value_len, GROUP_LOCAL_GENERAL) + * @brief Adds a value to a database for the "local.general" group + * @param a_value a value to be added + * @param a_value_len length of value. If a_value_len=-1, the function counts length. + * @return True if successful, false otherwise. */ bool dap_chain_global_db_set( char *a_key, void *a_value, size_t a_value_len) { return dap_chain_global_db_gr_set(a_key, a_value, a_value_len, GROUP_LOCAL_GENERAL); } -/** - * @brief Deletes item from a datebase by a a_key and a_group. - * @param a_key a key - * @param a_group a group name - * @return True or false. +/** + * @brief Deletes object from a database by a a_key and a_group arguments. + * @param a_key a object key string + * @param a_group a group name string + * @return True if object was deleted or false otherwise. */ bool dap_chain_global_db_gr_del(char *a_key,const char *a_group) { @@ -596,10 +640,10 @@ bool dap_chain_global_db_gr_del(char *a_key,const char *a_group) } /** - * @brief Saves(deletes) items to a database from an array of data_size bytes - * @param a_store_data a pointer to data - * @param a_objs_count a count of items - * @return True or false. + * @brief Saves(deletes) objects to (from) a database. + * @param a_store_data a pointer to objects + * @param a_objs_count a number of objects + * @return True if object was deleted or false otherwise. */ bool dap_chain_global_db_obj_save(void* a_store_data, size_t a_objs_count) { @@ -640,10 +684,10 @@ bool dap_chain_global_db_obj_save(void* a_store_data, size_t a_objs_count) } /** - * @brief Saves items in a datebase by a_group. - * @param a_objs a pointer to items - * @param a_objs_count a count of items - * @param a_group a group name + * @brief Saves objects in a database by a_group. + * @param a_objs a pointer to objects + * @param a_objs_count a number of objects + * @param a_group a group name string * @return If successful, true; otherwise false. */ bool dap_chain_global_db_gr_save(dap_global_db_obj_t* a_objs, size_t a_objs_count, const char *a_group) @@ -667,9 +711,9 @@ bool dap_chain_global_db_gr_save(dap_global_db_obj_t* a_objs, size_t a_objs_coun } /** - * @brief Saves items in a database. - * @param a_objs a pointer to items - * @param a_objs_count a count of items + * @brief Saves objectss in a database. + * @param a_objs a pointer to objects + * @param a_objs_count a number of objects * @return If successful, true; otherwise false. */ bool dap_chain_global_db_save(dap_global_db_obj_t* a_objs, size_t a_objs_count) diff --git a/modules/global-db/dap_chain_global_db_driver.c b/modules/global-db/dap_chain_global_db_driver.c index fba9c6dd17d67ba9343cc6d00c116259eb9b8f38..f019bd15c818efe0944484ceacc14c16b258f877 100644 --- a/modules/global-db/dap_chain_global_db_driver.c +++ b/modules/global-db/dap_chain_global_db_driver.c @@ -43,7 +43,7 @@ #define LOG_TAG "db_driver" -// A selected datebase driver. +// A selected database driver. static char *s_used_driver = NULL; //#define USE_WRITE_BUFFER @@ -73,11 +73,12 @@ static void* func_write_buf(void * arg); static dap_db_driver_callbacks_t s_drv_callback; /** - * @brief Initializes a database driver. Befor using the driver must call this fuction. - * @param driver_name a string determining a type of datebase driver. - * Maybe "Ñdb", "sqlite" ("sqlite3"), "pgsql", "mdbx" - * @param a_filename_db a name of a datebase file - * @return If successful, 0 , otherwise <0. + * @brief Initializes a database driver. + * @note You should Call this function before using the driver. + * @param driver_name a string determining a type of database driver: + * "Ñdb", "sqlite" ("sqlite3") or "pgsql" + * @param a_filename_db a path to a database file + * @return Returns 0, if successful; otherwise <0. */ int dap_db_driver_init(const char *a_driver_name, const char *a_filename_db) { @@ -129,7 +130,9 @@ int dap_db_driver_init(const char *a_driver_name, const char *a_filename_db) } /** - * @brief Deinitializes a database driver. Must call this function after using the driver. + * @brief Deinitializes a database driver. + * @note You should call this function after using the driver. + * @return (none) */ void dap_db_driver_deinit(void) { @@ -170,8 +173,8 @@ void dap_db_driver_deinit(void) } /** - * @brief Flush data to disk - * @return 0 + * @brief Flushes a database cahce to disk. + * @return Returns 0, if successful; otherwise <0. */ int dap_db_driver_flush(void) { @@ -179,10 +182,10 @@ int dap_db_driver_flush(void) } /** - * @brief Copies a_store_count items from a_store_obj to return. - * @param a_store_obj a pointer to source items - * @param a_store_count a count of items - * @return A pointer to the copied items. + * @brief Copies objects from a_store_obj. + * @param a_store_obj a pointer to the source objects + * @param a_store_count a number of objects + * @return A pointer to the copied objects. */ dap_store_obj_t* dap_store_obj_copy(dap_store_obj_t *a_store_obj, size_t a_store_count) { @@ -202,9 +205,9 @@ dap_store_obj_t* dap_store_obj_copy(dap_store_obj_t *a_store_obj, size_t a_store } /** - * @brief Deallocates memory of items. - * @param a_store_obj a pointer to items - * @param a_store_count a count of items + * @brief Deallocates memory of objects. + * @param a_store_obj a pointer to objects + * @param a_store_count a number of objects * @return (none) */ void dap_store_obj_free(dap_store_obj_t *a_store_obj, size_t a_store_count) @@ -221,10 +224,10 @@ void dap_store_obj_free(dap_store_obj_t *a_store_obj, size_t a_store_count) } /** - * @brief Calcs hash string for data + * @brief Calculates a hash of data. * @param data a pointer to data * @param data_size a size of data - * @return Hash string or NULL. + * @return Returns a hash string if successful; otherwise NULL. */ char* dap_chain_global_db_driver_hash(const uint8_t *data, size_t data_size) { @@ -244,11 +247,11 @@ char* dap_chain_global_db_driver_hash(const uint8_t *data, size_t data_size) } /** - * @brief Wait data to write buffer + * @brief Waits for a buffer to be written. * @param a_mutex a mutex - * @param a_cond condition + * @param a_cond a condition * @param l_timeout_ms timeout in ms, if -1 endless waiting - * @return 0 - Ok, 1 - timeout + * @return Returns 0 if successful or 1 when the timeout is due. */ static int wait_data(pthread_mutex_t *a_mutex, pthread_cond_t *a_cond, int l_timeout_ms) { @@ -280,8 +283,8 @@ static int wait_data(pthread_mutex_t *a_mutex, pthread_cond_t *a_cond, int l_tim #ifdef USE_WRITE_BUFFER / /** - * @brief Checks buffer is fill - * @return 0 if buffer empty, 1 data present + * @brief Checks if a buffer is not empty. + * @return Returns true if the buffer is not empty, false if it is empty. */ static bool check_fill_buf(void) { @@ -301,7 +304,8 @@ static bool check_fill_buf(void) } /** - * @brief Waits apply write buffer. + * @brief Waits until the buffer is not empty. + * @return (none) */ static void wait_write_buf() { @@ -317,7 +321,7 @@ static void wait_write_buf() } /** - * @brief Saves data from buffer to database + * @brief Saves data from a buffer to a database. * @return 0 */ static int save_write_buf(void) @@ -379,8 +383,8 @@ static int save_write_buf(void) } /** - * @brief thread for save data from buffer to database - * @param arg + * @brief A thread for saving data from buffer to a database + * @param arg NULL, is not used * @return NULL */ static void* func_write_buf(void * arg) @@ -401,10 +405,10 @@ static void* func_write_buf(void * arg) #endif //USE_WRITE_BUFFER /** - * @brief Applies items to datebase - * @param a_store an array of items - * @param a_store_count a count of items - * @return + * @brief Applies objects to database. + * @param a_store an pointer to the objects + * @param a_store_count a number of objectss + * @return Returns 0, if successful. */ int dap_chain_global_db_driver_appy(pdap_store_obj_t a_store_obj, size_t a_store_count) { @@ -467,10 +471,10 @@ int dap_chain_global_db_driver_appy(pdap_store_obj_t a_store_obj, size_t a_store } /** - * @brief Adds items to a database. - * @param a_store_obj items to be added - * @param a_store_count a count added items - * @return If sucseesful, 1, otherwise 0 or <0. + * @brief Adds objects to a database. + * @param a_store_obj objects to be added + * @param a_store_count a number of added objects + * @return Returns 0 if sucseesful. */ int dap_chain_global_db_driver_add(pdap_store_obj_t a_store_obj, size_t a_store_count) { @@ -480,10 +484,10 @@ int dap_chain_global_db_driver_add(pdap_store_obj_t a_store_obj, size_t a_store_ } /** - * @brief Deletes items from a database. - * @param a_store_obj items to be deleted - * @param a_store_count a count deleted items - * @return If sucseesful, 1, otherwise 0 or <0. + * @brief Deletes objects from a database. + * @param a_store_obj objects to be deleted + * @param a_store_count a number of deleted objects + * @return Returns 0 if sucseesful. */ int dap_chain_global_db_driver_delete(pdap_store_obj_t a_store_obj, size_t a_store_count) { @@ -493,10 +497,10 @@ int dap_chain_global_db_driver_delete(pdap_store_obj_t a_store_obj, size_t a_sto } /** - * @brief Gets a count of items in a database by a_group and id. - * @param a_group the group name + * @brief Gets a number of stored objects in a database by a_group and id. + * @param a_group the group name string * @param a_id id - * @return The count of items. + * @return Returns a number of objects. */ size_t dap_chain_global_db_driver_count(const char *a_group, uint64_t id) { @@ -511,8 +515,8 @@ size_t dap_chain_global_db_driver_count(const char *a_group, uint64_t id) * @brief Gets a list of group names matching the pattern. * Check whether the groups match the pattern a_group_mask, which is a shell wildcard pattern * patterns: [] {} [!] * ? https://en.wikipedia.org/wiki/Glob_(programming). - * @param a_group_mask the group mask - * @return If successful, the list of group names, otherwise NULL. + * @param a_group_mask the group mask string + * @return If successful, returns the list of group names, otherwise NULL. */ dap_list_t* dap_chain_global_db_driver_get_groups_by_mask(const char *a_group_mask) { @@ -524,9 +528,9 @@ dap_list_t* dap_chain_global_db_driver_get_groups_by_mask(const char *a_group_ma /** - * @brief Reads last items in the database. + * @brief Reads last object in the database. * @param a_group the group name - * @return If successful, a pointer to the item, otherwise NULL. + * @return If successful, a pointer to the object, otherwise NULL. */ dap_store_obj_t* dap_chain_global_db_driver_read_last(const char *a_group) { @@ -542,12 +546,12 @@ dap_store_obj_t* dap_chain_global_db_driver_read_last(const char *a_group) } /** - * @brief Reads several items from a database by a_group and id. - * @param a_group the group name + * @brief Reads several objects from a database by a_group and id. + * @param a_group the group name string * @param a_id id - * @param a_count_out[in] a count of items to read, if 0 - no limits - * @param a_count_out[out] a count of items were read - * @return If successful, a pointer to an array of items, otherwise NULL. + * @param a_count_out[in] a number of objects to be read, if 0 - no limits + * @param a_count_out[out] a count of objects that were read + * @return If successful, a pointer to an objects, otherwise NULL. */ dap_store_obj_t* dap_chain_global_db_driver_cond_read(const char *a_group, uint64_t id, size_t *a_count_out) { @@ -563,13 +567,13 @@ dap_store_obj_t* dap_chain_global_db_driver_cond_read(const char *a_group, uint6 } /** - * @brief Reads several items from a database by a_group and a_key. + * @brief Reads several objects from a database by a_group and a_key. * If a_key is NULL, reads whole group. - * @param a_group the group name - * @param a_key key name, may by NULL. it means reading the whole group - * @param a_count_out[in] a count of items to read, if 0 - no limits - * @param a_count_out[out] a count of items was read - * @return If successful, a pointer to an array of items, otherwise NULL. + * @param a_group a group name string + * @param a_key an object key string. If equal NULL, it means reading the whole group + * @param a_count_out[in] a number of objects to be read, if 0 - no limits + * @param a_count_out[out] a number of objects that were read + * @return If successful, a pointer to an objects, otherwise NULL. */ dap_store_obj_t* dap_chain_global_db_driver_read(const char *a_group, const char *a_key, size_t *a_count_out) { @@ -585,10 +589,10 @@ dap_store_obj_t* dap_chain_global_db_driver_read(const char *a_group, const char } /** - * @brief Checks an element in a database by a_group and a_key. - * @param a_group a group namme - * @param a_key a key - * @return True if is, 0 otherwise. + * @brief Checks if an object is in a database by a_group and a_key. + * @param a_group a group name string + * @param a_key a object key string + * @return Returns true if it is, false otherwise. */ bool dap_chain_global_db_driver_is(const char *a_group, const char *a_key) {