dmacvicar / naifdb

Implementing a Bitcask like store for educational purposes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

naifdb: naive Key/Value store

This is a simple key value store following the basic ideas described in Designing Data-Intensive Applications and articles I read.

This is an educational project, and has no other purpose. It will evolve it to use other techniques as I learn more about the theory.

Design

The starting design is the one used by Bitcask (default storage engine in Riak) (paper). Check the original design for trade-offs.

Caveats & Not yet implemented

  • CRC is not used
  • Locking of the directory
  • It creates a new append file in each startup, no matter if the previous closed RO file is small. Hopefully compaction will take care of that

Requirements

  • go 1.15 or later is required

Usage

store, err := NewStore()
defer store.Close()
err = store.Set([]byte("Key1"), []byte("Value 1"))
if err != nil {
    log.Println(err)
}

Get a value:

value, err := store.Get([]byte("Key1"))
if err != nil {
    log.Println(err)
}

Author

  • Duncan Mac-Vicar P.

License

  • MIT

About

Implementing a Bitcask like store for educational purposes


Languages

Language:Go 100.0%