std

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const REGION_HEAD_SIZE uint32 = 12

Variables

View Source
var ErrIteratorDone = errors.New("iterator is done")

This is a special, placeholder to signal iteration is finished

Functions

func Deallocate

func Deallocate(pointer unsafe.Pointer)

func Package_message

func Package_message(msg []byte) unsafe.Pointer

func TranslateToRegion

func TranslateToRegion(b []byte, ptr uintptr) uintptr

func TranslateToSlice

func TranslateToSlice(ptr uintptr) []byte

func TranslateToString added in v0.3.0

func TranslateToString(ptr uintptr) string

func Translate_range_custom

func Translate_range_custom(ptr uintptr) []byte

Types

type Api

type Api interface {
	CanonicalAddress(human types.HumanAddress) (types.CanonicalAddress, error)
	HumanAddress(canonical types.CanonicalAddress) (types.HumanAddress, error)
	ValidateAddress(human types.HumanAddress) error
	Debug(msg string)
}

type Deps

type Deps struct {
	// Storage provides access to the data persistence layer at write and read level.
	Storage Storage
	// Api provides access to common utilities such as address
	// parsing and verification.
	Api Api
	// Querier is used to query information from other contracts.
	Querier Querier
}

Deps contains the dependencies passed to a contract's mutating entrypoints.

type Iterator

type Iterator interface {
	Next() (key, value []byte, err error)
}

type JSONType added in v0.2.0

type JSONType interface {
	MarshalJSON() ([]byte, error)
	UnmarshalJSON([]byte) error
}

type MemRegion

type MemRegion struct {
	Offset   uint32
	Capacity uint32
	Length   uint32
}

func Build_region

func Build_region(size uint32, len uint32) (unsafe.Pointer, *MemRegion)

type Order

type Order uint32

Order defines how keys are ordered during iteration.

const (
	// Ascending orders ranged keys from smallest to biggest.
	Ascending Order = 1
	// Descending orders ranged keys from biggest to smallest.
	Descending Order = 2
)

type Querier

type Querier interface {
	RawQuery(request []byte) ([]byte, error)
}

type QuerierWrapper

type QuerierWrapper struct {
	Querier
}

func (QuerierWrapper) Query added in v0.4.0

func (q QuerierWrapper) Query(query types.ToQuery, result JSONType) error

func (QuerierWrapper) QueryAllBalances

func (q QuerierWrapper) QueryAllBalances(addr string) ([]types.Coin, error)

func (QuerierWrapper) QueryBalance

func (q QuerierWrapper) QueryBalance(addr string, denom string) (types.Coin, error)

func (QuerierWrapper) QueryContractInfo added in v0.4.0

func (q QuerierWrapper) QueryContractInfo(addr string) (*types.ContractInfo, error)

func (QuerierWrapper) QueryRaw added in v0.4.0

func (q QuerierWrapper) QueryRaw(addr string, key []byte, resp JSONType) error

func (QuerierWrapper) QuerySmart added in v0.4.0

func (q QuerierWrapper) QuerySmart(addr string, msg JSONType, resp JSONType) error

type ReadonlyStorage

type ReadonlyStorage interface {
	// Get gets the value of the provided key. If value is nil then the key does not exist.
	Get(key []byte) (value []byte)
	// Range ranges from start to end byte prefixes with the provided Order flag.
	Range(start, end []byte, order Order) (iterator Iterator)
}

ReadonlyStorage defines the behaviour of a KV with only read capabilities.

type SliceHeader_Go

type SliceHeader_Go struct {
	Data uintptr
	Len  int
	Cap  int
}

type SliceHeader_tinyGo

type SliceHeader_tinyGo struct {
	Data uintptr
	Len  uintptr
	Cap  uintptr
}

type Storage

type Storage interface {
	ReadonlyStorage

	// Set sets the key and value.
	Set(key, value []byte)
	// Remove removes the value from the db.
	Remove(key []byte)
}

Storage defines the behaviour of a KV with read and write capabilities.

Directories

Path Synopsis
Package math contains some human-readable mathematical primitives.
Package math contains some human-readable mathematical primitives.

Jump to

Keyboard shortcuts

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