{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package endorser\n\n## Types\n\n```go\ntype ChannelState struct {\n\ttransientstore.Store\n\tQueryCreator\n}\n```\nChannelState defines state operations\n\n```go\nfunc (cs *ChannelState) FetchState() (endorsement.State, error)\n```\nFetchState fetches state\n\n```go\ntype ChannelStateRetriever interface {\n\t// NewQueryCreator returns a QueryCreator for the given Channel\n\tNewQueryCreator(channel string) (QueryCreator, error)\n}\n```\nChannelStateRetriever retrieves Channel state\n\n```go\ntype CollectionConfigRetriever interface {\n\t// GetState gets the value for given namespace and key. For a chaincode, the namespace corresponds to the chaincodeId\n\tGetState(namespace string, key string) ([]byte, error)\n}\n```\nCollectionConfigRetriever encapsulates sub-functionality of ledger.TxSimulator to abstract minimum required functions set\n\n```go\ntype Context struct {\n\tPluginName     string\n\tChannel        string\n\tTxID           string\n\tProposal       *pb.Proposal\n\tSignedProposal *pb.SignedProposal\n\tVisibility     []byte\n\tResponse       *pb.Response\n\tEvent          []byte\n\tChaincodeID    *pb.ChaincodeID\n\tSimRes         []byte\n}\n```\nContext defines the data that is related to an in-flight endorsement\n\n```go\nfunc (c Context) String() string\n```\nString returns a text representation of this context\n\n```go\ntype Endorser struct {\n\tPlatformRegistry *platforms.Registry\n\tPvtRWSetAssembler\n\tMetrics *EndorserMetrics\n\t// contains filtered or unexported fields\n}\n```\nEndorser provides the Endorser service ProcessProposal\n\n```go\nfunc NewEndorserServer(privDist privateDataDistributor, s Support, pr *platforms.Registry, metricsProv metrics.Provider) *Endorser\n```\nNewEndorserServer creates and returns a new Endorser server instance.\n\n```go\nfunc (e *Endorser) ProcessProposal(ctx context.Context, signedProp *pb.SignedProposal) (*pb.ProposalResponse, error)\n```\nProcessProposal process the Proposal\n\n```go\nfunc (e *Endorser) SanitizeUserCDS(userCDS *pb.ChaincodeDeploymentSpec) (*pb.ChaincodeDeploymentSpec, error)\n```\n\n```go\nfunc (e *Endorser) SimulateProposal(txParams *ccprovider.TransactionParams, cid *pb.ChaincodeID) (ccprovider.ChaincodeDefinition, *pb.Response, []byte, *pb.ChaincodeEvent, error)\n```\nSimulateProposal simulates the proposal by calling the chaincode\n\n```go\ntype EndorserMetrics struct {\n\tProposalDuration         metrics.Histogram\n\tProposalsReceived        metrics.Counter\n\tSuccessfulProposals      metrics.Counter\n\tProposalValidationFailed metrics.Counter\n\tProposalACLCheckFailed   metrics.Counter\n\tInitFailed               metrics.Counter\n\tEndorsementsFailed       metrics.Counter\n\tDuplicateTxsFailure      metrics.Counter\n}\n```\n\n```go\nfunc NewEndorserMetrics(p metrics.Provider) *EndorserMetrics\n```\n\n```go\ntype MapBasedPluginMapper map[string]endorsement.PluginFactory\n```\nMapBasedPluginMapper maps plugin names to their corresponding factories\n\n```go\nfunc (m MapBasedPluginMapper) PluginFactoryByName(name PluginName) endorsement.PluginFactory\n```\nPluginFactoryByName returns a plugin factory for the given plugin name, or nil if not found\n\n```go\ntype PluginEndorser struct {\n\tsync.Mutex\n\tPluginMapper\n\n\tChannelStateRetriever\n\tendorsement3.SigningIdentityFetcher\n\tTransientStoreRetriever\n\t// contains filtered or unexported fields\n}\n```\nPluginEndorser endorsers proposal responses using plugins\n\n```go\nfunc NewPluginEndorser(ps *PluginSupport) *PluginEndorser\n```\nNewPluginEndorser endorses with using a plugin\n\n```go\nfunc (pe *PluginEndorser) EndorseWithPlugin(ctx Context) (*pb.ProposalResponse, error)\n```\nEndorseWithPlugin endorses the response with a plugin\n\n```go\ntype PluginMapper interface {\n\tPluginFactoryByName(name PluginName) endorsement.PluginFactory\n}\n```\nPluginMapper maps plugin names to their corresponding factories\n\n```go\ntype PluginName string\n```\nPluginName defines the name of the plugin as it appears in the configuration\n\n```go\ntype PluginSupport struct {\n\tChannelStateRetriever\n\tendorsement3.SigningIdentityFetcher\n\tPluginMapper\n\tTransientStoreRetriever\n}\n```\nPluginSupport aggregates the support interfaces needed for the operation of the plugin endorser\n\n```go\ntype PvtRWSetAssembler interface {\n\t// AssemblePvtRWSet prepares TxPvtReadWriteSet for distribution\n\t// augmenting it into TxPvtReadWriteSetWithConfigInfo adding\n\t// information about collections config available related\n\t// to private read-write set\n\tAssemblePvtRWSet(privData *rwset.TxPvtReadWriteSet, txsim CollectionConfigRetriever) (*transientstore.TxPvtReadWriteSetWithConfigInfo, error)\n}\n```\nPvtRWSetAssembler assembles private read write set for distribution augments with additional information if needed\n\n```go\ntype QueryCreator interface {\n\tNewQueryExecutor() (ledger.QueryExecutor, error)\n}\n```\nQueryCreator creates new QueryExecutors\n\n```go\ntype StateContext struct {\n\ttransientstore.Store\n\tledger.QueryExecutor\n}\n```\nStateContext defines an execution context that interacts with the state\n\n```go\nfunc (sc *StateContext) GetTransientByTXID(txID string) ([]*rwset.TxPvtReadWriteSet, error)\n```\nGetTransientByTXID returns the private data associated with this transaction ID.\n\n```go\ntype Support interface {\n\tcrypto.SignerSupport\n\t// IsSysCCAndNotInvokableExternal returns true if the supplied chaincode is\n\t// a system chaincode and it NOT invokable\n\tIsSysCCAndNotInvokableExternal(name string) bool\n\n\t// GetTxSimulator returns the transaction simulator for the specified ledger\n\t// a client may obtain more than one such simulator; they are made unique\n\t// by way of the supplied txid\n\tGetTxSimulator(ledgername string, txid string) (ledger.TxSimulator, error)\n\n\t// GetHistoryQueryExecutor gives handle to a history query executor for the\n\t// specified ledger\n\tGetHistoryQueryExecutor(ledgername string) (ledger.HistoryQueryExecutor, error)\n\n\t// GetTransactionByID retrieves a transaction by id\n\tGetTransactionByID(chid, txID string) (*pb.ProcessedTransaction, error)\n\n\t// IsSysCC returns true if the name matches a system chaincode's\n\t// system chaincode names are system, chain wide\n\tIsSysCC(name string) bool\n\n\t// Execute - execute proposal, return original response of chaincode\n\tExecute(txParams *ccprovider.TransactionParams, cid, name, version, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, input *pb.ChaincodeInput) (*pb.Response, *pb.ChaincodeEvent, error)\n\n\t// ExecuteLegacyInit - executes a deployment proposal, return original response of chaincode\n\tExecuteLegacyInit(txParams *ccprovider.TransactionParams, cid, name, version, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, spec *pb.ChaincodeDeploymentSpec) (*pb.Response, *pb.ChaincodeEvent, error)\n\n\t// GetChaincodeDefinition returns ccprovider.ChaincodeDefinition for the chaincode with the supplied name\n\tGetChaincodeDefinition(chaincodeID string, txsim ledger.QueryExecutor) (ccprovider.ChaincodeDefinition, error)\n\n\t// CheckACL checks the ACL for the resource for the channel using the\n\t// SignedProposal from which an id can be extracted for testing against a policy\n\tCheckACL(signedProp *pb.SignedProposal, chdr *common.ChannelHeader, shdr *common.SignatureHeader, hdrext *pb.ChaincodeHeaderExtension) error\n\n\t// IsJavaCC returns true if the CDS package bytes describe a chaincode\n\t// that requires the java runtime environment to execute\n\tIsJavaCC(buf []byte) (bool, error)\n\n\t// CheckInstantiationPolicy returns an error if the instantiation in the supplied\n\t// ChaincodeDefinition differs from the instantiation policy stored on the ledger\n\tCheckInstantiationPolicy(name, version string, cd ccprovider.ChaincodeDefinition) error\n\n\t// GetChaincodeDeploymentSpecFS returns the deploymentspec for a chaincode from the fs\n\tGetChaincodeDeploymentSpecFS(cds *pb.ChaincodeDeploymentSpec) (*pb.ChaincodeDeploymentSpec, error)\n\n\t// GetApplicationConfig returns the configtxapplication.SharedConfig for the Channel\n\t// and whether the Application config exists\n\tGetApplicationConfig(cid string) (channelconfig.Application, bool)\n\n\t// NewQueryCreator creates a new QueryCreator\n\tNewQueryCreator(channel string) (QueryCreator, error)\n\n\t// EndorseWithPlugin endorses the response with a plugin\n\tEndorseWithPlugin(ctx Context) (*pb.ProposalResponse, error)\n\n\t// GetLedgerHeight returns ledger height for given channelID\n\tGetLedgerHeight(channelID string) (uint64, error)\n}\n```\nSupport contains functions that the endorser requires to execute its tasks\n\n```go\ntype SupportImpl struct {\n\t*PluginEndorser\n\tcrypto.SignerSupport\n\tPeer             peer.Operations\n\tPeerSupport      peer.Support\n\tChaincodeSupport *chaincode.ChaincodeSupport\n\tSysCCProvider    *scc.Provider\n\tACLProvider      aclmgmt.ACLProvider\n}\n```\nSupportImpl provides an implementation of the endorser.Support interface issuing calls to various static methods of the peer\n\n```go\nfunc (s *SupportImpl) CheckACL(signedProp *pb.SignedProposal, chdr *common.ChannelHeader, shdr *common.SignatureHeader, hdrext *pb.ChaincodeHeaderExtension) error\n```\nCheckACL checks the ACL for the resource for the Channel using the SignedProposal from which an id can be extracted for testing against a policy\n\n```go\nfunc (s *SupportImpl) CheckInstantiationPolicy(name, version string, cd ccprovider.ChaincodeDefinition) error\n```\nCheckInstantiationPolicy returns an error if the instantiation in the supplied ChaincodeDefinition differs from the instantiation policy stored on the ledger\n\n```go\nfunc (s *SupportImpl) Execute(txParams *ccprovider.TransactionParams, cid, name, version, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, input *pb.ChaincodeInput) (*pb.Response, *pb.ChaincodeEvent, error)\n```\nExecute a proposal and return the chaincode response\n\n```go\nfunc (s *SupportImpl) ExecuteLegacyInit(txParams *ccprovider.TransactionParams, cid, name, version, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, cds *pb.ChaincodeDeploymentSpec) (*pb.Response, *pb.ChaincodeEvent, error)\n```\nExecuteInit a deployment proposal and return the chaincode response\n\n```go\nfunc (s *SupportImpl) GetApplicationConfig(cid string) (channelconfig.Application, bool)\n```\nGetApplicationConfig returns the configtxapplication.SharedConfig for the Channel and whether the Application config exists\n\n```go\nfunc (s *SupportImpl) GetChaincodeDefinition(chaincodeName string, txsim ledger.QueryExecutor) (ccprovider.ChaincodeDefinition, error)\n```\nGetChaincodeDefinition returns ccprovider.ChaincodeDefinition for the chaincode with the supplied name\n\n```go\nfunc (s *SupportImpl) GetChaincodeDeploymentSpecFS(cds *pb.ChaincodeDeploymentSpec) (*pb.ChaincodeDeploymentSpec, error)\n```\nGetChaincode returns the CCPackage from the fs\n\n```go\nfunc (s *SupportImpl) GetHistoryQueryExecutor(ledgername string) (ledger.HistoryQueryExecutor, error)\n```\nGetHistoryQueryExecutor gives handle to a history query executor for the specified ledger\n\n```go\nfunc (s *SupportImpl) GetLedgerHeight(channelID string) (uint64, error)\n```\nGetLedgerHeight returns ledger height for given channelID\n\n```go\nfunc (s *SupportImpl) GetTransactionByID(chid, txID string) (*pb.ProcessedTransaction, error)\n```\nGetTransactionByID retrieves a transaction by id\n\n```go\nfunc (s *SupportImpl) GetTxSimulator(ledgername string, txid string) (ledger.TxSimulator, error)\n```\nGetTxSimulator returns the transaction simulator for the specified ledger a client may obtain more than one such simulator; they are made unique by way of the supplied txid\n\n```go\nfunc (s *SupportImpl) IsJavaCC(buf []byte) (bool, error)\n```\nIsJavaCC returns true if the CDS package bytes describe a chaincode that requires the java runtime environment to execute\n\n```go\nfunc (s *SupportImpl) IsSysCC(name string) bool\n```\nIsSysCC returns true if the name matches a system chaincode's system chaincode names are system, chain wide\n\n```go\nfunc (s *SupportImpl) IsSysCCAndNotInvokableExternal(name string) bool\n```\nIsSysCCAndNotInvokableExternal returns true if the supplied chaincode is ia system chaincode and it NOT invokable\n\n```go\nfunc (s *SupportImpl) NewQueryCreator(channel string) (QueryCreator, error)\n```\n\n```go\nfunc (s *SupportImpl) SigningIdentityForRequest(*pb.SignedProposal) (SigningIdentity, error)\n```\n\n```go\ntype TransientStoreRetriever interface {\n\t// StoreForChannel returns the transient store for the given channel\n\tStoreForChannel(channel string) transientstore.Store\n}\n```\nTransientStoreRetriever retrieves transient stores\n\n","path":"github.com/eric-erki/https-hyperledger.org/core/endorser","name":"endorser","synopsis":"","isRedistributable":true}
