storage

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2019 License: LGPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheDB added in v1.5.1

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

CacheDB is smart contract execute cache, it contain transaction cache and block cache When smart contract execute finish, need to commit transaction cache to block cache

func NewCacheDB added in v1.5.1

func NewCacheDB(store *overlaydb.OverlayDB) *CacheDB

NewCacheDB return a new contract cache

func (*CacheDB) Commit added in v1.5.1

func (self *CacheDB) Commit()

Commit current transaction cache to block cache

func (*CacheDB) Delete added in v1.5.1

func (self *CacheDB) Delete(key []byte)

func (*CacheDB) DeleteContract added in v1.5.1

func (self *CacheDB) DeleteContract(address comm.Address)

func (*CacheDB) Get added in v1.5.1

func (self *CacheDB) Get(key []byte) ([]byte, error)

func (*CacheDB) GetContract added in v1.5.1

func (self *CacheDB) GetContract(addr comm.Address) (*payload.DeployCode, error)

func (*CacheDB) NewIterator added in v1.5.1

func (self *CacheDB) NewIterator(key []byte) common.StoreIterator

func (*CacheDB) Put added in v1.5.1

func (self *CacheDB) Put(key []byte, value []byte)

func (*CacheDB) PutContract added in v1.5.1

func (self *CacheDB) PutContract(contract *payload.DeployCode) error

type CloneCache

type CloneCache struct {
	Memory Memory
	Store  common.StateStore
}

CacheDB is smart contract execute cache, it contain transaction cache and block cache When smart contract execute finish, need to commit transaction cache to block cache

func NewCloneCache

func NewCloneCache(store common.StateStore) *CloneCache

NewCloneCache return a new contract cache

func (*CloneCache) Add

func (this *CloneCache) Add(prefix common.DataEntryPrefix, key []byte, value states.StateValue)

Add item to cache

func (*CloneCache) Commit

func (this *CloneCache) Commit()

Commit current transaction cache to block cache

func (*CloneCache) Delete

func (this *CloneCache) Delete(prefix common.DataEntryPrefix, key []byte)

Delete item from cache

func (*CloneCache) Get

func (this *CloneCache) Get(prefix common.DataEntryPrefix, key []byte) (states.StateValue, error)

Get item by key

func (*CloneCache) GetOrAdd

func (this *CloneCache) GetOrAdd(prefix common.DataEntryPrefix, key []byte, value states.StateValue) (states.StateValue, error)

GetOrAdd item If item has existed, return it Else add it to cache

type Iter added in v1.5.1

type Iter struct {
	*overlaydb.JoinIter
}

func (*Iter) Key added in v1.5.1

func (self *Iter) Key() []byte

type Memory

type Memory map[string]*StateItem

type StateItem

type StateItem struct {
	Prefix common.DataEntryPrefix
	Key    string
	Value  states.StateValue
	State  common.ItemState
}

StateItem describe smart contract cache item element

Jump to

Keyboard shortcuts

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