endorser

package
v0.0.0-...-fe0f572 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEndorserServer

func NewEndorserServer(privDist privateDataDistributor, s Support) pb.EndorserServer

NewEndorserServer creates and returns a new Endorser server instance.

Types

type Endorser

type Endorser struct {
	// contains filtered or unexported fields
}

Endorser provides the Endorser service ProcessProposal

func (*Endorser) ProcessProposal

func (e *Endorser) ProcessProposal(ctx context.Context, signedProp *pb.SignedProposal) (*pb.ProposalResponse, error)

ProcessProposal process the Proposal

type Support

type Support interface {
	// IsSysCCAndNotInvokableExternal returns true if the supplied chaincode is
	// ia system chaincode and it NOT invokable
	IsSysCCAndNotInvokableExternal(name string) bool

	// GetTxSimulator 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
	GetTxSimulator(ledgername string, txid string) (ledger.TxSimulator, error)

	// GetHistoryQueryExecutor gives handle to a history query executor for the
	// specified ledger
	GetHistoryQueryExecutor(ledgername string) (ledger.HistoryQueryExecutor, error)

	// GetTransactionByID retrieves a transaction by id
	GetTransactionByID(chid, txID string) (*pb.ProcessedTransaction, error)

	//IsSysCC returns true if the name matches a system chaincode's
	//system chaincode names are system, chain wide
	IsSysCC(name string) bool

	//Execute - execute proposal, return original response of chaincode
	Execute(ctxt context.Context, cid, name, version, txid string, syscc bool, signedProp *pb.SignedProposal, prop *pb.Proposal, spec interface{}) (*pb.Response, *pb.ChaincodeEvent, error)

	// GetChaincodeDefinition returns resourcesconfig.ChaincodeDefinition for the chaincode with the supplied name
	GetChaincodeDefinition(ctx context.Context, chainID string, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chaincodeID string, txsim ledger.TxSimulator) (resourcesconfig.ChaincodeDefinition, error)

	//CheckACL checks the ACL for the resource for the channel using the
	//SignedProposal from which an id can be extracted for testing against a policy
	CheckACL(signedProp *pb.SignedProposal, chdr *common.ChannelHeader, shdr *common.SignatureHeader, hdrext *pb.ChaincodeHeaderExtension) error

	// IsJavaCC returns true if the CDS package bytes describe a chaincode
	// that requires the java runtime environment to execute
	IsJavaCC(buf []byte) (bool, error)

	// CheckInstantiationPolicy returns an error if the instantiation in the supplied
	// ChaincodeDefinition differs from the instantiation policy stored on the ledger
	CheckInstantiationPolicy(name, version string, cd resourcesconfig.ChaincodeDefinition) error

	// GetApplicationConfig returns the configtxapplication.SharedConfig for the channel
	// and whether the Application config exists
	GetApplicationConfig(cid string) (channelconfig.Application, bool)
}

Support contains functions that the endorser requires to execute its tasks

type SupportImpl

type SupportImpl struct{}

SupportImpl provides an implementation of the endorser.Support interface issuing calls to various static methods of the peer

func (*SupportImpl) CheckACL

func (s *SupportImpl) CheckACL(signedProp *pb.SignedProposal, chdr *common.ChannelHeader, shdr *common.SignatureHeader, hdrext *pb.ChaincodeHeaderExtension) error

CheckACL checks the ACL for the resource for the channel using the SignedProposal from which an id can be extracted for testing against a policy

func (*SupportImpl) CheckInstantiationPolicy

func (s *SupportImpl) CheckInstantiationPolicy(name, version string, cd resourcesconfig.ChaincodeDefinition) error

CheckInstantiationPolicy returns an error if the instantiation in the supplied ChaincodeDefinition differs from the instantiation policy stored on the ledger

func (*SupportImpl) Execute

func (s *SupportImpl) Execute(ctxt context.Context, cid, name, version, txid string, syscc bool, signedProp *pb.SignedProposal, prop *pb.Proposal, spec interface{}) (*pb.Response, *pb.ChaincodeEvent, error)

Execute - execute proposal, return original response of chaincode

func (*SupportImpl) GetApplicationConfig

func (s *SupportImpl) GetApplicationConfig(cid string) (channelconfig.Application, bool)

GetApplicationConfig returns the configtxapplication.SharedConfig for the channel and whether the Application config exists

func (*SupportImpl) GetChaincodeDefinition

func (s *SupportImpl) GetChaincodeDefinition(ctx context.Context, chainID string, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chaincodeID string, txsim ledger.TxSimulator) (resourcesconfig.ChaincodeDefinition, error)

GetChaincodeDefinition returns resourcesconfig.ChaincodeDefinition for the chaincode with the supplied name

func (*SupportImpl) GetHistoryQueryExecutor

func (s *SupportImpl) GetHistoryQueryExecutor(ledgername string) (ledger.HistoryQueryExecutor, error)

GetHistoryQueryExecutor gives handle to a history query executor for the specified ledger

func (*SupportImpl) GetTransactionByID

func (s *SupportImpl) GetTransactionByID(chid, txID string) (*pb.ProcessedTransaction, error)

GetTransactionByID retrieves a transaction by id

func (*SupportImpl) GetTxSimulator

func (s *SupportImpl) GetTxSimulator(ledgername string, txid string) (ledger.TxSimulator, error)

GetTxSimulator 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

func (*SupportImpl) IsJavaCC

func (s *SupportImpl) IsJavaCC(buf []byte) (bool, error)

IsJavaCC returns true if the CDS package bytes describe a chaincode that requires the java runtime environment to execute

func (*SupportImpl) IsSysCC

func (s *SupportImpl) IsSysCC(name string) bool

IsSysCC returns true if the name matches a system chaincode's system chaincode names are system, chain wide

func (*SupportImpl) IsSysCCAndNotInvokableExternal

func (s *SupportImpl) IsSysCCAndNotInvokableExternal(name string) bool

IsSysCCAndNotInvokableExternal returns true if the supplied chaincode is ia system chaincode and it NOT invokable

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL