Skip to content

casteloig/walrog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Walrog

Build Go Report Card Go Version License: MIT

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.

About

Go library that implements a simple Write-Ahead Logging system.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages