Documentation ¶
Overview ¶
Package wal implements write-ahead-log.
Index ¶
Constants ¶
View Source
const ( IEEE = 0xedb88320 EntryHeaderSize = 28 SegmentPrefix = "segment" )
Variables ¶
This section is empty.
Functions ¶
func NewWALStores ¶
func NewWALStores(vertexInstance *dfv1.VertexInstance, opts ...Option) store.StoreProvider
Types ¶
type Option ¶
type Option func(stores *walStores)
func WithMaxBufferSize ¶
WithMaxBufferSize sets the WAL buffer max size option
func WithSyncDuration ¶
WithSyncDuration sets the WAL sync duration option
type WAL ¶
type WAL struct {
// contains filtered or unexported fields
}
WAL implements a write-ahead-log. It represents both reader and writer. This WAL is write heavy and read is infrequent, meaning a read will only happen during a boot up. WAL will only have one segment since these are relatively short-lived.
func (*WAL) IsCorrupted ¶
IsCorrupted checks whether the file is corrupt
func (*WAL) Write ¶
func (w *WAL) Write(message *isb.ReadMessage) (err error)
Write writes the message to the WAL. The format as follow is
+-------------------+----------------+-----------------+--------------+----------------+ | watermark (int64) | offset (int64) | msg-len (int64) | CRC (unit32) | message []byte | +-------------------+----------------+-----------------+--------------+----------------+
CRC will be used for detecting ReadMessage corruptions.
Click to show internal directories.
Click to hide internal directories.