plugindispatcher

package
v2.0.0-alpha+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(chainID string, cr ChannelResources, ler LedgerResources, lcr LifecycleResources, pluginValidator *PluginValidator) *dispatcherImpl

New creates new plugin dispatcher

Types

type ChannelResources

type ChannelResources interface {
	// GetMSPIDs returns the IDs for the application MSPs
	// that have been defined in the channel
	GetMSPIDs(cid string) []string
}

ChannelResources provides access to channel artefacts or functions to interact with them

type CollectionAndLifecycleResources

type CollectionAndLifecycleResources interface {
	LifecycleResources

	// CollectionValidationInfo is exactly like the method defined in CollectionResources but
	// also takes the channel ID.  This is necessary to determine if the org collection names are valid.
	CollectionValidationInfo(channelID, chaincodeName, collectionName string, state s.State) (args []byte, unexpectedErr error, validationErr error)
}

CollectionAndLifecycleResources provides access to resources about chaincodes and their lifecycle and collections and their policies

type CollectionResources

type CollectionResources interface {
	// CollectionValidationInfo returns collection-level endorsement policy for the supplied chaincode.
	// The function returns two types of errors, unexpected errors and validation errors. The
	// reason for this is that this function is to be called from the validation code, which
	// needs to tell apart the two types of error to halt processing on the channel if the
	// unexpected error is not nil and mark the transaction as invalid if the validation error
	// is not nil.
	CollectionValidationInfo(chaincodeName, collectionName string, state s.State) (args []byte, unexpectedErr error, validationErr error)
}

CollectionResources provides access to collection artefacts

type Context

type Context struct {
	Seq        int
	Envelope   []byte
	TxID       string
	Channel    string
	PluginName string
	Policy     []byte
	Namespace  string
	Block      *common.Block
}

Context defines information about a transaction that is being validated

func (Context) String

func (c Context) String() string

String returns a string representation of this Context

type LedgerResources

type LedgerResources interface {
	// NewQueryExecutor gives handle to a query executor.
	// A client can obtain more than one 'QueryExecutor's for parallel execution.
	// Any synchronization should be performed at the implementation level if required
	NewQueryExecutor() (ledger.QueryExecutor, error)
}

LedgerResources provides access to ledger artefacts or functions to interact with them

type LifecycleResources

type LifecycleResources interface {
	// ValidationInfo returns the name and arguments of the validation plugin for the supplied
	// chaincode. The function returns two types of errors, unexpected errors and validation
	// errors. The reason for this is that this function is called from the validation code,
	// which needs to differentiate the two types of error to halt processing on the channel
	// if the unexpected error is not nil and mark the transaction as invalid if the validation
	// error is not nil.
	ValidationInfo(channelID, chaincodeName string, qe ledger.SimpleQueryExecutor) (plugin string, args []byte, unexpectedErr error, validationErr error)
}

LifecycleResources provides access to chaincode lifecycle artefacts or functions to interact with them

type PluginValidator

type PluginValidator struct {
	sync.Mutex

	vp.Mapper
	QueryExecutorCreator
	msp.IdentityDeserializer

	policies.ChannelPolicyManagerGetter
	CollectionResources
	// contains filtered or unexported fields
}

PluginValidator values transactions with validation plugins

func NewPluginValidator

func NewPluginValidator(pm vp.Mapper, qec QueryExecutorCreator, deserializer msp.IdentityDeserializer, capabilities Capabilities, cpmg policies.ChannelPolicyManagerGetter, cor CollectionResources) *PluginValidator

NewPluginValidator creates a new PluginValidator

func (*PluginValidator) ValidateWithPlugin

func (pv *PluginValidator) ValidateWithPlugin(ctx *Context) error

type PolicyEvaluatorWrapper

type PolicyEvaluatorWrapper struct {
	msp.IdentityDeserializer
	p.PolicyEvaluator
}

func (*PolicyEvaluatorWrapper) DeserializeIdentity

func (id *PolicyEvaluatorWrapper) DeserializeIdentity(serializedIdentity []byte) (Identity, error)

DeserializeIdentity unmarshals the given identity to msp.Identity

func (*PolicyEvaluatorWrapper) Evaluate

func (id *PolicyEvaluatorWrapper) Evaluate(policyBytes []byte, signatureSet []*protoutil.SignedData) error

Evaluate takes a set of SignedData and evaluates whether this set of signatures satisfies the policy

type QueryExecutorCreator

type QueryExecutorCreator interface {
	NewQueryExecutor() (ledger.QueryExecutor, error)
}

QueryExecutorCreator creates new query executors

type ResultsIteratorImpl

type ResultsIteratorImpl struct {
	ledger2.ResultsIterator
}

func (*ResultsIteratorImpl) Next

func (it *ResultsIteratorImpl) Next() (QueryResult, error)

type StateFetcherImpl

type StateFetcherImpl struct {
	QueryExecutorCreator
}

func (*StateFetcherImpl) FetchState

func (sf *StateFetcherImpl) FetchState() (State, error)

type StateImpl

type StateImpl struct {
	ledger.QueryExecutor
}

func (*StateImpl) GetStateRangeScanIterator

func (s *StateImpl) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (ResultsIterator, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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