shim

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2016 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(cc Chaincode) error

Start entry point for chaincodes bootstrap.

Types

type Chaincode

type Chaincode interface {
	// Run method will be called during init and for every transaction
	Run(stub *ChaincodeStub, function string, args []string) ([]byte, error)
	// Query is to be used for read-only access to chaincode state
	Query(stub *ChaincodeStub, function string, args []string) ([]byte, error)
}

Chaincode is the standard chaincode callback interface that the chaincode developer needs to implement.

type ChaincodeStub

type ChaincodeStub struct {
	UUID string
}

ChaincodeStub for shim side handling.

func (*ChaincodeStub) DelState

func (stub *ChaincodeStub) DelState(key string) error

DelState function can be invoked by a chaincode to delete state from the ledger.

func (*ChaincodeStub) GetState

func (stub *ChaincodeStub) GetState(key string) ([]byte, error)

GetState function can be invoked by a chaincode to get a state from the ledger.

func (*ChaincodeStub) InvokeChaincode

func (stub *ChaincodeStub) InvokeChaincode(chaincodeName string, function string, args []string) ([]byte, error)

InvokeChaincode function can be invoked by a chaincode to execute another chaincode.

func (*ChaincodeStub) PutState

func (stub *ChaincodeStub) PutState(key string, value []byte) error

PutState function can be invoked by a chaincode to put state into the ledger.

func (*ChaincodeStub) QueryChaincode

func (stub *ChaincodeStub) QueryChaincode(chaincodeName string, function string, args []string) ([]byte, error)

QueryChaincode function can be invoked by a chaincode to query another chaincode.

func (*ChaincodeStub) RangeQueryState

func (stub *ChaincodeStub) RangeQueryState(startKey, endKey string) (*StateRangeQueryIterator, error)

RangeQueryState function can be invoked by a chaincode to query of a range of keys in the state. Assuming the startKey and endKey are in lexical order, an iterator will be returned that can be used to iterate over all keys between the startKey and endKey, inclusive. The order in which keys are returned by the iterator is random.

type Handler

type Handler struct {
	sync.RWMutex
	To         string
	ChatStream PeerChaincodeStream
	FSM        *fsm.FSM
	// contains filtered or unexported fields
}

Handler handler implementation for shim side of chaincode.

type PeerChaincodeStream

type PeerChaincodeStream interface {
	Send(*pb.ChaincodeMessage) error
	Recv() (*pb.ChaincodeMessage, error)
}

PeerChaincodeStream interface for stream between Peer and chaincode instance.

type StateRangeQueryIterator

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

StateRangeQueryIterator allows a chaincode to iterate over a range of key/value pairs in the state.

func (*StateRangeQueryIterator) Close

func (iter *StateRangeQueryIterator) Close() error

Close closes the range query iterator. This should be called when done reading from the iterator to free up resources.

func (*StateRangeQueryIterator) HasNext

func (iter *StateRangeQueryIterator) HasNext() bool

HasNext returns true if the range query iterator contains additional keys and values.

func (*StateRangeQueryIterator) Next

func (iter *StateRangeQueryIterator) Next() (string, []byte, error)

Next returns the next key and value in the range query iterator.

Jump to

Keyboard shortcuts

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