walrog

module
v0.0.0-...-509ba17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2025 License: MIT

README ยถ

Walrog

Build Go Report Card Go Version

Walrog is a Go library that implements a simple yet functional Write-Ahead Logging (WAL) system. It was designed as a personal project to understand and demonstrate the fundamentals of WAL, offering reliable data persistence and crash recovery mechanisms.

Walrog Logo

โœจ Features

  • Sequential logging with LSN, length, and CRC validation.
  • Buffered writes to disk with automatic WAL file rotation.
  • Recovery of valid records from existing WAL files.
  • Configurable segmentation and initial checkpoint system.
  • CRC-based data integrity checks.
  • Unit tests covering the main functional use cases.

๐Ÿš€ Basic Usage

Installation

Clone the repository:

git clone https://github.com/casteloig/walrog.git
cd walrog

Make sure you have Go 1.18 or higher installed.

Example
package main

import (
	"fmt"
	"github.com/casteloig/walrog/internal/core"
)

func main() {
	// Initialize with default options
	wal, err := core.InitWal(nil)
	if err != nil {
		panic(err)
	}

	// Write a message
	err = wal.WriteBuffer([]byte("Hello World!"))
	if err != nil {
		panic(err)
	}

	// Flush to disk
	err = wal.FlushBuffer()
	if err != nil {
		panic(err)
	}

	fmt.Println("Entry successfully written.")
}

๐Ÿ“„ License

MIT License. See the LICENSE file for more details.

Directories ยถ

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL