Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidTxnID = errors.New("transaction ID is invalid for the given nonce")
ErrInvalidTxnID indicates that the transaction ID in the request is invalid
Functions ¶
This section is empty.
Types ¶
type ChaincodeCall ¶
ChaincodeCall ...
type CommitRequest ¶ added in v0.1.4
type CommitRequest struct {
// EndorsementResponse is the response received from an endorsement request
EndorsementResponse *channel.Response
// CommitType specifies how commits should be handled (default CommitOnWrite)
CommitType CommitType
// IgnoreNameSpaces ignore these namespaces in the write set when CommitType is CommitOnWrite
IgnoreNameSpaces []Namespace
// AsyncCommit, if true, indicates that we should NOT wait for a block commit event for the transaction
// before responding. If true, the commit request returns only after reciving a block with the transaction.
AsyncCommit bool
// Handler is a custom invocation handler. If nil then the default handler is used
Handler invoke.Handler
}
CommitRequest contains the endorsements to be committed along with options
type CommitType ¶ added in v0.1.4
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.1.4
func (t CommitType) String() string
String returns the string value of CommitType
type Namespace ¶ added in v0.1.4
Namespace contains a chaincode name and an optional set of private data collections to ignore
type PeerConfig ¶
type PeerConfig interface {
PeerID() string
MSPID() string
PeerAddress() string
MSPConfigPath() string
TLSCertPath() string
}
PeerConfig contains peer configuration
type PeerFilter ¶ added in v0.1.4
PeerFilter is applied to peers selected for endorsement and removes those groups that don't pass the filter acceptance test
type ProposalResponseValidator ¶ added in v0.1.4
type ProposalResponseValidator interface {
Validate(proposal *pb.SignedProposal, proposalResponses []*pb.ProposalResponse) (pb.TxValidationCode, error)
}
ProposalResponseValidator validates proposal responses
type Request ¶
type Request struct {
// ChaincodeID identifies the chaincode to invoke
ChaincodeID string
// Args to pass to the chaincode
Args [][]byte
// TransientData map (optional)
TransientData map[string][]byte
// Targets for the transaction (optional)
Targets []fab.Peer
// InvocationChain contains meta-data that's used by some Selection Service implementations
// to choose endorsers that satisfy the endorsement policies of all chaincodes involved
// in an invocation chain (i.e. for CC-to-CC invocations).
// Each chaincode may also be associated with a set of private data collection names
// which are used by some Selection Services (e.g. Fabric Selection) to exclude endorsers
// that do NOT have read access to the collections.
// The invoked chaincode (specified by ChaincodeID) may optionally be added to the invocation
// chain along with any collections, otherwise it may be omitted.
InvocationChain []*ChaincodeCall
// CommitType specifies how commits should be handled (default CommitOnWrite)
CommitType CommitType
// IgnoreNameSpaces ignore these namespaces in the write set when CommitType is CommitOnWrite
IgnoreNameSpaces []Namespace
// PeerFilter filters out peers using application-specific logic (optional)
PeerFilter PeerFilter
//TransactionID txn id
TransactionID string
//Nonce nonce
Nonce []byte
// AsyncCommit, if true, indicates that we should NOT wait for a block commit event for the transaction
// before responding. If true, the commit request returns only after reciving a block with the transaction.
AsyncCommit bool
// Handler is a custom invocation handler. If nil then the default handler is used
Handler invoke.Handler
}
Request contains the data required for endorsements
type Service ¶
type Service interface {
// Endorse collects endorsements according to chaincode policy
Endorse(req *Request) (resp *channel.Response, err error)
// EndorseAndCommit collects endorsements (according to chaincode policy) and sends the endorsements to the Orderer.
// Returns the response and true if the transaction was committed.
EndorseAndCommit(req *Request) (resp *channel.Response, committed bool, err error)
// CommitEndorsements commits the provided endorsements. First the endorsements are verified for signature and policy,
// and then the endorsements are sent to the Orderer.
CommitEndorsements(req *CommitRequest) (*channel.Response, bool, error)
// SigningIdentity returns the serialized identity of the proposal signer
SigningIdentity() ([]byte, error)
// GetPeer returns the peer for the given endpoint
GetPeer(endpoint string) (fab.Peer, error)
// VerifyProposalSignature verifies that the signed proposal is valid
VerifyProposalSignature(signedProposal *pb.SignedProposal) error
// ValidateProposalResponses validates the given proposal responses
ValidateProposalResponses(signedProposal *pb.SignedProposal, proposalResponses []*pb.ProposalResponse) (pb.TxValidationCode, error)
}
Service provides functions to collect endorsements and send endorsements to the Orderer