storage

package
v0.106.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const (
	FindDefault      = 0
	FindKeysOnly     = 1 << 0
	FindRemovePrefix = 1 << 1
	FindValuesOnly   = 1 << 2
	FindDeserialize  = 1 << 3
	FindPick0        = 1 << 4
	FindPick1        = 1 << 5
	FindBackwards    = 1 << 7

	FindAll = FindDefault | FindKeysOnly | FindRemovePrefix | FindValuesOnly |
		FindDeserialize | FindPick0 | FindPick1 | FindBackwards
)

Storage iterator options.

Variables

View Source
var (
	// ErrGasLimitExceeded is returned from interops when there is not enough
	// GAS left in the execution context to complete the action.
	ErrGasLimitExceeded = errors.New("gas limit exceeded")
)

Functions

func ContextAsReadOnly added in v0.99.1

func ContextAsReadOnly(ic *interop.Context) error

ContextAsReadOnly sets given context to read-only mode.

func Delete added in v0.99.1

func Delete(ic *interop.Context) error

storageDelete deletes stored key-value pair.

func Find added in v0.99.1

func Find(ic *interop.Context) error

Find finds stored key-value pair.

func Get added in v0.99.1

func Get(ic *interop.Context) error

Get returns stored key-value pair.

func GetContext added in v0.99.1

func GetContext(ic *interop.Context) error

GetContext returns storage context for the currently executing contract.

func GetReadOnlyContext added in v0.99.1

func GetReadOnlyContext(ic *interop.Context) error

GetReadOnlyContext returns read-only storage context for the currently executing contract.

func Put added in v0.99.1

func Put(ic *interop.Context) error

Put puts key-value pair into the storage.

Types

type Context added in v0.99.1

type Context struct {
	ID       int32
	ReadOnly bool
}

Context contains contract ID and read/write flag, it's used as a context for storage manipulation functions.

type Iterator

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

Iterator is an iterator state representation.

func NewIterator

func NewIterator(seekCh chan storage.KeyValue, prefix []byte, opts int64) *Iterator

NewIterator creates a new Iterator with the given options for the given channel of store.Seek results.

func (*Iterator) Next

func (s *Iterator) Next() bool

Next advances the iterator and returns true if Value can be called at the current position.

func (*Iterator) Value

func (s *Iterator) Value() stackitem.Item

Value returns current iterators value (exact type depends on options this iterator was created with).

Jump to

Keyboard shortcuts

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