Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateChaincodeProposalWithTxIDAndTransient

func CreateChaincodeProposalWithTxIDAndTransient(chainID string, spec *pb.ChaincodeSpec, creator []byte, transientMap map[string][]byte) (*pb.Proposal, string, error)

CreateChaincodeProposalWithTxIDAndTransient creates a proposal from given input It returns the proposal and the transaction id associated to the proposal

func GetSignedProposal

func GetSignedProposal(prop *pb.Proposal, signer msp.SigningIdentity) (*pb.SignedProposal, error)

GetSignedProposal returns a signed proposal given a Proposal message and a signing identity

func InitCrypto

func InitCrypto(m *mspex.MspEnv) error

InitCrypto 初始化msp 加密信息

Types

type BroadcastClient

type BroadcastClient interface {
	//Send data to orderer
	Send(env *cb.Envelope) error
	Close() error
}

type ChaincodeEnv

type ChaincodeEnv struct {
	Function      string //方法名 格式:Function :query 如果为空,但如果args的len>1 则默认是invoke  否则是query
	ChaincodeName string //
	ChannelID     string //channel 的名称
}

type NodeEnv

type NodeEnv struct {
	Address          string
	HostnameOverride string
	ConnTimeout      time.Duration

	TLS          bool // 是否启用TLS 连接节点 默认是false
	RootCertFile string

	Connect *grpc.ClientConn
	sync.Mutex
	// contains filtered or unexported fields
}

func (*NodeEnv) ClientConn

func (node *NodeEnv) ClientConn() error

ClientConn rpc 连接

func (*NodeEnv) CloseConn

func (node *NodeEnv) CloseConn()

CloseConn grpc 关闭连接

func (*NodeEnv) VerifyConn

func (node *NodeEnv) VerifyConn() error

VerifyConn 校验状态

type OrderEnv

type OrderEnv struct {
	*NodeEnv
}

OrderEnv 节点的数据

func (*OrderEnv) NewBroadcastClient

func (order *OrderEnv) NewBroadcastClient() (BroadcastClient, error)

type PeerEnv

type PeerEnv struct {
	*NodeEnv
}

func (*PeerEnv) NewEndorserClient

func (peer *PeerEnv) NewEndorserClient() pb.EndorserClient

type RPC

type RPC struct{}

depecrated

func (*RPC) NewManager

func (_ *RPC) NewManager() *RPCManager

type RPCBuilder

type RPCBuilder struct {
	*ChaincodeEnv
	*msp.MspEnv
	*OrderEnv
	// *PeersEnv
	Peers       []*PeerEnv
	ConnManager *RPCManager
	TxTimeout   time.Duration
}

RPCBuilder rpc客户端公共数据

func NewRpcBuilder

func NewRpcBuilder() *RPCBuilder

func (*RPCBuilder) CloseConn

func (r *RPCBuilder) CloseConn()

CloseConn 关闭连接

func (*RPCBuilder) InitConn

func (r *RPCBuilder) InitConn(isOrdererRequired bool) error

InitConn 初始化chaincode命令工厂

func (*RPCBuilder) Invoke

func (r *RPCBuilder) Invoke(args [][]byte) (string, error)

func (*RPCBuilder) PreHande

func (r *RPCBuilder) PreHande(invoke bool) (string, error)

func (*RPCBuilder) Query

func (r *RPCBuilder) Query(args [][]byte) ([]byte, error)

Query 查询 格式: args:[]string{"a"} 代表查询a的值 跟方法名要匹配

func (*RPCBuilder) VerifyConn

func (r *RPCBuilder) VerifyConn(isOrdererRequired bool) error

VerifyConn 校验连接

type RPCManager

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

func NewRpcManager

func NewRpcManager() *RPCManager

func (*RPCManager) Cancel

func (m *RPCManager) Cancel()

func (*RPCManager) Context

func (m *RPCManager) Context() context.Context