leveldb

package
v0.0.0-...-8b9b725 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2019 License: MIT, MIT Imports: 11 Imported by: 4

README

go-ds-leveldb

standard-readme compliant GoDoc Build Status

A go-datastore implementation using LevelDB

go-ds-leveldb implements the go-datastore interface using a LevelDB backend.

Table of Contents

Install

This module can be installed like a regular go module:

go get github.com/ipfs/go-ds-leveldb

It uses Gx to manage dependencies. You can use make deps to rewrite imports to the gx-specified versions.

Usage

import "github.com/ipfs/go-ds-leveldb"

Check the GoDoc documentation

Contribute

PRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © Protocol Labs, Inc.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datastore

type Datastore struct {
	DB *leveldb.DB
	// contains filtered or unexported fields
}

func NewDatastore

func NewDatastore(path string, opts *Options) (*Datastore, error)

NewDatastore returns a new datastore backed by leveldb

for path == "", an in memory bachend will be chosen

func (*Datastore) Batch

func (d *Datastore) Batch() (ds.Batch, error)

func (*Datastore) Close

func (d *Datastore) Close() (err error)

LevelDB needs to be closed.

func (Datastore) Delete

func (a Datastore) Delete(key ds.Key) (err error)

func (*Datastore) DiskUsage

func (d *Datastore) DiskUsage() (uint64, error)

DiskUsage returns the current disk size used by this levelDB. For in-mem datastores, it will return 0.

func (Datastore) Get

func (a Datastore) Get(key ds.Key) (value []byte, err error)

func (Datastore) GetSize

func (d Datastore) GetSize(key ds.Key) (size int, err error)

func (Datastore) Has

func (a Datastore) Has(key ds.Key) (exists bool, err error)

func (*Datastore) IsThreadSafe

func (d *Datastore) IsThreadSafe()

func (*Datastore) NewTransaction

func (d *Datastore) NewTransaction(readOnly bool) (ds.Txn, error)

func (Datastore) Put

func (a Datastore) Put(key ds.Key, value []byte) (err error)

func (Datastore) Query

func (a Datastore) Query(q dsq.Query) (dsq.Results, error)

type Options

type Options opt.Options

Options is an alias of syndtr/goleveldb/opt.Options which might be extended in the future.

Jump to

Keyboard shortcuts

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