Documentation ¶
Index ¶
- Constants
- type BlockEvent
- type BlockFilter
- type BlockchainInfoResponse
- type CCEvent
- type CertKeyPair
- type CertPool
- type ChaincodeCall
- type ChaincodeInvokeRequest
- type ChannelCfg
- type ChannelConfig
- type ChannelEndpointConfig
- type ChannelMembership
- type ChannelPeer
- type ChannelPolicies
- type ChannelProvider
- type ChannelService
- type ClientContext
- type CommManager
- type ConfigGroupKey
- type ConnectionEvent
- type DiscoveryService
- type EndpointConfig
- type EventClient
- type EventService
- type EventServiceType
- type FilteredBlockEvent
- type InfraProvider
- type LocalDiscoveryProvider
- type NetworkConfig
- type NetworkPeer
- type Orderer
- type OrdererConfig
- type OrgAnchorPeer
- type OrganizationConfig
- type Peer
- type PeerChannelConfig
- type PeerConfig
- type ProcessProposalRequest
- type ProposalProcessor
- type ProposalSender
- type Providers
- type QueryChannelConfigPolicy
- type Registration
- type SelectionService
- type Sender
- type SignedEnvelope
- type TargetFilter
- type TimeoutType
- type Transaction
- type TransactionHeader
- type TransactionID
- type TransactionProposal
- type TransactionProposalResponse
- type TransactionRequest
- type TransactionResponse
- type Transactor
- type TxStatusEvent
- type Versions
Constants ¶
const ( // V1_1Capability indicates that Fabric 1.1 features are supported V1_1Capability = "V1_1" // V1_2Capability indicates that Fabric 1.2 features are supported V1_2Capability = "V1_2" )
const EmptyTransactionID = TransactionID("")
EmptyTransactionID represents a non-existing transaction (usually due to error).
const SystemChannel = ""
SystemChannel is the Fabric channel for managaing resources.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockEvent ¶
type BlockEvent struct { // Block is the block that was committed Block *cb.Block // SourceURL specifies the URL of the peer that produced the event SourceURL string }
BlockEvent contains the data for the block event
type BlockFilter ¶
BlockFilter is a function that determines whether a Block event should be ignored
type BlockchainInfoResponse ¶
type BlockchainInfoResponse struct { BCI *common.BlockchainInfo Endorser string Status int32 }
BlockchainInfoResponse wraps blockchain info with endorser info
type CCEvent ¶
type CCEvent struct { // TxID is the ID of the transaction in which the event was set TxID string // ChaincodeID is the ID of the chaincode that set the event ChaincodeID string // EventName is the name of the chaincode event EventName string // Payload contains the payload of the chaincode event // NOTE: Payload will be nil for filtered events Payload []byte // BlockNumber contains the block number in which the // chaincode event was committed BlockNumber uint64 // SourceURL specifies the URL of the peer that produced the event SourceURL string }
CCEvent contains the data for a chaincode event
type CertKeyPair ¶
CertKeyPair contains the private key and certificate
type CertPool ¶
type CertPool interface { // Get returns the cert pool, optionally adding the provided certs Get(certs ...*x509.Certificate) (*x509.CertPool, error) }
CertPool is a thread safe wrapper around the x509 standard library cert pool implementation.
type ChaincodeCall ¶
ChaincodeCall contains the ID of the chaincode as well as an optional set of private data collections that may be accessed by the chaincode.
type ChaincodeInvokeRequest ¶
type ChaincodeInvokeRequest struct { ChaincodeID string TransientMap map[string][]byte Fcn string Args [][]byte }
ChaincodeInvokeRequest contains the parameters for sending a transaction proposal.
type ChannelCfg ¶
type ChannelCfg interface { ID() string BlockNumber() uint64 MSPs() []*mspCfg.MSPConfig AnchorPeers() []*OrgAnchorPeer Orderers() []string Versions() *Versions HasCapability(group ConfigGroupKey, capability string) bool }
ChannelCfg contains channel configuration
type ChannelConfig ¶
type ChannelConfig interface { // Query channel configuration Query(reqCtx reqContext.Context) (ChannelCfg, error) }
ChannelConfig allows for interaction with peer regarding channel configuration
type ChannelEndpointConfig ¶
type ChannelEndpointConfig struct { // Orderers list of ordering service nodes Orderers []string // Peers a list of peer-channels that are part of this organization // to get the real Peer config object, use the Name field and fetch NetworkConfig.Peers[Name] Peers map[string]PeerChannelConfig //Policies list of policies for channel Policies ChannelPolicies }
ChannelEndpointConfig provides the definition of channels for the network
type ChannelMembership ¶
type ChannelMembership interface { // Validate if the given ID was issued by the channel's members Validate(serializedID []byte) error // Verify the given signature Verify(serializedID []byte, msg []byte, sig []byte) error }
ChannelMembership helps identify a channel's members
type ChannelPeer ¶
type ChannelPeer struct { PeerChannelConfig NetworkPeer }
ChannelPeer combines channel peer info with raw peerConfig info
type ChannelPolicies ¶
type ChannelPolicies struct { //Policy for querying channel block QueryChannelConfig QueryChannelConfigPolicy }
ChannelPolicies defines list of policies defined for a channel
type ChannelProvider ¶
type ChannelProvider interface {
ChannelService(ctx ClientContext, channelID string) (ChannelService, error)
}
ChannelProvider supplies Channel related-objects for the named channel.
type ChannelService ¶
type ChannelService interface { Config() (ChannelConfig, error) EventService(opts ...options.Opt) (EventService, error) Membership() (ChannelMembership, error) ChannelConfig() (ChannelCfg, error) Transactor(reqCtx reqContext.Context) (Transactor, error) Discovery() (DiscoveryService, error) Selection() (SelectionService, error) }
ChannelService supplies services related to a channel.
type ClientContext ¶
ClientContext contains the client context
type CommManager ¶
type CommManager interface { DialContext(ctx reqContext.Context, target string, opts ...grpc.DialOption) (*grpc.ClientConn, error) ReleaseConn(conn *grpc.ClientConn) }
CommManager enables network communication.
type ConfigGroupKey ¶
type ConfigGroupKey string
ConfigGroupKey is the config group key
const ( // ChannelGroupKey is the Channel config group key ChannelGroupKey ConfigGroupKey = "" // OrdererGroupKey is the Orderer config group key OrdererGroupKey ConfigGroupKey = "Orderer" // ApplicationGroupKey is the Application config group key ApplicationGroupKey ConfigGroupKey = "Application" )
type ConnectionEvent ¶
ConnectionEvent is sent when the client disconnects from or reconnects to the event server. Connected == true means that the client has connected, whereas Connected == false means that the client has disconnected. In the disconnected case, Err contains the disconnect error.
type DiscoveryService ¶
DiscoveryService is used to discover eligible peers on specific channel
type EndpointConfig ¶
type EndpointConfig interface { Timeout(TimeoutType) time.Duration OrderersConfig() []OrdererConfig OrdererConfig(nameOrURL string) (*OrdererConfig, bool) PeersConfig(org string) ([]PeerConfig, bool) PeerConfig(nameOrURL string) (*PeerConfig, bool) NetworkConfig() *NetworkConfig NetworkPeers() []NetworkPeer ChannelConfig(name string) (*ChannelEndpointConfig, bool) ChannelPeers(name string) ([]ChannelPeer, bool) ChannelOrderers(name string) ([]OrdererConfig, bool) TLSCACertPool() CertPool EventServiceType() EventServiceType TLSClientCerts() []tls.Certificate CryptoConfigPath() string }
EndpointConfig contains endpoint network configurations
type EventClient ¶
type EventClient interface { EventService // Connect connects to the event server. Connect() error // Close closes the connection to the event server and releases all resources. // Once this function is invoked the client may no longer be used. Close() // CloseIfIdle closes the connection to the event server only if there are no outstanding // registrations. // Returns true if the client was closed. In this case the client may no longer be used. // A return value of false indicates that the client could not be closed since // there was at least one registration. CloseIfIdle() bool }
EventClient is a client that connects to a peer and receives channel events such as block, filtered block, chaincode, and transaction status events.
type EventService ¶
type EventService interface { // RegisterBlockEvent registers for block events. If the caller does not have permission // to register for block events then an error is returned. // Note that Unregister must be called when the registration is no longer needed. // - filter is an optional filter that filters out unwanted events. (Note: Only one filter may be specified.) // - Returns the registration and a channel that is used to receive events. The channel // is closed when Unregister is called. RegisterBlockEvent(filter ...BlockFilter) (Registration, <-chan *BlockEvent, error) // RegisterFilteredBlockEvent registers for filtered block events. // Note that Unregister must be called when the registration is no longer needed. // - Returns the registration and a channel that is used to receive events. The channel // is closed when Unregister is called. RegisterFilteredBlockEvent() (Registration, <-chan *FilteredBlockEvent, error) // RegisterChaincodeEvent registers for chaincode events. // Note that Unregister must be called when the registration is no longer needed. // - ccID is the chaincode ID for which events are to be received // - eventFilter is the chaincode event filter (regular expression) for which events are to be received // - Returns the registration and a channel that is used to receive events. The channel // is closed when Unregister is called. RegisterChaincodeEvent(ccID, eventFilter string) (Registration, <-chan *CCEvent, error) // RegisterTxStatusEvent registers for transaction status events. // Note that Unregister must be called when the registration is no longer needed. // - txID is the transaction ID for which events are to be received // - Returns the registration and a channel that is used to receive events. The channel // is closed when Unregister is called. RegisterTxStatusEvent(txID string) (Registration, <-chan *TxStatusEvent, error) // Unregister removes the given registration and closes the event channel. // - reg is the registration handle that was returned from one of the Register functions Unregister(reg Registration) }
EventService is a service that receives events such as block, filtered block, chaincode, and transaction status events.
type EventServiceType ¶
type EventServiceType int
EventServiceType specifies the type of event service to use
const ( // AutoDetectEventServiceType uses channel capabilities to determine which event service to use AutoDetectEventServiceType EventServiceType = iota // DeliverEventServiceType uses the Deliver Service for block and filtered-block events DeliverEventServiceType // EventHubEventServiceType uses the Event Hub for block events EventHubEventServiceType )
type FilteredBlockEvent ¶
type FilteredBlockEvent struct { // FilteredBlock contains a filtered version of the block that was committed FilteredBlock *pb.FilteredBlock // SourceURL specifies the URL of the peer that produced the event SourceURL string }
FilteredBlockEvent contains the data for a filtered block event
type InfraProvider ¶
type InfraProvider interface { CreatePeerFromConfig(peerCfg *NetworkPeer) (Peer, error) CreateOrdererFromConfig(cfg *OrdererConfig) (Orderer, error) CommManager() CommManager Close() }
InfraProvider enables access to fabric objects such as peer and user based on config or
type LocalDiscoveryProvider ¶
type LocalDiscoveryProvider interface {
CreateLocalDiscoveryService(mspID string) (DiscoveryService, error)
}
LocalDiscoveryProvider is used to discover peers in the local MSP
type NetworkConfig ¶
type NetworkConfig struct { Channels map[string]ChannelEndpointConfig Organizations map[string]OrganizationConfig Orderers map[string]OrdererConfig Peers map[string]PeerConfig }
NetworkConfig provides a static definition of endpoint configuration network
type NetworkPeer ¶
type NetworkPeer struct { PeerConfig MSPID string }
NetworkPeer combines peer info with MSP info
type Orderer ¶
type Orderer interface { URL() string SendBroadcast(ctx reqContext.Context, envelope *SignedEnvelope) (*common.Status, error) SendDeliver(ctx reqContext.Context, envelope *SignedEnvelope) (chan *common.Block, chan error) }
Orderer The Orderer class represents a peer in the target blockchain network to which HFC sends a block of transactions of endorsed proposals requiring ordering.
type OrdererConfig ¶
type OrdererConfig struct { URL string GRPCOptions map[string]interface{} TLSCACert *x509.Certificate }
OrdererConfig defines an orderer configuration
type OrgAnchorPeer ¶
OrgAnchorPeer contains information about an anchor peer on this channel
type OrganizationConfig ¶
type OrganizationConfig struct { MSPID string CryptoPath string Users map[string]CertKeyPair Peers []string CertificateAuthorities []string }
OrganizationConfig provides the definition of an organization in the network
type Peer ¶
type Peer interface { ProposalProcessor // MSPID gets the Peer mspID. MSPID() string //URL gets the peer address URL() string }
The Peer class represents a peer in the target blockchain network to which HFC sends endorsement proposals or query requests.
type PeerChannelConfig ¶
type PeerChannelConfig struct { EndorsingPeer bool ChaincodeQuery bool LedgerQuery bool EventSource bool }
PeerChannelConfig defines the peer capabilities
type PeerConfig ¶
type PeerConfig struct { URL string EventURL string GRPCOptions map[string]interface{} TLSCACert *x509.Certificate }
PeerConfig defines a peer configuration
type ProcessProposalRequest ¶
type ProcessProposalRequest struct {
SignedProposal *pb.SignedProposal
}
ProcessProposalRequest requests simulation of a proposed transaction from transaction processors.
type ProposalProcessor ¶
type ProposalProcessor interface {
ProcessTransactionProposal(reqContext.Context, ProcessProposalRequest) (*TransactionProposalResponse, error)
}
ProposalProcessor simulates transaction proposal, so that a client can submit the result for ordering.
type ProposalSender ¶
type ProposalSender interface { CreateTransactionHeader() (TransactionHeader, error) SendTransactionProposal(*TransactionProposal, []ProposalProcessor) ([]*TransactionProposalResponse, error) }
ProposalSender provides the ability for a transaction proposal to be created and sent.
type Providers ¶
type Providers interface { LocalDiscoveryProvider() LocalDiscoveryProvider ChannelProvider() ChannelProvider InfraProvider() InfraProvider EndpointConfig() EndpointConfig }
Providers represents the SDK configured service providers context.
type QueryChannelConfigPolicy ¶
QueryChannelConfigPolicy defines opts for channelConfigBlock
type Registration ¶
type Registration interface{}
Registration is a handle that is returned from a successful RegisterXXXEvent. This handle should be used in Unregister in order to unregister the event.
type SelectionService ¶
type SelectionService interface { // GetEndorsersForChaincode returns a set of peers that should satisfy the endorsement // policies of all of the given chaincodes. // A set of options may be provided to the selection service. Note that the type of options // may vary depending on the specific selection service implementation. GetEndorsersForChaincode(chaincodes []*ChaincodeCall, opts ...options.Opt) ([]Peer, error) }
SelectionService selects peers for endorsement and commit events
type Sender ¶
type Sender interface { CreateTransaction(request TransactionRequest) (*Transaction, error) SendTransaction(tx *Transaction) (*TransactionResponse, error) }
Sender provides the ability for a transaction to be created and sent.
TODO: CreateTransaction should be refactored as it is actually a factory method.
type SignedEnvelope ¶
A SignedEnvelope can can be sent to an orderer for broadcasting
type TargetFilter ¶
type TargetFilter interface { // Accept returns true if peer should be included in the list of target peers Accept(peer Peer) bool }
TargetFilter allows for filtering target peers
type TimeoutType ¶
type TimeoutType int
TimeoutType enumerates the different types of outgoing connections
const ( // EndorserConnection connection timeout EndorserConnection TimeoutType = iota // EventHubConnection connection timeout EventHubConnection // EventReg connection timeout EventReg // Query timeout Query // Execute timeout Execute // OrdererConnection orderer connection timeout OrdererConnection // OrdererResponse orderer response timeout OrdererResponse // DiscoveryGreylistExpiry discovery Greylist expiration period DiscoveryGreylistExpiry // ConnectionIdle is the timeout for closing idle connections ConnectionIdle // CacheSweepInterval is the duration between cache sweeps CacheSweepInterval // EventServiceIdle is the timeout for closing the event service connection EventServiceIdle // PeerResponse peer response timeout PeerResponse // ResMgmt timeout is default overall timeout for all resource management operations ResMgmt // ChannelConfigRefresh channel configuration refresh interval ChannelConfigRefresh // ChannelMembershipRefresh channel membership refresh interval ChannelMembershipRefresh // DiscoveryConnection discovery connection timeout DiscoveryConnection // DiscoveryResponse discovery response timeout DiscoveryResponse // DiscoveryServiceRefresh discovery service refresh interval DiscoveryServiceRefresh // SelectionServiceRefresh selection service refresh interval SelectionServiceRefresh )
type Transaction ¶
type Transaction struct { Proposal *TransactionProposal Transaction *pb.Transaction }
The Transaction object created from an endorsed proposal.
type TransactionHeader ¶
type TransactionHeader interface { TransactionID() TransactionID Creator() []byte Nonce() []byte ChannelID() string }
TransactionHeader provides a handle to transaction metadata.
type TransactionID ¶
type TransactionID string
TransactionID provides the identifier of a Fabric transaction proposal.
type TransactionProposal ¶
type TransactionProposal struct { TxnID TransactionID *pb.Proposal }
TransactionProposal contains a marashalled transaction proposal.
type TransactionProposalResponse ¶
type TransactionProposalResponse struct { Endorser string // Status is the EndorserStatus Status int32 // ChaincodeStatus is the status returned by Chaincode ChaincodeStatus int32 *pb.ProposalResponse }
TransactionProposalResponse respresents the result of transaction proposal processing.
type TransactionRequest ¶
type TransactionRequest struct { Proposal *TransactionProposal ProposalResponses []*TransactionProposalResponse }
TransactionRequest holds endorsed Transaction Proposals.
type TransactionResponse ¶
type TransactionResponse struct {
Orderer string
}
TransactionResponse contains information returned by the orderer.
type Transactor ¶
type Transactor interface { Sender ProposalSender }
Transactor supplies methods for sending transaction proposals and transactions.
type TxStatusEvent ¶
type TxStatusEvent struct { // TxID is the ID of the transaction in which the event was set TxID string // TxValidationCode is the status code of the commit TxValidationCode pb.TxValidationCode // BlockNumber contains the block number in which the // transaction was committed BlockNumber uint64 // SourceURL specifies the URL of the peer that produced the event SourceURL string }
TxStatusEvent contains the data for a transaction status event
type Versions ¶
type Versions struct { ReadSet *common.ConfigGroup WriteSet *common.ConfigGroup Channel *common.ConfigGroup }
Versions ...