-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkvdb.h
63 lines (49 loc) · 1.3 KB
/
kvdb.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* Tony Givargis
* Copyright (C), 2023
* University of California, Irvine
*
* CS 238P - Operating Systems
* kvdb.h
*/
#ifndef _KVDB_H_
#define _KVDB_H_
#include "system.h"
#define KVDB_MAX_KEY_LEN 0xffff
#define KVDB_MAX_VAL_LEN 0xffffffff
struct kvdb;
struct kvdb *kvdb_open(const char *pathname);
void kvdb_close(struct kvdb *kvdb);
int /* -1|0|+1 */
kvdb_remove(struct kvdb *kvdb,
const void *key,
uint64_t key_len,
void *val,
uint64_t *val_len); /* in/out */
int /* -1|0|+1 */
kvdb_insert(struct kvdb *kvdb,
const void *key,
uint64_t key_len,
const void *val,
uint64_t val_len);
int /* -1|0|+1 */
kvdb_update(struct kvdb *kvdb,
const void *key,
uint64_t key_len,
const void *val,
uint64_t val_len);
int /* -1|0|+1 */
kvdb_replace(struct kvdb *kvdb,
const void *key,
uint64_t key_len,
const void *val,
uint64_t val_len);
int /* -1|0|+1 */
kvdb_lookup(struct kvdb *kvdb,
const void *key,
uint64_t key_len,
void *val,
uint64_t *val_len); /* in/out */
uint64_t kvdb_size(const struct kvdb *kvdb);
uint64_t kvdb_waste(const struct kvdb *kvdb);
#endif /* _KVDB_H_ */