endorser

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2018 License: Apache-2.0 Imports: 23 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

func (*Endorser) SanitizeUserCDS added in v1.1.1

func (e *Endorser) SanitizeUserCDS(userCDS *pb.ChaincodeDeploymentSpec) (*pb.ChaincodeDeploymentSpec, error)

type Support added in v1.1.0

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

	// GetChaincodeDeploymentSpecFS returns the deploymentspec for a chaincode from the fs
	GetChaincodeDeploymentSpecFS(cds *pb.ChaincodeDeploymentSpec) (*pb.ChaincodeDeploymentSpec, 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 added in v1.1.0

type SupportImpl struct{}

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

func (*SupportImpl) CheckACL added in v1.1.0

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 added in v1.1.0

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 added in v1.1.0

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 added in v1.1.0

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 added in v1.1.0

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) GetChaincodeDeploymentSpecFS added in v1.1.1

func (s *SupportImpl) GetChaincodeDeploymentSpecFS(cds *pb.ChaincodeDeploymentSpec) (*pb.ChaincodeDeploymentSpec, error)

GetChaincode returns the CCPackage from the fs

func (*SupportImpl) GetHistoryQueryExecutor added in v1.1.0

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

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

func (*SupportImpl) GetTransactionByID added in v1.1.0

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

GetTransactionByID retrieves a transaction by id

func (*SupportImpl) GetTxSimulator added in v1.1.0

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 added in v1.1.0

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 added in v1.1.0

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 added in v1.1.0

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

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

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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