Skip to main content

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 new WALNull instance.
    • error: Always returns nil.

Init

func (w *WALNull) Init(t time.Time) error {
return nil
}
  • Purpose: Implements the Init method for WALNull. It's a no-op and always returns nil.
  • Parameters:
    • t (time.Time): Time parameter (not used).
  • Returns:
    • error: Always returns nil.

LogCommand

func (w *WALNull) LogCommand(b []byte) error {
return nil
}
  • Purpose: Implements the LogCommand method for WALNull. It discards the input and always returns nil.
  • Parameters:
    • b ([]byte): The byte slice to log (not used).
  • Returns:
    • error: Always returns nil.

Close

func (w *WALNull) Close() error {
return nil
}
  • Purpose: Implements the Close method for WALNull. It's a no-op and always returns nil.
  • Returns:
    • error: Always returns nil.

ForEachCommand

func (w *WALNull) ForEachCommand(entry *WALEntry, callback func(*WALEntry) error) error {
return nil
}
  • Purpose: Implements the ForEachCommand method for WALNull. It's a no-op and always returns nil.
  • Parameters:
    • entry (*WALEntry): WAL entry (not used).
    • callback (func(*WALEntry) error): Callback function (not used).
  • Returns:
    • error: Always returns nil.

Replay

func (w *WALNull) Replay(callback func(*WALEntry) error) error {
return nil
}
  • Purpose: Implements the Replay method for WALNull. It's a no-op and always returns nil.
  • Parameters:
    • callback (func(*WALEntry) error): Callback function (not used).
  • Returns:
    • error: Always returns nil.

Getting Started Relevance