Documentation ¶
Index ¶
- Variables
- func Address20ToBytes(addr string) ([]byte, error)
- func Address32ToBytes(addr string) ([]byte, error)
- func AddressToBytes(addr string) ([]byte, error)
- func AddressToString(addr []byte) string
- func AssertLength(addr []byte, l int) error
- func Check(err error)
- func Check2(err error)
- func CheckResponse(resp *http.Response, err error) error
- func ConcatBytes(srcs ...[]byte) []byte
- func CopyAndSumCode(r io.Reader) ([]byte, *bytes.Buffer, error)
- func CreateRequestBody(f io.Reader) (*bytes.Buffer, string, error)
- func DecodeBalance(b []byte) uint64
- func DownloadCode(url string, retry int) (*http.Response, error)
- func DownloadCodeIfRequired(codeDir string, codeID, data []byte) error
- func DumpFile(data []byte, directory, file string)
- func EncodeBalance(value uint64) []byte
- func Exists(path string) bool
- func GetCodeAddr(key string) []byte
- func GetRequestWithRetry(url string) (*http.Response, error)
- func RegisterCode(key string, addr []byte)
- func StoreCode(codeDir string, r io.Reader) ([]byte, error)
- func ValidLength(addr []byte) error
- func WriteCodeFile(codeDir string, codeID []byte, r io.Reader) error
- type CallContext
- type CallContextQuery
- type CallContextTx
- type Chaincode
- type CodeDriver
- type CodeInfo
- type DeploymentInput
- type DriverType
- type MemStateStore
- type MockCallContext
- type QueryData
- type StateGetter
- type StateStore
- type StateTracker
- func (trk *StateTracker) GetState(key []byte) []byte
- func (trk *StateTracker) GetStateChanges() []*core.StateChange
- func (trk *StateTracker) HasDependencyChanges(child *StateTracker) bool
- func (trk *StateTracker) Merge(child *StateTracker)
- func (trk *StateTracker) SetState(key, value []byte)
- func (trk *StateTracker) Spawn(keyPrefix []byte) *StateTracker
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAddressLength = errors.New("unexpected address length")
Functions ¶
func Address20ToBytes ¶
func Address32ToBytes ¶
func AddressToBytes ¶
func AddressToString ¶
func AssertLength ¶
func ConcatBytes ¶
func DecodeBalance ¶
func DownloadCodeIfRequired ¶
func EncodeBalance ¶
func GetCodeAddr ¶
func RegisterCode ¶
func ValidLength ¶
Types ¶
type CallContext ¶
type CallContextQuery ¶
type CallContextQuery struct { StateGetter RawInput []byte RawSender []byte }
func (*CallContextQuery) BlockHash ¶
func (ctx *CallContextQuery) BlockHash() []byte
func (*CallContextQuery) BlockHeight ¶
func (ctx *CallContextQuery) BlockHeight() uint64
func (*CallContextQuery) Input ¶
func (ctx *CallContextQuery) Input() []byte
func (*CallContextQuery) Sender ¶
func (ctx *CallContextQuery) Sender() []byte
func (*CallContextQuery) SetState ¶
func (ctx *CallContextQuery) SetState(key, value []byte)
type CallContextTx ¶
type CallContextTx struct { *StateTracker Block *core.Block Transaction *core.Transaction RawSender []byte RawInput []byte }
func (*CallContextTx) BlockHash ¶
func (ctx *CallContextTx) BlockHash() []byte
func (*CallContextTx) BlockHeight ¶
func (ctx *CallContextTx) BlockHeight() uint64
func (*CallContextTx) Input ¶
func (ctx *CallContextTx) Input() []byte
func (*CallContextTx) Sender ¶
func (ctx *CallContextTx) Sender() []byte
type Chaincode ¶
type Chaincode interface { // Init is called when chaincode is deployed Init(ctx CallContext) error Invoke(ctx CallContext) error Query(ctx CallContext) ([]byte, error) // SetTxTrk is used only for evm runner SetTxTrk(txTrk *StateTracker) }
Chaincode all chaincodes implements this interface
type CodeDriver ¶
type CodeDriver interface { // Install is called when code deployment transaction is received // Example data field - download url for code binary // After successful Install, getInstance should give a Chaincode instance without error Install(codeID, data []byte) error GetInstance(codeID []byte) (Chaincode, error) }
type CodeInfo ¶
type CodeInfo struct { DriverType DriverType `json:"driverType"` CodeID []byte `json:"codeID"` }
type DeploymentInput ¶
type DriverType ¶
type DriverType uint8
const ( DriverTypeNative DriverType = iota + 1 DriverTypeBincc DriverTypeEVM )
type MemStateStore ¶
type MemStateStore struct {
Storage storage.PersistStore
}
func NewMemStateStore ¶
func NewMemStateStore() *MemStateStore
func (*MemStateStore) GetState ¶
func (store *MemStateStore) GetState(key []byte) []byte
func (*MemStateStore) SetState ¶
func (store *MemStateStore) SetState(key, value []byte)
func (*MemStateStore) VerifyState ¶
func (store *MemStateStore) VerifyState(key []byte) []byte
type MockCallContext ¶
type MockCallContext struct { *MemStateStore MockSender []byte MockBlockHeight uint64 MockBlockHash []byte MockInput []byte }
func (*MockCallContext) BlockHash ¶
func (wc *MockCallContext) BlockHash() []byte
func (*MockCallContext) BlockHeight ¶
func (wc *MockCallContext) BlockHeight() uint64
func (*MockCallContext) Input ¶
func (wc *MockCallContext) Input() []byte
func (*MockCallContext) Sender ¶
func (wc *MockCallContext) Sender() []byte
type StateGetter ¶
type StateStore ¶
type StateTracker ¶
type StateTracker struct {
// contains filtered or unexported fields
}
StateTracker tracks state changes in key order get latest changed state for each key get state from base state getter if no changes occured for a key
func NewStateTracker ¶
func NewStateTracker(state StateGetter, keyPrefix []byte) *StateTracker
func (*StateTracker) GetState ¶
func (trk *StateTracker) GetState(key []byte) []byte
func (*StateTracker) GetStateChanges ¶
func (trk *StateTracker) GetStateChanges() []*core.StateChange
func (*StateTracker) HasDependencyChanges ¶
func (trk *StateTracker) HasDependencyChanges(child *StateTracker) bool
func (*StateTracker) Merge ¶
func (trk *StateTracker) Merge(child *StateTracker)
func (*StateTracker) SetState ¶
func (trk *StateTracker) SetState(key, value []byte)
func (*StateTracker) Spawn ¶
func (trk *StateTracker) Spawn(keyPrefix []byte) *StateTracker
Spawn creates a new tracker with current tracker as base StateGetter
Click to show internal directories.
Click to hide internal directories.