X-Git-Url: https://pd.if.org/git/?p=nbds;a=blobdiff_plain;f=include%2Fmap.h;h=44b9d27ea979570be69760a4cc7afb6d368f6a4c;hp=d670c35d17d877191fadd55938e8c87974c00575;hb=8143ca0acc36e19d004431952e3b6f9b3d337f49;hpb=5ae34506293996af2af43b1da4f1130dd711ccbe diff --git a/include/map.h b/include/map.h index d670c35..44b9d27 100644 --- a/include/map.h +++ b/include/map.h @@ -2,19 +2,22 @@ #define MAP_H typedef struct map map_t; -typedef enum stat { MAP_STAT_COUNT } map_stat_e; -typedef enum { MAP_TYPE_HASHTABLE, MAP_TYPE_SKIPLIST, MAP_TYPE_LIST } map_type_e; -map_t * map_alloc (map_type_e map_type); -void map_free (map_t *map); -void map_print (map_t *map); -uint64_t map_stat (map_t *map, map_stat_e stat_type); +typedef const struct map_impl *map_type_t; + +extern map_type_t MAP_TYPE_HASHTABLE; +extern map_type_t MAP_TYPE_SKIPLIST; +extern map_type_t MAP_TYPE_LIST; +map_t * map_alloc (map_type_t map_type); uint64_t map_get (map_t *map, const void *key_data, uint32_t key_len); uint64_t map_set (map_t *map, const void *key_data, uint32_t key_len, uint64_t new_val); uint64_t map_add (map_t *map, const void *key_data, uint32_t key_len, uint64_t new_val); uint64_t map_cas (map_t *map, const void *key_data, uint32_t key_len, uint64_t expected_val, uint64_t new_val); uint64_t map_replace(map_t *map, const void *key_data, uint32_t key_len, uint64_t new_val); uint64_t map_remove (map_t *map, const void *key_data, uint32_t key_len); +uint64_t map_count (map_t *map); +void map_print (map_t *map); +void map_free (map_t *map); #endif//MAP_H