runtime

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCachingStub added in v0.2.3

NewCachingStub create an stub with local caching

func SeralizeObject

func SeralizeObject(m StorageObject) ([]byte, error)

func WrapObject

func WrapObject(v interface{}) wrappingObject

Types

type CachingSupport added in v0.2.3

type CachingSupport interface {
	CanReadUnCommit()
}

CachingSupport enable an implement indicate it has support caching, i.e. GetState can read uncommited value

type ChaincodeRuntime

type ChaincodeRuntime struct {
	Storage StateMap
	Tx      TransactionInterface
	Core    CoreInterface
}

func NewRuntime

func NewRuntime(root string, stub shim.ChaincodeStubInterface, cfg *Config) *ChaincodeRuntime

func (*ChaincodeRuntime) Stub

func (*ChaincodeRuntime) SubRuntime

func (r *ChaincodeRuntime) SubRuntime(node string) *ChaincodeRuntime

type Config

type Config struct {
	ReadOnly bool
}

func NewConfig

func NewConfig() *Config

func (*Config) SetReadOnly

func (c *Config) SetReadOnly(flag bool)

type CoreInterface

type CoreInterface interface {
	SetEvent(name string, payload []byte) error
	GetRawStub() interface{}
}

type ExtendedObject

type ExtendedObject struct {
	Ext interface{}
}

allowing one or more "extended object" can be persisted When load return this error, the rest bytes is unmarshalled with the object in Ext field, and Load will be called again NOTICE: if there is no any rest bytes, Load is just called with the provided Ext field (without any change), and any failure in Unmarshalling just caused the whole Get process return failure NOTICE: Load return more ExtendedObject when there is no more bytes left will cause Get returun ExtendedObject as an error

func (ExtendedObject) Error

func (ExtendedObject) Error() string

type StateMap

type StateMap interface {
	SubMap(string) StateMap
	StoragePath() string
	GetRaw(string) ([]byte, error)
	SetRaw(string, []byte) error
	Get(string, StorageObject) error
	Set(string, StorageObject) error
	Delete(string) error
}

func NewShimMap

func NewShimMap(root string, stub shim.ChaincodeStubInterface, readOnly bool) StateMap

NewShimMap create default shimMap

func NewShimMapWithCache added in v0.2.3

func NewShimMapWithCache(root string, stub shim.ChaincodeStubInterface) StateMap

NewShimMapWithCache create shimMap with a wrapping stub along with write-cache which provide a more consistent data-isolation (invoked chaincode read uncommited data) on different chain-platform but tamper a little so it is not made an default option

type StateMap_Legacy

type StateMap_Legacy interface {
	SubMap(string) StateMap_Legacy
	StoragePath() string
	GetRaw(string) ([]byte, error)
	SetRaw(string, []byte) error
	Get(string, p.Message) error
	Set(string, p.Message) error
}

func NewShimMapLegacy

func NewShimMapLegacy(root string, stub shim.ChaincodeStubInterface, readOnly bool) StateMap_Legacy

NewShimMapLegacy create legacy interface

type StorageObject

type StorageObject interface {
	GetObject() interface{}
	Save() interface{}
	Load(interface{}) error
}

type TransactionInterface

type TransactionInterface interface {
	GetArgs() [][]byte
	GetStringArgs() []string
	GetTxID() string
	GetTxTime() (time.Time, error)
}

simply reorganize the interface in chaincodestub...

Jump to

Keyboard shortcuts

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