Documentation
¶
Index ¶
- func ReplayDir(dir string, logger common.Logger, ...) error
- type Config
- type WAL
- func (w *WAL) Close() error
- func (w *WAL) CurrentSeq() uint64
- func (w *WAL) DeleteOldFiles(beforeSeq uint64) error
- func (w *WAL) Flush() error
- func (w *WAL) Replay(callback func(op uint8, key []byte, expiresAt time.Time) error) error
- func (w *WAL) Rotate() error
- func (w *WAL) Sync() error
- func (w *WAL) Write(op uint8, key []byte) error
- func (w *WAL) WriteBatch(entries []*WALEntry) error
- func (w *WAL) WriteWithTTL(op uint8, key []byte, ttl time.Duration) error
- type WALEntry
- type WALHeader
- type WALRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReplayDir ¶ added in v1.1.0
func ReplayDir(dir string, logger common.Logger, callback func(op uint8, key []byte, expiresAt time.Time) error) error
ReplayDir replays WAL files from a directory in read-only fashion. It does not create, rotate, modify, or quarantine files. Best-effort: on corruption, it logs and continues.
Types ¶
type Config ¶
type Config struct {
RotateSize int64
MaxFileSize int64
BufferSize int
// Durability policy
SyncOnEveryWrite bool
FlushOnEveryWrite bool
FlushEveryBytes int
}
Config controls WAL sizing and buffering.
type WAL ¶
type WAL struct {
// contains filtered or unexported fields
}
WAL represents a Write-Ahead Log for durability.
func NewWithConfig ¶
NewWithConfig creates a new WAL instance with custom configuration.
func (*WAL) CurrentSeq ¶
CurrentSeq returns the current WAL sequence number.
func (*WAL) DeleteOldFiles ¶
DeleteOldFiles deletes WAL files older than the specified sequence.
func (*WAL) WriteBatch ¶ added in v1.1.0
WriteBatch writes a batch of operations to the WAL. This is more efficient than multiple individual writes as it minimizes lock contention and disk I/O.
Click to show internal directories.
Click to hide internal directories.