memdb

package
Version: v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2020 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB represents the block cache mem store. All DB methods are safe for concurrent use by multiple goroutines. Note: memdb is not a general purpose mem store but it designed for specific use in tracedb.

func Open

func Open(memSize int64) (*DB, error)

Open opens or creates a new DB of given size.

func (*DB) Close

func (db *DB) Close() error

Close closes the memdb.

func (*DB) Count

func (db *DB) Count() uint64

Count returns the number of items in memdb.

func (*DB) Free

func (db *DB) Free(contract uint64, key uint64) error

Free free keeps first offset that can be free if memdb exceeds target size.

func (*DB) Get

func (db *DB) Get(contract uint64, key uint64) ([]byte, error)

Get gets data for the provided key under a contract

func (*DB) Set

func (db *DB) Set(contract uint64, key uint64, data []byte) error

Set sets the value for the given entry for a contract.

func (*DB) Size

func (db *DB) Size() (int64, error)

Size returns the total size of memdb.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL