storage

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2018 License: LGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloneCache

type CloneCache struct {
	Memory Memory
	Store  common.StateStore
}

CloneCache 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 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