#define HASH_TAGS_PATH "hash_tags"
#define AUTHOR_TAGS_PATH "author_tags"
+#define RECORDS_PER_SEGMENT 65536
+#define MAX_RECORD_SIZE 65535 /* No greater than 65535 */
+
#endif //_CONFIG_H
#include "database.h"
#include "config.h"
-#define RECORDS_PER_SEGMENT 65536
-
uint64_t blerg_get_record_count(struct blerg *blerg) {
uint64_t count;
flock(blerg->meta_fd, LOCK_SH);
open_failed_data_mmap:
close(blerg->data_fd);
open_failed_data_open:
- munmap((void *)blerg->index, sizeof(65536 * sizeof(struct record)));
+ munmap((void *)blerg->index, sizeof(RECORDS_PER_SEGMENT * sizeof(struct record)));
open_failed_index_mmap:
close(blerg->index_fd);
open_failed_index_open:
}
int blerg_store(struct blerg *blerg, const char *data, int len) {
- if (len > 65536) {
+ if (len > MAX_RECORD_SIZE) {
printf("len > 64K\n");
return -1;
}
int blerg_close(struct blerg *);
int blerg_store(struct blerg *, const char *, int);
int blerg_fetch(struct blerg *, int, char **, int *);
+uint64_t blerg_get_record_count(struct blerg *);
#endif //_DATABASE_H