Awesome Go

rosedb

CategoryDatabase
SubcategoryDatabases Implemented in Go
Stars0

An embedded k-v database based on LSM+WAL, supports string, list, hash, set, zset

About rosedb

English · 简体中文

What is ROSEDB

rosedb is a lightweight, fast and reliable key/value storage engine based on Bitcask storage model.

The design of Bitcask was inspired, in part, by log-structured filesystems and log file merging.

Status

rosedb is well tested and ready for production use. There are serveral projects using rosedb in production as a storage engine.

Didn't find the feature you want? Feel free to open an issue or PR, we are in active development.

Design overview

RoseDB log files are using the WAL(Write Ahead Log) as backend, which are append-only files with multiple blocks.

wal: https://github.com/rosedblabs/wal

Key features

Strengths

Weaknesses

Gettings Started

Basic operations

package main

import "github.com/rosedblabs/rosedb/v2"

func main() {
	// specify the options
	options := rosedb.DefaultOptions
	options.DirPath = "/tmp/rosedb_basic"

	// open a database
	db, err := rosedb.Open(options)
	if err != nil {
		panic(err)
	}
	defer func() {
		_ = db.Close()
	}()

	// set a key
	err = db.Put([]byte("name"), []byte("rosedb"))
	if err != nil {
		panic(err)
	}

	// get a key
	val, err := db.Get([]byte("name"))
	if err != nil {
		panic(err)
	}
	println(string(val))

	// delete a key
	err = db.Delete([]byte("name"))
	if err != nil {
		panic(err)
	}
}

Batch operations

	// create a batch
	batch := db.NewBatch(rosedb.DefaultBatchOptions)

	// set a key
	_ = batch.Put([]byte("name"), []byte("rosedb"))

	// get a key
	val, _ := batch.Get([]byte("name"))
	println(string(val))

	// delete a key
	_ = batch.Delete([]byte("name"))

	// commit the batch
	_ = batch.Commit()

see the examples for more details.

Community

Welcome to join the Slack channel and Discussions to connect with RoseDB team developers and other users.

Contributors

Frequently Asked Questions

What is rosedb?

rosedb is a Database library for the Go programming language. An embedded k-v database based on LSM+WAL, supports string, list, hash, set, zset

How do I install rosedb?

Install rosedb with the Go module system using `go get roseduan/rosedb`. Check the repository for the current installation instructions.

What category does rosedb belong to?

rosedb is listed under Database, specifically Databases Implemented in Go.

← Back to Databases Implemented in Go