ccdb

package module
v0.0.0-...-ef1c326 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 9 Imported by: 0

README

CCDB

an Optimistic Concurrency Control-Based Database with EVM State Management in Mind

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

func New

func New(storage KeyValueStore) *Database

func (*Database) Snapshot

func (db *Database) Snapshot(readonly bool) (*Snapshot, error)

func (*Database) WriteChanges

func (db *Database) WriteChanges(ss *Snapshot) error

type ErrModified

type ErrModified struct{}

func (ErrModified) ErrModified

func (ErrModified) ErrModified()

func (ErrModified) Error

func (ErrModified) Error() string

func (ErrModified) String

func (ErrModified) String() string

type KVSnapshot

type KVSnapshot interface {
	Lookup(key string) (value string, err error)
	Iterate(prefix string) iter.Seq[string]
	Release()
}

type KeyValueStore

type KeyValueStore interface {
	Snapshot() (KVSnapshot, error)
	WriteChanges(ss *Snapshot) error
}

func LevelDB

func LevelDB(database *leveldb.DB) KeyValueStore

type Snapshot

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

func (*Snapshot) Changes

func (ss *Snapshot) Changes() iter.Seq2[string, string]

func (*Snapshot) Commit

func (ss *Snapshot) Commit(tx *Transaction) bool

func (*Snapshot) NewTransaction

func (ss *Snapshot) NewTransaction() *Transaction

func (*Snapshot) Readonly

func (ss *Snapshot) Readonly() bool

func (*Snapshot) Release

func (ss *Snapshot) Release()

type Transaction

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

func (*Transaction) Changes

func (tx *Transaction) Changes() iter.Seq2[string, string]

func (*Transaction) DropPrefix

func (tx *Transaction) DropPrefix(prefix string)

func (*Transaction) Get

func (tx *Transaction) Get(k string) (string, error)

func (*Transaction) Set

func (tx *Transaction) Set(key, val string)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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