Documentation
¶
Overview ¶
Package wal provides Write-Ahead Log appending and replay mechanisms for crash safety.
Every mutating transaction (Upsert or Delete) is atomically appended as an in-band CRC32-verified frame:
Upsert Frame Layout:
- Opcode: [1 byte] (0x01 = OpUpsert)
- Codec Payload: [Domain + RRSets binary frame]
- Checksum: [4 bytes uint32 CRC32-IEEE over Opcode + Codec Payload]
Delete Frame Layout:
- Opcode: [1 byte] (0x02 = OpDelete)
- Domain Length: [2 bytes uint16]
- Domain Name: [ASCII/UTF-8 bytes]
- Checksum: [4 bytes uint32 CRC32-IEEE over Opcode + Length + Domain Name]
Strict boundary validations are enforced to prevent corrupted stream replay and torn writes.
Index ¶
Constants ¶
View Source
const ( // OpUpsert identifies an insert or update transaction frame in the log. OpUpsert = byte(0x01) // OpDelete identifies a removal transaction frame in the log. OpDelete = byte(0x02) )
Variables ¶
View Source
var ( // ErrCorruptedData indicates that stream bytes violate binary safety limits or checksum verification. ErrCorruptedData = errors.New("wal: corrupted stream data violates binary safety limits") // ErrCapacityExceeded indicates that a domain name or record count exceeds RFC 1035 safety bounds. ErrCapacityExceeded = errors.New("wal: element size or count exceeds binary safety limits") // ErrInvalidOpcode indicates that an unrecognized transaction operation byte was encountered. ErrInvalidOpcode = errors.New("wal: unknown operation code") // ErrTruncated indicates that the WAL file ends with an incomplete or truncated frame. ErrTruncated = errors.New("wal: truncated tail frame") )
Functions ¶
Types ¶
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer manages appending serialized mutation operations to the write-ahead log.
func (*Writer) AppendDelete ¶
AppendDelete serializes and appends a delete operation frame to the log in a single atomic buffer write.
func (*Writer) AppendUpsert ¶
AppendUpsert serializes and appends an upsert operation frame to the log.
Click to show internal directories.
Click to hide internal directories.