-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathwal.go
58 lines (47 loc) · 1.05 KB
/
wal.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
package tstorage
import (
"os"
"sync"
)
type walOperation byte
const (
// The record format for operateInsert is as shown below:
/*
+--------+---------------------+--------+--------------------+----------------+
| op(1b) | len metric(varints) | metric | timestamp(varints) | value(varints) |
+--------+---------------------+--------+--------------------+----------------+
*/
operationInsert walOperation = iota
)
// wal represents a write-ahead log, which offers durability guarantees.
type wal interface {
append(op walOperation, rows []Row) error
flush() error
punctuate() error
removeOldest() error
removeAll() error
refresh() error
}
type nopWAL struct {
filename string
f *os.File
mu sync.Mutex
}
func (f *nopWAL) append(_ walOperation, _ []Row) error {
return nil
}
func (f *nopWAL) flush() error {
return nil
}
func (f *nopWAL) punctuate() error {
return nil
}
func (f *nopWAL) removeOldest() error {
return nil
}
func (f *nopWAL) removeAll() error {
return nil
}
func (f *nopWAL) refresh() error {
return nil
}