Skip to content

B1NARY-GR0UP/originium

Repository files navigation

ORIGINIUM

LSM-Tree based storage engine used by FOIVER system.

Install

go get -u github.com/B1NARY-GR0UP/originium

Usage

Opening a Database

package main

import (
    "log"

    "github.com/B1NARY-GR0UP/originium"
)

func main() {
    // Use originium.Config to customize your db behavior
    db, err := originium.Open("your-dir", originium.DefaultConfig)
    if err != nil {
        log.Fatal(err)
    }

    defer db.Close()

    // ...
}

Transactions

ORIGINIUM supports concurrent ACID transactions with Serializable Snapshot Isolation (SSI) guarantees.

  • Read-only transaction
err := db.View(func(txn *originium.Txn) error {
    // ...

    res, ok := txn.Get("hello")
    if !ok {
        // key not found
    }

    // ...
    return nil
})
  • Read-write transaction
err := db.Update(func(txn *originium.Txn) error {
    // ...

    if err := txn.Set("hello", []byte("originium")); err != nil {
        return err
    }

    // ...
    return nil
})
  • Manually
// start a read-write transaction manually
txn := db.Begin(true)
defer txn.Discard()

// ...

if err := txn.Delete("hello"); err != nil {
    return err
}

// ...

if err := txn.Commit(); err != nil {
    return err
}

Blogs

Credits

Sincere appreciation to the following repositories that made the development of ORIGINIUM possible.

License

ORIGINIUM is distributed under the Apache License 2.0. The licenses of third party dependencies of ORIGINIUM are explained here.

ECOLOGY

PROJECT: FOIVER

ORIGINIUM is Part of PROJECT: FOIVER

About

LSM-Tree based storage engine used by FOIVER system.

Topics

Resources

License

Stars

Watchers

Forks

Languages