X-Git-Url: https://pd.if.org/git/?p=nbds;a=blobdiff_plain;f=include%2Fmap.h;fp=include%2Fmap.h;h=d670c35d17d877191fadd55938e8c87974c00575;hp=0000000000000000000000000000000000000000;hb=025017478bb385da88a6b185849c8bcffeb2e2aa;hpb=2d93f3b29622488bde80b6cd18661fd7eb603eee diff --git a/include/map.h b/include/map.h new file mode 100644 index 0000000..d670c35 --- /dev/null +++ b/include/map.h @@ -0,0 +1,20 @@ +#ifndef MAP_H +#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); + +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); + +#endif//MAP_H