You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
@@ -1098,10 +1096,10 @@ unsigned int AGMDB_getKeyNum(struct agmdb_handler *dbm) {
1098
1096
timelist_cnt ++;
1099
1097
entry_id = *ENTRY_TIME_NEXT(entry_addr);
1100
1098
}
1101
-
1099
+
*keynum = timelist_cnt;
1102
1100
// Check the length of expirartion time linklist and the busy entry counter;
1103
1101
if(timelist_cnt == *SHM_BUSY_ENTRY_CNT(shm_base))
1104
-
returntimelist_cnt;
1102
+
returnAGMDB_SUCCESS;
1105
1103
else
1106
1104
return AGMDB_FAIL;
1107
1105
}
@@ -1122,6 +1120,45 @@ int AGMDB_getHashValue(const char* key, int key_len, int output_val_range) {
1122
1120
returnAGMDB_hash(key, key_len, output_val_range);
1123
1121
}
1124
1122
1123
+
/**
1124
+
** Get the const pointers of all keys and values in a database.
1125
+
** You have to get SHARED or EXCLUSIVE LOCK of the database before calling this function.
1126
+
** You should call AGMDB_getKeyNum() before to get the number of keys, then assign proper space for keys and values. Although, you can just assign a large enough space for these two arrays.
1127
+
** @param dbm: the database you want to read.
1128
+
** @param array_size: the maximum size of key array and value array
1129
+
** @param keys: the array to store pointers of keys.
1130
+
** @param values: the array to store pointers of values.
1131
+
** @param vals_len: the array to store length of values.
** Get the const pointers of all keys and values in a database.
216
+
** You have to get SHARED or EXCLUSIVE LOCK of the database before calling this function.
217
+
** You should call AGMDB_getKeyNum() before to get the number of keys, then assign proper space for keys and values. Although, you can just assign a large enough space for these two arrays.
218
+
** @param dbm: the database you want to read.
219
+
** @param array_size: the maximum size of key array and value array
220
+
** @param keys: the array to store pointers of keys.
221
+
** @param values: the array to store pointers of values.
222
+
** @param vals_len: the array to store length of values.