lmdb-go

module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2015 License: BSD-3-Clause

README

#lmdb-go Build Status

Go bindings to the OpenLDAP Lightning Memory-Mapped Database (LMDB).

Key Features

###Zero-copy reads

Applications with high performance requirements can opt-in to fast, zero-copy reads at the cost of runtime safety. Zero-copy behavior is specified at the transaction level to reduce instrumentation overhead.

err := lmdb.View(func(txn *lmdb.Txn) error {
    // RawRead enables zero-copy behavior with some serious caveats.
    // Read the documentation carefully before using.
    txn.RawRead = true

    val, err := txn.Get(dbi, []byte("largevalue"), 0)
    // ...
})

###Idiomatic API

API inspired by BoltDB with automatic commit/rollback of transactions. The goal of lmdb-go is to provide idiomatic, safe database interactions without compromising the flexibility of the C API.

###API coverage

The lmdb-go project aims for complete feature coverage for LMDB. Subtransactions are fully supported. Databases utilizing the MDB_DUPSORT and MDB_DUPFIXED flags are supported.

For tracking purposes a list of unsupported features is kept in an issue.

###Documentation

Comprehensive documentation and examples are provided to demonstrate safe usage of lmdb. In addition to godoc documentation, implementations of the standand LMDB commands (mdb_stat, etc) can be found in the cmd/ directory and some simple experimental commands can be found in the exp/cmd/ directory. Aside from providing minor utility these programs are provided as examples of lmdb in practice.

#Build

There is no dependency on shared libraries. So most users can simply install using go get.

go get github.com/bmatsuo/lmdb-go/lmdb

On FreeBSD 10, you must explicitly set CC (otherwise it will fail with a cryptic error), for example:

CC=clang go test -v ./...

#Documentation

The best source of documentation is the official LMDB C API documentation reachable through the LMDB homepage.

Documentation specific to the Go bindings and how methods differ from their underlying C counterparts can be found on godoc.org.

Directories

Path Synopsis
cmd
lmdb_copy
Command lmdb_copy is a clone of mdb_copy that copies an LMDB environment.
Command lmdb_copy is a clone of mdb_copy that copies an LMDB environment.
lmdb_stat
Command lmdb_stat is a clone of mdb_stat that displays the status an LMDB environment.
Command lmdb_stat is a clone of mdb_stat that displays the status an LMDB environment.
exp
lmdbscan
Package lmdbscan provides a wrapper for lmdb.Cursor to simplify iteration.
Package lmdbscan provides a wrapper for lmdb.Cursor to simplify iteration.
lmdbsync
Package lmdbsync provides advanced synchronization for LMDB environments at the cost of performance.
Package lmdbsync provides advanced synchronization for LMDB environments at the cost of performance.
internal
Package lmdb provides bindings to the lmdb C API.
Package lmdb provides bindings to the lmdb C API.

Jump to

Keyboard shortcuts

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