Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
Op OpType
Entity string // e.g. "processes", "executors"
Key string // primary key
Data []byte // JSON-encoded record (nil for deletes)
Timestamp int64 // unix nanoseconds
}
Entry represents a single WAL entry.
type FileWAL ¶
type FileWAL struct {
// contains filtered or unexported fields
}
FileWAL is a WAL implementation backed by a single file on disk.
func NewFileWAL ¶
NewFileWAL opens or creates a WAL file in the given directory.
type WAL ¶
type WAL interface {
// Append writes an entry to the log. Depending on the SyncMode, the
// entry may or may not be durable when Append returns.
Append(entry Entry) error
// Replay reads all entries from the log in order, calling fn for each.
// If fn returns an error, replay stops and the error is returned.
Replay(fn func(Entry) error) error
// Truncate removes all entries from the log. Called after a successful
// flush to disk.
Truncate() error
// Close flushes any buffered data and closes the log.
Close() error
}
WAL is the interface for write-ahead logging. Implementations must be safe for concurrent use by multiple goroutines.
Click to show internal directories.
Click to hide internal directories.