Skip to content

zuzmo/bmdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

What is BMDB?

English | 简体中文

BMDB is a simple, fast, embeddable and persistent key/value store written in pure Go.

It supports fully serializable transactions and many data structures such as list、set、sorted set. All operations happen inside a Tx. Tx represents a transaction, which can be read-only or read-write. Read-only transactions can read values for a given bucket and a given key or iterate over a set of key-value pairs. Read-write transactions can read, update and delete keys from the DB.

We can learn more about BMDB in details on the documents site of BMDB: BMDB Documents

Announcement

📢 Note: Starting from v0.9.0, defaultSegmentSize in DefaultOptions has been adjusted from 8MB to 256MB. The original value is the default value, which needs to be manually changed to 8MB, otherwise the original data will not be parsed. The reason for the size adjustment here is that there is a cache for file descriptors starting from v0.9.0 (detail see https://github.com/bmdb/bmdb/pull/164 ), so users need to look at the number of fds they use on the server, which can be set manually. If you have any questions, you can open an issue.

After bmdb v1.0.0, due to changes in the underlying data storage protocol, the data of the old version is not compatible. Please rewrite it before using the new version. And the current Bucket needs to be created manually. Please see the Bucket usage documentation for details.

Architecture

bmdb-架构图

Welcome contributions to BMDB.

Quick start

Install BMDB

To start using BMDB, first needs Go installed (version 1.18+ is required). and run go get:

go get -u github.com/bmdb/bmdb

Opening a database

To open your database, use the bmdb.Open() function,with the appropriate options.The Dir , EntryIdxMode and SegmentSize options are must be specified by the client. About options see here for detail.

package main

import (
    "log"

    "github.com/bmdb/bmdb"
)

func main() {
    // Open the database located in the /tmp/bmdb directory.
    // It will be created if it doesn't exist.
    db, err := bmdb.Open(
        bmdb.DefaultOptions,
        bmdb.WithDir("/tmp/bmdb"),
    )
    if err != nil {
        log.Fatal(err)
    }
    defer db.Close()

    ...
}

Documentation

Buckets
Pairs
Iterator
Data Structures
Database Options
CRDT multiprocess testing
  • The repository includes an optional CRDT multiprocess integration harness that appends compact CRDT ops to an on-disk op.log and replays them on DB open.

  • To enable verbose CRDT debug logging set the Options field CRDTDebugLogs to true when opening the DB. Example:

opt := bmdb.DefaultOptions
opt.EnableCRDT = true
opt.CRDTPreserve = false // (optional) keep on-disk artifacts for debugging
opt.CRDTDebugLogs = true
db, err := bmdb.Open(opt)
  • The project provides an external integration script that spawns helper processes and validates the op.log. From the repository root run:
bash scripts/run_crdt_integration.sh
  • There is also an opt-in go test that runs the OS-process based integration. Set the environment variable RUN_CRDT_OS=1 before running go test to exercise the subprocess path.
More Operation
Comparison
Benchmark

Contributors

Thank you for considering contributing to BMDB! The contribution guide can be found in the CONTRIBUTING for details on submitting patches and the contribution workflow.

Acknowledgements

This package is inspired by the following:

License

The BMDB is open-sourced software licensed under the Apache 2.0 license.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors