shim

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_RECV_MSG_SIZE = 100 * 1024 * 1024 // 100 Mbytes
	MAX_SEND_MSG_SIZE = 100 * 1024 * 1024 // 100 Mbytes

	DEFAULT_TIMEOUT = 3 * time.Second // 3 seconds
)

Variables

View Source
var DefaultKeepaliveOptions = &KeepaliveOptions{
	ClientInterval: time.Duration(1) * time.Minute,
	ClientTimeout:  time.Duration(20) * time.Second,
}

Functions

func NewClientConnection

func NewClientConnection(addr string, kopts *KeepaliveOptions, creds credentials.TransportCredentials, block bool) (*grpc.ClientConn, error)

func ParseConfig

func ParseConfig() error

func Start

func Start(cc Chaincode) error

Types

type Chaincode

type Chaincode interface {
	Init(stub ChaincodeStubInterface) error
	Invoke(stub ChaincodeStubInterface) error
}

type ChaincodeStub

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

func (*ChaincodeStub) GetBalance

func (stub *ChaincodeStub) GetBalance(who string) (string, error)

func (*ChaincodeStub) GetCcid

func (stub *ChaincodeStub) GetCcid() string

func (*ChaincodeStub) GetCreator

func (stub *ChaincodeStub) GetCreator() string

func (*ChaincodeStub) GetData

func (stub *ChaincodeStub) GetData() [][]byte

func (*ChaincodeStub) GetFuncAndArgs

func (stub *ChaincodeStub) GetFuncAndArgs() (string, []string)

func (*ChaincodeStub) GetOwner

func (stub *ChaincodeStub) GetOwner() string

func (*ChaincodeStub) GetState

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

func (*ChaincodeStub) GetStates

func (stub *ChaincodeStub) GetStates(keys ...string) (map[string][]byte, error)

func (*ChaincodeStub) GetStringData

func (stub *ChaincodeStub) GetStringData() []string

func (*ChaincodeStub) GetTxid

func (stub *ChaincodeStub) GetTxid() string

func (*ChaincodeStub) PutState

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

func (*ChaincodeStub) PutStates

func (stub *ChaincodeStub) PutStates(states map[string][]byte, keys ...string) error

func (*ChaincodeStub) Transfer

func (stub *ChaincodeStub) Transfer(to, coin string) error

type ChaincodeStubInterface

type ChaincodeStubInterface interface {
	GetCcid() string
	GetOwner() string
	GetTxid() string
	GetCreator() string
	GetData() [][]byte
	GetStringData() []string
	GetFuncAndArgs() (string, []string)
	GetState(key string) ([]byte, error)
	GetStates(keys ...string) (map[string][]byte, error)
	//GetStateByRange(startKey, endKey string) (map[string][]byte, error)
	PutState(key string, value []byte, ifNotExist bool) error
	PutStates(states map[string][]byte, keys ...string) error
	Transfer(to, coin string) error
	GetBalance(who string) (string, error)
}

type Handler

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

type KeepaliveOptions

type KeepaliveOptions struct {
	ClientInterval time.Duration
	ClientTimeout  time.Duration
}

type NetConfig

type NetConfig struct {
	//Clients  []ClientInfo  `json:"clients"`
	Peers []PeerInfo `json:"peers"`
}

type PeerInfo

type PeerInfo struct {
	Id int `json:"id"`
	//Ip              string `json:"ip"`
	//AdminListen     string `json:"admin_listen"`
	//EndorserListen  string `json:"endorser_listen"`
	ChaincodeListen string `json:"chaincode_listen"`
}

type RespStatus

type RespStatus uint8
const (
	RespStatusError RespStatus = iota
	RespStatusUpdate
	RespStatusQuery
)

type Stream

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

type Token

type Token interface {
	Transfer(stub ChaincodeStubInterface, to, amount string) error
	GetBalance(stub ChaincodeStubInterface, who string) error
	GetTotalSupply(stub ChaincodeStubInterface) error
}

Jump to

Keyboard shortcuts

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