forked from lotusdblabs/lotusdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.go
74 lines (52 loc) · 1.07 KB
/
db.go
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
64
65
66
67
68
69
70
71
72
73
74
package lotusdb
type DB struct {
// Active memtable for writing.
activeMem *memtable
// Immutable memtables, waiting to be flushed to disk.
immuMems []*memtable
// vlog is the value log.
vlog *valueLog
}
type Stat struct {
}
func Open(options Options) (*DB, error) {
// check whether all options are valid
// create the directory if not exist
// acquire file lock
// open all memtables
// open index
// open value log
return nil, nil
}
func (db *DB) Close() error {
// close all memtables
// close index
// close value log
// release file lock
return nil
}
func (db *DB) Sync() error {
// sync all wal of memtables
// sync index
// sync value log
return nil
}
func (db *DB) Stat() *Stat {
return nil
}
func (db *DB) Put(key []byte, value []byte) error {
// call batch put
return nil
}
func (db *DB) Get(key []byte, value []byte) ([]byte, error) {
// call batch get
return nil, nil
}
func (db *DB) Delete(key []byte) error {
// call batch delete
return nil
}
func (db *DB) Exist(key []byte) (bool, error) {
// call batch exist
return false, nil
}