gaeadb

package module
v0.0.0-...-d427792 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: GPL-3.0 Imports: 0 Imported by: 0

README

gaeadb

gaeadb is a pure Go Database engine designed by nnsgmsone. The goal of the project is to provide a database engine for table or other complex data structures.

Table of Contents

Getting Started

Opening a database

The top-level object in gaeadb is a DB. It represents multiple files on disk in specific directories, which contain the data for a single database.

package main

import (
	"log"

	"gaeadb/db"
)

func main() {
  // Open the gaeadb database located in the /tmp/gaea.db directory.
  // It will be created if it doesn't exist.
  cfg := db.DefaultConfig()
  cfg.DirName = "/tmp/gaea.db"
  db, err := db.Open(cfg)
  if err != nil {
	  log.Fatal(err)
  }
  defer db.Close()
  // Your code here…
}
DB interface
type DB interface {
	Close() error

	Del([]byte) error
	Set([]byte, []byte) error
	Get([]byte) ([]byte, error)

	NewTransaction(readOnly bool) (Transaction, error)
}
Transaction interface
type Transaction interface {
	Commit() error
	Rollback() error
	Del([]byte) error
	Set([]byte, []byte) error
	Get([]byte) ([]byte, error)
	NewForwardIterator([]byte) (Iterator, error)
	NewBackwardIterator([]byte) (Iterator, error)
}

type Iterator interface {
	Close() error
	Next() error
	Valid() bool
	Key() []byte // can use outside
	Value() ([]byte, error) // can use outside
}

Benchmarks

I have run comprehensive benchmarks against Bolt and Badger, The benchmarking code, and the detailed logs for the benchmarks can be found in the gaeadbBench repo.

Caveats & Limitations

Caveats

sync is always on and not allowed to close

Limitations

The maximum value of key is 4074 and the maximum value of value is 64k.

Documentation

Overview

Package gaeadb implements a Database engine in pure Go. It supports Repeatable reads transactions, ACID semantics, and MVCC(Serializable Snapshot Isolation) with multiple readers and multiple writer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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