Documentation ¶
Index ¶
- Constants
- Variables
- type WriteAheadLog
- func (l *WriteAheadLog) Close() error
- func (l *WriteAheadLog) Count() int
- func (l *WriteAheadLog) FirstIndex() int64
- func (l *WriteAheadLog) LastIndex() int64
- func (l *WriteAheadLog) Path() string
- func (l *WriteAheadLog) Read(index int64) (string, []byte, error)
- func (l *WriteAheadLog) Scan(iter func(index int64, key string, value []byte) bool) error
- func (l *WriteAheadLog) String() string
- func (l *WriteAheadLog) TruncateFront(index int64) error
- func (l *WriteAheadLog) Write(key string, value []byte) (int64, error)
Constants ¶
View Source
const ( LogPrefix = "wal-" LogSuffix = ".seg" )
Variables ¶
View Source
var ( ErrOutOfBounds = errors.New("error: out of bounds") ErrSegmentFull = errors.New("error: segment is full") ErrFileClosed = errors.New("error: file closed") ErrBadArgument = errors.New("error: bad argument") ErrNoPathProvided = errors.New("error: no path provided") ErrOptionsMissing = errors.New("error: options missing") )
Functions ¶
This section is empty.
Types ¶
type WriteAheadLog ¶
type WriteAheadLog struct {
// contains filtered or unexported fields
}
WriteAheadLog is a write-ahead log structure
func Open ¶
func Open(path string) (*WriteAheadLog, error)
Open opens and returns a new write-ahead log structure
func (*WriteAheadLog) Close ¶
func (l *WriteAheadLog) Close() error
Close syncs and closes the write-ahead log
func (*WriteAheadLog) Count ¶
func (l *WriteAheadLog) Count() int
Count returns the number of entries currently in the write-ahead log
func (*WriteAheadLog) FirstIndex ¶
func (l *WriteAheadLog) FirstIndex() int64
FirstIndex returns the write-ahead logs first index
func (*WriteAheadLog) LastIndex ¶
func (l *WriteAheadLog) LastIndex() int64
LastIndex returns the write-ahead logs first index
func (*WriteAheadLog) Path ¶
func (l *WriteAheadLog) Path() string
func (*WriteAheadLog) Read ¶
func (l *WriteAheadLog) Read(index int64) (string, []byte, error)
Read reads an entry from the write-ahead log at the specified index
func (*WriteAheadLog) String ¶
func (l *WriteAheadLog) String() string
String is the stringer method for the write-ahead log
func (*WriteAheadLog) TruncateFront ¶
func (l *WriteAheadLog) TruncateFront(index int64) error
TruncateFront removes all segments and entries before specified index
Click to show internal directories.
Click to hide internal directories.