storages

Collection of key-value storages adapters for Golang

This project is maintained by reddec

LevelDB

API docs

Multi-files, embeddable, pure-Go storage. Uses levelDB storage as backend. Supports native batching.

URL initialization

Do not forget to import package!

leveldb://<path>

Where:

Usage

stor, err = leveldbstorage.New("path/to/dbdir")
if err != nil {
    panic(err)
}
defer stor.Close()

Features

Batch writing

Support BatchedStorage interface.

It allows to cache Put operations and execute them in one batch. In general case it may increase write throughput.

Batch implements Writer interface.

Example:

batchWriter := storage.Batch()

batchWriter.Put([]byte("key1"),[]byte("value1")
batchWriter.Put([]byte("key2"),[]byte("value2")
//...
batchWriter.Put([]byte("keyN"),[]byte("valueN")

// flush/write batch to storage
batchWriter.Close()