Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// EndorseTransaction request endorsement from the peers on this channel
// for a transaction with the given parameters
// @param {EndorseTxRequest} request identifies the chaincode to invoke
// @returns {Response} responses from endorsers
// @returns {error} error, if any
EndorseTransaction(endorseRequest *EndorseTxRequest) (*channel.Response, errors.Error)
// CommitTransaction request commit from the peers on this channel
// for a transaction with the given parameters
// @param {EndorseTxRequest} request identifies the chaincode to invoke
// @param {registerTxEvent} is bool to register tx event
// @param {EndorsedCallback} is a function that is invoked after the endorsement
// @returns {Response} responses from endorsers
// @returns {error} error, if any
CommitTransaction(endorseRequest *EndorseTxRequest, registerTxEvent bool, callback EndorsedCallback) (*channel.Response, errors.Error)
// VerifyTxnProposalSignature verify TxnProposalSignature against msp
// @param {[]byte} Txn Proposal
// @returns {error} error, if any
VerifyTxnProposalSignature([]byte) errors.Error
// GetTargetPeer gets fab api peer for given peer config or opts
// @returns {fabApi.Peer} fab api peer
GetTargetPeer(peerCfg *PeerConfig, opts ...peer.Option) (fabApi.Peer, error)
// GetContext get channel context
// @returns {Channel} channel
GetContext() contextApi.Channel
// GetDiscoveredPeer returns the peer from the Discovery service that matches the given URL
// Returns error if no matching peer is found
GetDiscoveredPeer(url string) (fabApi.Peer, error)
}
Client is a wrapper interface around the fabric client It enables multithreaded access to the client
type ClientService ¶
type ClientService interface {
GetFabricClient(channelID string, config Config) (Client, errors.Error)
}
ClientService interface
type CommitType ¶ added in v0.2.5
type CommitType int
CommitType specifies how commits should be handled
const ( // CommitOnWrite indicates that the transaction should be committed only if // the consumer chaincode produces a write-set CommitOnWrite CommitType = iota // Commit indicates that the transaction should be committed Commit // NoCommit indicates that the transaction should not be committed NoCommit )
func (CommitType) String ¶ added in v0.2.5
func (ct CommitType) String() string
String returns the string value of CommitType
type Config ¶
type Config interface {
GetLocalPeer() (*PeerConfig, errors.Error)
GetMspID() string
GetMspConfigPath() string
GetTLSRootCertPath() string
GetTLSRootCert() *x509.Certificate
GetTLSCertPath() string
GetTLSCert() *x509.Certificate
GetTLSCertPem() []byte
GetTLSKeyPath() string
GetConfigPath(path string) string
GetPeerConfig() *viper.Viper
GetConfigBytes() []byte
GetCryptoProvider() (string, errors.Error)
GetEndorserSelectionMaxAttempts() int
GetEndorserSelectionInterval() time.Duration
RetryOpts() retry.Opts
CCErrorRetryableCodes() ([]int32, errors.Error)
GetClientCacheRefreshInterval() time.Duration
}
Config configuration interface
type EndorseTxRequest ¶ added in v0.1.4
type EndorseTxRequest struct {
// ChaincodeID identifies the chaincode to invoke
ChaincodeID string
// Args to pass to the chaincode. Args[0] is the function name
Args []string
// TransientData map (optional)
TransientData map[string][]byte
// Targets for the transaction (optional)
Targets []fabApi.Peer
// ChaincodeIDs contains all of the chaincodes that should be included
// when evaluating endorsement policy (including the chaincode being invoked).
// If empty then only the invoked chaincode is included. (optional)
ChaincodeIDs []string
// PeerFilter filters out peers using application-specific logic (optional)
PeerFilter PeerFilter
// CommitType specifies how commits should be handled (default CommitOnWrite)
CommitType CommitType
// RWSetIgnoreNameSpace rw set ignore list
RWSetIgnoreNameSpace []Namespace
}
EndorseTxRequest contains the parameters for the EndorseTransaction function
type EndorsedCallback ¶ added in v0.1.11
EndorsedCallback is a function that is invoked after the endorsement phase of CommitTransaction. (Used in unit tests.)
type Namespace ¶ added in v0.2.5
Namespace contains a chaincode name and an optional set of private data collections to ignore
type PeerConfig ¶
PeerConfig represents the server addresses of a fabric peer
type PeerFilter ¶ added in v0.1.4
type PeerFilter interface {
// Accept returns true if the given peer should be included in the set of endorsers
Accept(peer fabApi.Peer) bool
}
PeerFilter is applied to peers selected for endorsement and removes those groups that don't pass the filter acceptance test
type PeerFilterOpts ¶ added in v0.1.4
type PeerFilterOpts struct {
Type PeerFilterType
Args []string
}
PeerFilterOpts specifies the peer filter type and includes any args required by the peer filter
type PeerFilterType ¶ added in v0.1.4
type PeerFilterType string
PeerFilterType is the type name of the Peer Filter
const ( // MinBlockHeightPeerFilterType is a peer filter that selects peers // whose block height is at least the height of the local peer on which // the TxSnap is being invoked. // Required Args: // - arg[0]: Channel ID MinBlockHeightPeerFilterType PeerFilterType = "MinBlockHeight" )
type SnapTransactionRequest ¶
type SnapTransactionRequest struct {
ChannelID string // required channel ID
ChaincodeID string // required chaincode ID
TransientMap map[string][]byte // optional transient Map
EndorserArgs [][]byte // optional args for endorsement
CCIDsForEndorsement []string // optional ccIDs For endorsement selection
RegisterTxEvent bool // optional args for register Tx event (default is false)
PeerFilter *PeerFilterOpts // optional peer filter
CommitType CommitType // optional specifies how commits should be handled (default CommitOnWrite)
RWSetIgnoreNameSpace []Namespace // RWSetIgnoreNameSpace rw set ignore list
}
SnapTransactionRequest type will be passed as argument to a transaction snap ChannelID and ChaincodeID are mandatory fields