statedomaindb

package
v0.0.0-...-03c569e Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryStorageDB

type MemoryStorageDB struct {
	Datas map[string]*MemoryStorageItem
	// contains filtered or unexported fields
}

func NewMemoryStorageDB

func NewMemoryStorageDB() *MemoryStorageDB

func (*MemoryStorageDB) Clean

func (ms *MemoryStorageDB) Clean()

clean

func (*MemoryStorageDB) Delete

func (ms *MemoryStorageDB) Delete(realkey []byte)

delete

func (*MemoryStorageDB) Exist

func (ms *MemoryStorageDB) Exist(realkey []byte) bool

exist

func (*MemoryStorageDB) Len

func (ms *MemoryStorageDB) Len() int

len

func (*MemoryStorageDB) Read

func (ms *MemoryStorageDB) Read(realkey []byte) ([]byte, bool)

read

func (*MemoryStorageDB) Save

func (ms *MemoryStorageDB) Save(realkey []byte, value []byte)

save

type MemoryStorageItem

type MemoryStorageItem struct {
	IsDelete bool   // Tag deleted
	Value    []byte // data
}

type QueryInstance

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

func (*QueryInstance) Delete

func (ins *QueryInstance) Delete() error

*

  • clear search index cache

func (*QueryInstance) Destroy

func (ins *QueryInstance) Destroy()

close

func (*QueryInstance) Exist

func (ins *QueryInstance) Exist() (bool, error)

*

  • search index exist

func (*QueryInstance) Find

func (ins *QueryInstance) Find() ([]byte, error)

*

  • search index file and get the item part

func (*QueryInstance) Save

func (ins *QueryInstance) Save(valuedatas []byte) error

func (ins *QueryInstance) Save(valuedatas []byte) (ValueSegmentOffset uint32, err error) {

type StateDomainDB

type StateDomainDB struct {

	// db in memory
	MemoryStorageDB *MemoryStorageDB

	// db in memory
	LevelDB *leveldb.DB
	// contains filtered or unexported fields
}

func NewStateDomainDB

func NewStateDomainDB(config *StateDomainDBConfig, ldb *leveldb.DB) *StateDomainDB

create DataBase

func (*StateDomainDB) Close

func (db *StateDomainDB) Close() error

close

func (*StateDomainDB) CreateNewQueryInstance

func (db *StateDomainDB) CreateNewQueryInstance(key []byte) (*QueryInstance, error)

Create execution unit

func (*StateDomainDB) Get

func (db *StateDomainDB) Get(key []byte) ([]byte, error)

Get

func (*StateDomainDB) Set

func (db *StateDomainDB) Set(key []byte, val []byte) error

Set

func (*StateDomainDB) TraversalCopy

func (this *StateDomainDB) TraversalCopy(target *StateDomainDB) error

type StateDomainDBConfig

type StateDomainDBConfig struct {
	// MemoryStorage
	MemoryStorage bool // Save data in memory
	// LevelDB
	LevelDB bool // Save data using level dB
	// size
	KeySize                  uint8  // Key value length < = 32
	SupplementalMaxValueSize uint32 // Data content length

	KeyDomainName string // Key prefix
}

func NewStateDomainDBConfig

func NewStateDomainDBConfig(
	keyDomainName string,
	mustMinValueSize uint32,
	keySize uint8,
) *StateDomainDBConfig

Jump to

Keyboard shortcuts

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