wal_null.go
wal_null.go - Overview
This file defines a null implementation of the WAL (Write-Ahead Logging) interface. It essentially provides a no-op WAL, which discards all log entries.
Detailed Documentation
WALNull
type WALNull struct {
}
- Purpose: Represents a null WAL implementation that does nothing.
NewNullWAL
func NewNullWAL() (*WALNull, error) {
return &WALNull{}, nil
}
- Purpose: Creates a new instance of
WALNull
. - Returns:
*WALNull
: A pointer to a newWALNull
instance.error
: Always returnsnil
.
Init
func (w *WALNull) Init(t time.Time) error {
return nil
}
- Purpose: Implements the
Init
method forWALNull
. It's a no-op and always returnsnil
. - Parameters:
t
(time.Time): Time parameter (not used).
- Returns:
error
: Always returnsnil
.
LogCommand
func (w *WALNull) LogCommand(b []byte) error {
return nil
}
- Purpose: Implements the
LogCommand
method forWALNull
. It discards the input and always returnsnil
. - Parameters:
b
([]byte): The byte slice to log (not used).
- Returns:
error
: Always returnsnil
.
Close
func (w *WALNull) Close() error {
return nil
}
- Purpose: Implements the
Close
method forWALNull
. It's a no-op and always returnsnil
. - Returns:
error
: Always returnsnil
.
ForEachCommand
func (w *WALNull) ForEachCommand(entry *WALEntry, callback func(*WALEntry) error) error {
return nil
}
- Purpose: Implements the
ForEachCommand
method forWALNull
. It's a no-op and always returnsnil
. - Parameters:
entry
(*WALEntry): WAL entry (not used).callback
(func(*WALEntry) error): Callback function (not used).
- Returns:
error
: Always returnsnil
.
Replay
func (w *WALNull) Replay(callback func(*WALEntry) error) error {
return nil
}
- Purpose: Implements the
Replay
method forWALNull
. It's a no-op and always returnsnil
. - Parameters:
callback
(func(*WALEntry) error): Callback function (not used).
- Returns:
error
: Always returnsnil
.