Skip to main content

wal.pb.go

Overview

This file defines the structure of a Write-Ahead Log (WAL) entry using Protocol Buffers. It specifies the data fields included in each WAL entry for persistence and recovery purposes.

Detailed Documentation

WALEntry

type WALEntry struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields

Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Version of the WAL entry (e.g., "v1.0")
LogSequenceNumber uint64 `protobuf:"varint,2,opt,name=log_sequence_number,json=logSequenceNumber,proto3" json:"log_sequence_number,omitempty"` // Log Sequence Number (LSN)
Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` // The actual data being logged
Crc32 uint32 `protobuf:"varint,4,opt,name=crc32,proto3" json:"crc32,omitempty"` // Cyclic Redundancy Check for integrity
Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // Timestamp for the WAL entry (epoch time in nanoseconds)
}
  • Purpose: Represents a single entry in the Write-Ahead Log. It contains metadata and the actual data being logged.
  • Fields:
    • Version: string - Version of the WAL entry.
    • LogSequenceNumber: uint64 - Log Sequence Number (LSN) for ordering.
    • Data: []byte - The actual data being logged.
    • Crc32: uint32 - Cyclic Redundancy Check for data integrity.
    • Timestamp: int64 - Timestamp for the WAL entry (epoch time in nanoseconds).

Reset

func (x *WALEntry) Reset()
  • Purpose: Resets the WALEntry to its default state.
  • Parameters:
    • None
  • Returns: None

String

func (x *WALEntry) String() string
  • Purpose: Returns the string representation of the WALEntry.
  • Parameters:
    • None
  • Returns: string

ProtoMessage

func (*WALEntry) ProtoMessage()
  • Purpose: It's a method required to satisfy the proto.Message interface. Has no functionality.
  • Parameters:
    • None
  • Returns: None

ProtoReflect

func (x *WALEntry) ProtoReflect() protoreflect.Message
  • Purpose: Provides reflection capabilities for the WALEntry type.
  • Parameters:
    • None
  • Returns: protoreflect.Message

Descriptor

func (*WALEntry) Descriptor() ([]byte, []int)
  • Purpose: Returns the file descriptor for the WALEntry type.
  • Parameters:
    • None
  • Returns: ([]byte, []int)

GetVersion

func (x *WALEntry) GetVersion() string
  • Purpose: Retrieves the Version of the WALEntry.
  • Parameters:
    • None
  • Returns: string - The version of the WALEntry.

GetLogSequenceNumber

func (x *WALEntry) GetLogSequenceNumber() uint64
  • Purpose: Retrieves the LogSequenceNumber of the WALEntry.
  • Parameters:
    • None
  • Returns: uint64 - The log sequence number.

GetData

func (x *WALEntry) GetData() []byte
  • Purpose: Retrieves the Data of the WALEntry.
  • Parameters:
    • None
  • Returns: []byte - The data of the WALEntry.

GetCrc32

func (x *WALEntry) GetCrc32() uint32
  • Purpose: Retrieves the Crc32 of the WALEntry.
  • Parameters:
    • None
  • Returns: uint32 - The CRC32 checksum.

GetTimestamp

func (x *WALEntry) GetTimestamp() int64
  • Purpose: Retrieves the Timestamp of the WALEntry.
  • Parameters:
    • None
  • Returns: int64 - The timestamp of the WALEntry.

Code Examples

None.

Getting Started Relevance