lite

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: MIT Imports: 12 Imported by: 0

README

General concept

Lite package represents a database driver that provides in-memory blockchain storage. That said, it does not provide persistence storage. For now, it is applicable only for testing purposes like:

  • running a unit-test
  • running a benchmark test
  • running a test harness

It still implements transaction layer requirements like atomicity, consistency and isolation but no durability. At some point later it can be used as baseline to compare performance results.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DriverName is the unique identifier for the heavy driver
	DriverName = "lite_v0.1.0"
)

Functions

func CreateDBConnection

func CreateDBConnection() (database.Driver, database.DB)

func NewDatabase

func NewDatabase(path string, network protocol.Magic, readonly bool) (database.DB, error)

This should be the ideal situation with lowest latency on storing or fetching data In-memory only (as result autoDeleted) multi-instances (no singlton)

Types

type DB

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

func (*DB) Begin

func (db *DB) Begin(writable bool) (database.Transaction, error)

Begin builds read-only or read-write Transaction

func (*DB) Close

func (db *DB) Close() error

func (*DB) Update

func (db *DB) Update(fn func(database.Transaction) error) error

func (*DB) View

func (db *DB) View(fn func(database.Transaction) error) error

Jump to

Keyboard shortcuts

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