Skip to content
/ walrus Public

Walrus is a high-performance and reliable Write-Ahead Log (WAL) implementation written in Go. It's designed for data integrity and reliable recovery operations.

License

Notifications You must be signed in to change notification settings

l00pss/walrus

Repository files navigation

Walrus - Write-Ahead Log (WAL) Implementation


LittleCache Logo

Go Version License Go Report Card GitHub Stars

Buy Me A Coffee

Walrus is a high-performance and reliable Write-Ahead Log (WAL) implementation written in Go. It's designed for data integrity and reliable recovery operations.

Features

  • Data Safety: CRC32 checksum for each entry
  • Segment-Based: Automatic segment rotation and cleanup
  • Multi-Format: Binary and JSON encoding support
  • Crash Recovery: Automatic recovery after system crashes
  • Thread-Safe: Safe for concurrent access

Installation

go get github.com/l00pss/walrus

Quick Start

package main

import (
    "log"
    "time"
    "github.com/l00pss/walrus"
)

func main() {
    config := walrus.DefaultConfig()
    
    wal := walrus.NewWAL("./wal_data", config).Unwrap()
    defer wal.Close()
    
    entry := walrus.Entry{
        Data:      []byte("Hello World!"),
        Term:      1,
        Timestamp: time.Now(),
    }
    
    index := wal.Append(entry).Unwrap()
    log.Printf("Entry written at index: %d", index)
    
    readEntry := wal.Get(index).Unwrap()
    log.Printf("Read data: %s", readEntry.Data)
}

API

Entry

type Entry struct {
    Index     uint64
    Term      uint64
    Data      []byte
    Checksum  uint32
    Timestamp time.Time
}

License

MIT

About

Walrus is a high-performance and reliable Write-Ahead Log (WAL) implementation written in Go. It's designed for data integrity and reliable recovery operations.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages