Skip to content

Most advanced key-value store written in Go, extremely fast, compatible with LSM tree and B+ tree, optimization of badger and bbolt.

License

Notifications You must be signed in to change notification settings

shaovie/lotusdb

 
 

Repository files navigation

What is LotusDB

LotusDB is the most advanced key-value store written in Go, extremely fast, compatible with LSM tree and B+ tree, and optimization of badger and bbolt.

Key features:

  • Combine the advantages of LSM and B+ tree
  • Fast read/write performance
  • Much lower read and space amplification than typical LSM

Design Overview

Getting Started

package main

import "github.com/lotusdblabs/lotusdb/v2"

func main() {
	// Set Options
	options := lotusdb.DefaultOptions
	options.DirPath = "/tmp/lotusdb_basic"

	// Open LotusDB
	db, err := lotusdb.Open(options)
	if err != nil {
		panic(err)
	}
	defer func() {
		_ = db.Close()
	}()

	// Put Key-Value
	key := []byte("KV store engine")
	value := []byte("LotusDB")
	putOptions := &lotusdb.WriteOptions{
		Sync:       true,
		DisableWal: false,
	}
	err = db.Put(key, value, putOptions)
	if err != nil {
		panic(err)
	}

	// Get Key-Value
	value, err = db.Get(key)
	if err != nil {
		panic(err)
	}
	println(string(value))

	// Delete Key-Value
	err = db.Delete(key, putOptions)
	if err != nil {
		panic(err)
	}

	// Start Compaction of Value Log
	err = db.Compact()
	if err != nil {
		panic(err)
	}
}

Community

Welcome to join the Slack channel and Discussions to connect with LotusDB team members and other users.

If you are a Chinese user, you are also welcome to join our WeChat group, scan the QR code and you will be invited:

About

Most advanced key-value store written in Go, extremely fast, compatible with LSM tree and B+ tree, optimization of badger and bbolt.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.8%
  • Shell 0.2%