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
// @param {EndorseRequestOption} opts allows the user to specify more advanced options
// @returns {Response} responses from endorsers
// @returns {error} error, if any
EndorseTransaction(endorseRequest *EndorseTxRequest, options ...endorse.RequestOption) (*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 {bool} commit flag
// @returns {error} error, if any
CommitTransaction(endorseRequest *EndorseTxRequest, registerTxEvent bool, callback EndorsedCallback) (*channel.Response, bool, errors.Error)
// CommitOnlyTransaction request commit from the peers on this channel
// This does not endorse the request. The endorsement is done before this commit happens.
// for a transaction with the given parameters
// @param {commitType} commit type
// @param {rwSetIgnoreNameSpace} rwSetIgnoreNameSpace
// @param {endorserResponse} endorser response
// @param {registerTxEvent} is bool to register tx event
// @param {EndorsedCallback} is a function that is invoked after the endorsement
// @returns {Response} response
// @returns {bool} commit flag
// @returns {error} error, if any
CommitOnlyTransaction(rwSetIgnoreNameSpace []Namespace, commitType CommitType, endorserResponse *channel.Response, registerTxEvent bool, callback EndorsedCallback) (*channel.Response, bool, errors.Error)
// VerifyTxnProposalSignature verify TxnProposalSignature against msp
// @param {[]byte} Txn Proposal
// @returns {error} error, if any
VerifyTxnProposalSignature([]byte) errors.Error
// InvokeSDKHandler invoke sdk handler
// @param {handler} invoke handler
// @param {request} channel request
// @param {options} channel request option
// @returns {response} channel response
// @returns {error} error, if any
InvokeHandler(handler invoke.Handler, request channel.Request, options ...channel.RequestOption) (*channel.Response, error)
// GetLocalPeer gets the local fab api peer
// @returns {fabApi.Peer} fab api peer
GetLocalPeer() (fabApi.Peer, error)
// ChannelConfig returns the channel configuration
ChannelConfig() (fabApi.ChannelCfg, error)
// EventService returns the event service
EventService() (fabApi.EventService, error)
// 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 ¶
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 Creator ¶ added in v0.2.6
type Creator struct {
// base64 encoded identity of the delegate
Identity string `json:"identity,omitempty"`
}
Creator is received from the delegate when its identity doesn't match the TxID pre-calculated by this handler. It is received as JSON in the proposal response payload.
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
//TransactionID txn id
TransactionID string
//Nonce nonce
Nonce []byte
}
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" // MspIDFilterType is a peer filter that select peer with specific msp id MspIDFilterType PeerFilterType = "MspID" )
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
TransactionID string // TransactionID txn id
Nonce []byte // Nonce nonce
}
SnapTransactionRequest type will be passed as argument to a transaction snap ChannelID and ChaincodeID are mandatory fields
type ValidationRequest ¶ added in v0.4.4
type ValidationRequest struct {
ChannelID string `json:"channelID"`
Proposal []byte `json:"proposal"`
ProposalResponses []byte `json:"proposalResponses"`
}
ValidationRequest holds the info for the validation request