memdb

package
v0.0.0-...-2d5464a Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2015 License: Apache-2.0, BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package memdb provides a memory-backed implementation of the db.DB interface.

A MemDB's memory consumption increases monotonically, even if keys are deleted or values are updated with shorter slices. Callers of the package are responsible for explicitly compacting a MemDB into a separate DB (whether in-memory or on-disk) when appropriate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemDB

type MemDB struct {
	// contains filtered or unexported fields
}

MemDB is a memory-backed implementation of the db.DB interface.

It is safe to call Get, Set, Delete and Find concurrently.

func New

func New(o *db.Options) *MemDB

New returns a new MemDB.

func (*MemDB) ApproximateMemoryUsage

func (m *MemDB) ApproximateMemoryUsage() int

ApproximateMemoryUsage returns the approximate memory usage of the MemDB.

func (*MemDB) Close

func (m *MemDB) Close() error

Close implements DB.Close, as documented in the leveldb/db package.

func (*MemDB) Delete

func (m *MemDB) Delete(key []byte, o *db.WriteOptions) error

Delete implements DB.Delete, as documented in the leveldb/db package.

func (*MemDB) Find

func (m *MemDB) Find(key []byte, o *db.ReadOptions) db.Iterator

Find implements DB.Find, as documented in the leveldb/db package.

func (*MemDB) Get

func (m *MemDB) Get(key []byte, o *db.ReadOptions) (value []byte, err error)

Get implements DB.Get, as documented in the leveldb/db package.

func (*MemDB) Set

func (m *MemDB) Set(key, value []byte, o *db.WriteOptions) error

Set implements DB.Set, as documented in the leveldb/db package.

Jump to

Keyboard shortcuts

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