hashindex.h 794 B

123456789101112131415161718192021222324252627
  1. #ifndef __HASHINDEX_H__
  2. #define __HASHINDEX_H__
  3. typedef struct {
  4. char *path;
  5. void *map_addr;
  6. off_t map_length;
  7. void *buckets;
  8. int num_entries;
  9. int num_buckets;
  10. int key_size;
  11. int value_size;
  12. int bucket_size;
  13. int limit;
  14. } HashIndex;
  15. HashIndex *hashindex_open(const char *path);
  16. void hashindex_close(HashIndex *index);
  17. void hashindex_flush(HashIndex *index);
  18. HashIndex *hashindex_create(const char *path, int capacity, int key_size, int value_size);
  19. const void *hashindex_get(HashIndex *index, const void *key);
  20. void hashindex_set(HashIndex *index, const void *key, const void *value);
  21. void hashindex_delete(HashIndex *index, const void *key);
  22. void *hashindex_next_key(HashIndex *index, const void *key);
  23. int hashindex_get_size(HashIndex *index);
  24. #endif