-
Notifications
You must be signed in to change notification settings - Fork 0
/
util_c++.h
48 lines (40 loc) · 1.34 KB
/
util_c++.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef __UTIL_C___H_
#define __UTIL_C___H_
#include <dirent.h>
#include <unistd.h>
// #include "lrucache.h"
#include "server.h"
#include "util.h"
#ifdef __cplusplus
extern "C" {
#endif
void *LRUCacheCreate();
void LRUCacheDestroy(void *mlru);
int LRUCacheInsert(void *mlru, char *_key, struct hashEntry *_val);
struct hashEntry *LRUCacheGet(void *mlru, char *_key);
struct hashEntry *LRUCacheEvict(void *mlru);
void LRUCacheErase(void *mlru, char *_key);
void *QueueCreate();
void QueueDestroy(void *q);
void QueueEnqueue(void *mq, struct hashEntry *_val);
struct hashEntry *QueueDequeue(void *mq);
int QueueSize(void *mq);
void *ListCreate();
void ListPushFront(void *mq, struct hashEntry *_val);
void ListPushBack(void *mq, struct hashEntry *_val);
struct hashEntry *ListPopFront(void *mq);
struct hashEntry *ListPopBack(void *mq);
int ListSize(void *mq);
// FlashCache
void *flashCacheCreate(const char *_path, struct kvDb *db,
const uint64_t max_size, const uint32_t max_file_size);
void flashCacheDestroy(void *fc);
int flashCacheInsert(void *fc, const char *_key, const char *data,
const size_t size);
char *flashCacheLookup(void *fc, const char *_key, size_t *size);
int flashCacheErase(void *fc, const char *_key);
void flashCacheMetakeyDelete(void *fc, const char *_key);
#ifdef __cplusplus
}
#endif
#endif