forked from gatechain/gate-zk-smt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.go
More file actions
39 lines (32 loc) · 945 Bytes
/
database.go
File metadata and controls
39 lines (32 loc) · 945 Bytes
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
package database
type (
KeyValueReader interface {
// Has retrieves if a key is present in the key-value data store.
Has(key []byte) (bool, error)
// Get retrieves the given key if it's present in the key-value data store.
Get(key []byte) ([]byte, error)
}
KeyValueWriter interface {
// Set inserts the given value into the key-value data store.
Set(key []byte, value []byte) error
// Delete removes the key from the key-value data store.
Delete(key []byte) error
}
TreeDB interface {
KeyValueReader
KeyValueWriter
// NewBatch creates a write-only database that buffers changes to its host db
// until a final write is called.
NewBatch() Batcher
Close() error
}
Batcher interface {
KeyValueWriter
// Write flushes any accumulated data to disk.
Write() error
// Reset resets the batch for reuse.
Reset()
// ValueSize retrieves the amount of data queued up for writing.
ValueSize() int
}
)