Documentation ¶
Index ¶
- func CloseClients(s interface{})
- func ConvertCollectionConfig(CollectionsConfig []PrivateDataCollectionConfig) (*peer.CollectionConfigPackage, error)
- func GetDeploymentPayload(tYPE peer.ChaincodeSpec_Type, path string) ([]byte, error)
- func GetFactory(s string)
- func GetOrdererClients(orderers []Endpoint) []*client.OrdererClient
- func GetPeerClients(peers []Endpoint) []*client.PeerClient
- func GetSigner(mspPath, mspID string) (msp.SigningIdentity, error)
- func Install(chainOpt ChainOpt, mspOpt MSPOpt, peers Endpoint, cTor string, isPackage bool) (proposalResponse *peer.ProposalResponse, err error)
- func Instantiate(channelID string, cTor string, chainOpt ChainOpt, signer msp.SigningIdentity, ...) error
- func InternalInstall(chainOpt ChainOpt, signer msp.SigningIdentity, peerClient *client.PeerClient, ...) (proposalResponse *peer.ProposalResponse, err error)
- func InternalInvoke(chaincode ChainOpt, mspOpt MSPOpt, args [][]byte, ...) (*peer.ProposalResponse, error)
- func InternalListInstalled(mspOpt MSPOpt, peers []*client.PeerClient) (*peer.ProposalResponse, error)
- func InternalListInstantiated(channelID string, mspOpt MSPOpt, peers []*client.PeerClient) (*peer.ProposalResponse, error)
- func Invoke(chaincode ChainOpt, mspOpt MSPOpt, args [][]byte, ...) (*peer.ProposalResponse, error)
- func Invoke2(chaincode ChainOpt, mspOpt MSPOpt, args [][]byte, ...) (*peer.ProposalResponse, error)
- func ListInstalled(mspOpt MSPOpt, peers []Endpoint) (*peer.ProposalResponse, error)
- func ListInstantiated(channelID string, mspOpt MSPOpt, peers []Endpoint) (*peer.ProposalResponse, error)
- func Query(chaincode ChainOpt, mspOpt MSPOpt, args [][]byte, ...) (*peer.ProposalResponse, error)
- func Query2(chaincode ChainOpt, mspOpt MSPOpt, args [][]byte, ...) (*peer.ProposalResponse, error)
- func Upgrade(channelID string, cTor string, chainOpt ChainOpt, signer msp.SigningIdentity, ...) error
- type ChainOpt
- type DeliverClient
- type DeliverGroup
- func (dg *DeliverGroup) ClientConnect(ctx context.Context, dc *DeliverClient)
- func (dg *DeliverGroup) ClientWait(dc *DeliverClient)
- func (dg *DeliverGroup) Connect(ctx context.Context) error
- func (dg *DeliverGroup) Wait(ctx context.Context) error
- func (dg *DeliverGroup) WaitForWG(readyCh chan struct{})
- type EndorsementPolicy
- type Endpoint
- type EndpointWithPath
- type GrpcTLSOpt
- type GrpcTLSOptWithPath
- type MSPOpt
- type PrivateDataCollectionConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseClients ¶
func CloseClients(s interface{})
CloseClients close []*client.PeerClient,[]*client.OrdererClient,[]*client.Client or *client.PeerClient,*client.OrdererClient,*client.Client
func ConvertCollectionConfig ¶
func ConvertCollectionConfig(CollectionsConfig []PrivateDataCollectionConfig) (*peer.CollectionConfigPackage, error)
ConvertCollectionConfig convert collections config to proto config
func GetDeploymentPayload ¶
func GetDeploymentPayload(tYPE peer.ChaincodeSpec_Type, path string) ([]byte, error)
GetDeploymentPayload get chaincode data from path for different language chaincode
func GetOrdererClients ¶
func GetOrdererClients(orderers []Endpoint) []*client.OrdererClient
GetOrdererClients endpoint to orderer clients
func GetPeerClients ¶
func GetPeerClients(peers []Endpoint) []*client.PeerClient
GetPeerClients endpoint to peer clients
func Install ¶
func Install(chainOpt ChainOpt, mspOpt MSPOpt, peers Endpoint, cTor string, isPackage bool) (proposalResponse *peer.ProposalResponse, err error)
Install install a chaincode before fabric 2.0 cTor eg: '{"Args":["init","a","100","b","200"]}' isPackage whether chainOpt.Path is a .tar.gz package or not
func Instantiate ¶
func Instantiate(channelID string, cTor string, chainOpt ChainOpt, signer msp.SigningIdentity, peerClient client.PeerClient, ordererClients []client.OrdererClient) error
Instantiate init a chaincode
func InternalInstall ¶
func InternalInstall(chainOpt ChainOpt, signer msp.SigningIdentity, peerClient *client.PeerClient, cTor string, isPackage bool) (proposalResponse *peer.ProposalResponse, err error)
InternalInstall install a chaincode
func InternalInvoke ¶
func InternalInvoke(chaincode ChainOpt, mspOpt MSPOpt, args [][]byte, privateData map[string][]byte, channelID string, peers []*client.PeerClient, orderers []*client.OrdererClient, ) (*peer.ProposalResponse, error)
InternalInvoke invoke
func InternalListInstalled ¶
func InternalListInstalled(mspOpt MSPOpt, peers []*client.PeerClient) (*peer.ProposalResponse, error)
InternalListInstalled list installed chaincodes
func InternalListInstantiated ¶
func InternalListInstantiated(channelID string, mspOpt MSPOpt, peers []*client.PeerClient) (*peer.ProposalResponse, error)
InternalListInstantiated list in use chaincodes
func Invoke ¶
func Invoke(chaincode ChainOpt, mspOpt MSPOpt, args [][]byte, privateData map[string][]byte, channelID string, peers []Endpoint, orderers []Endpoint) (*peer.ProposalResponse, error)
Invoke . chaincode just need Path,Name,IsInit, Version, Type peerGrpcOpt Timeout is necessary ordererGrpcOpt Timeout is necessary mspOpt necessary args [][]byte{[]byte("function"),[]byte("a"),[]byte("b")}, first array is function name privateData not necessary, like: map[string][]byte{"cert":[]byte("transient")}, more: https://hyperledger-fabric.readthedocs.io/zh_CN/latest/private_data_tutorial.html channelID necessary channel name peerAddress necessary peer address array ordererAddress necessary orderer address
func Invoke2 ¶
func Invoke2( chaincode ChainOpt, mspOpt MSPOpt, args [][]byte, privateData map[string][]byte, channelID string, peers []EndpointWithPath, orderers []EndpointWithPath, ) (*peer.ProposalResponse, error)
Invoke2 arguments detail function Invoke
func ListInstalled ¶
func ListInstalled(mspOpt MSPOpt, peers []Endpoint) (*peer.ProposalResponse, error)
ListInstalled list installed chaincodes
func ListInstantiated ¶
func ListInstantiated(channelID string, mspOpt MSPOpt, peers []Endpoint) (*peer.ProposalResponse, error)
ListInstantiated list in use chaincodes
func Query ¶
func Query(chaincode ChainOpt, mspOpt MSPOpt, args [][]byte, privateData map[string][]byte, channelID string, peers []Endpoint) (*peer.ProposalResponse, error)
Query query from chaincode chaincode Path,Name,IsInit,Version,Type are necessary peerGrpcOpt Timeout is necessary mspOpt necessary args necessary privateData not necessary channelID necessary peerAddress necessary
func Query2 ¶
func Query2(chaincode ChainOpt, mspOpt MSPOpt, args [][]byte, privateData map[string][]byte, channelID string, peers []EndpointWithPath) (*peer.ProposalResponse, error)
Query2 .
func Upgrade ¶
func Upgrade(channelID string, cTor string, chainOpt ChainOpt, signer msp.SigningIdentity, peerClient client.PeerClient, ordererClients []client.OrdererClient) error
Upgrade update a chaincode
Types ¶
type ChainOpt ¶
type ChainOpt struct { Path string Name string Label string IsInit bool Version string PackageID string Sequence int64 EndorsementPlugin string ValidationPlugin string ValidationParameter []byte Policy string // CollectionConfig string CollectionsConfig []PrivateDataCollectionConfig // 详见: https://hyperledger-fabric.readthedocs.io/en/release-2.2/private_data_tutorial.html Type peer.ChaincodeSpec_Type }
ChainOpt chaincode about options for functions
type DeliverClient ¶
type DeliverClient struct { Client peer.DeliverClient Connection peer.Deliver_DeliverClient Address string }
DeliverClient holds the client/connection related to a specific peer. The address is included for logging purposes
type DeliverGroup ¶
type DeliverGroup struct { Clients []*DeliverClient Certificate tls.Certificate ChannelID string TxID string Signer msp.SigningIdentity Error error // contains filtered or unexported fields }
DeliverGroup holds all of the information needed to connect to a set of peers to wait for the interested txid to be committed to the ledgers of all peers. This functionality is currently implemented via the peer's DeliverFiltered service. An error from any of the peers/deliver clients will result in the invoke command returning an error. Only the first error that occurs will be set
func NewDeliverGroup ¶
func NewDeliverGroup( deliverClients []peer.DeliverClient, signer msp.SigningIdentity, certificate tls.Certificate, channelID string, txid string, ) *DeliverGroup
NewDeliverGroup a set of deliver clients, check the deliver send successful from github.com/hyperledger/fabric/internal/peer/chaincode/common.go:NewDeliverGroup()
func (*DeliverGroup) ClientConnect ¶
func (dg *DeliverGroup) ClientConnect(ctx context.Context, dc *DeliverClient)
ClientConnect sends a deliver seek info envelope using the provided deliver client, setting the deliverGroup's Error field upon any error
func (*DeliverGroup) ClientWait ¶
func (dg *DeliverGroup) ClientWait(dc *DeliverClient)
ClientWait waits for the specified deliver client to receive a block event with the requested txid
func (*DeliverGroup) Connect ¶
func (dg *DeliverGroup) Connect(ctx context.Context) error
Connect waits for all deliver clients in the group to connect to the peer's deliver service, receive an error, or for the context to timeout. An error will be returned whenever even a single deliver client fails to connect to its peer
func (*DeliverGroup) Wait ¶
func (dg *DeliverGroup) Wait(ctx context.Context) error
Wait waits for all deliver client connections in the group to either receive a block with the txid, an error, or for the context to timeout
func (*DeliverGroup) WaitForWG ¶
func (dg *DeliverGroup) WaitForWG(readyCh chan struct{})
WaitForWG waits for the deliverGroup's wait group and closes the channel when ready
type EndorsementPolicy ¶
EndorsementPolicy endorser policy
type Endpoint ¶
type Endpoint struct { Address string GrpcTLSOpt }
Endpoint endpoint, such as: peer and orderer
func ParseEndpointWithPath ¶
func ParseEndpointWithPath(p EndpointWithPath) (Endpoint, error)
ParseEndpointWithPath EndpointWithPath type to Endpoint
func ParseEndpointsWithPath ¶
func ParseEndpointsWithPath(p []EndpointWithPath) ([]Endpoint, error)
ParseEndpointsWithPath EndpointWithPath type array to Endpoint array
type EndpointWithPath ¶
type EndpointWithPath struct { Address string GrpcTLSOptWithPath }
EndpointWithPath endpoint, such as: peer and orderer(cert is path)
type GrpcTLSOpt ¶
type GrpcTLSOpt struct { ClientCrt []byte ClientKey []byte Ca []byte ServerNameOverride string Timeout time.Duration }
GrpcTLSOpt grpc tls opt(cert is []byte)
func ParseGrpcTLSOptWithPath ¶
func ParseGrpcTLSOptWithPath(g GrpcTLSOptWithPath) (gg GrpcTLSOpt, err error)
ParseGrpcTLSOptWithPath GrpcTLSOptWithPath type to GrpcTLSOpt
type GrpcTLSOptWithPath ¶
type GrpcTLSOptWithPath struct { ClientCrtPath string // for client auth req ClientKeyPath string // for client auth req CaPath string // tls ca cert ServerNameOverride string Timeout time.Duration }
GrpcTLSOptWithPath grpc tls opt(cert is path)
type PrivateDataCollectionConfig ¶
type PrivateDataCollectionConfig struct { Name string Policy string RequiredPeerCount int32 MaxPeerCount int32 BlockToLive uint64 MemberOnlyRead bool MemberOnlyWrite bool EndorsementPolicy }
PrivateDataCollectionConfig private data collection config