Documentation
¶
Index ¶
- func New(chainID string, cr ChannelResources, ler LedgerResources, ...) *dispatcherImpl
- type Capabilities
- type ChannelPolicyManagerGetter
- type ChannelResources
- type CollectionAndLifecycleResources
- type CollectionResources
- type Context
- type IdentityDeserializer
- type LedgerResources
- type LifecycleResources
- type Mapper
- type Plugin
- type PluginFactory
- type PluginValidator
- type PolicyEvaluatorWrapper
- type PolicyManager
- type QueryExecutorCreator
- type ResultsIteratorImpl
- type StateFetcherImpl
- type StateImpl
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 Capabilities ¶
type Capabilities interface {
vc.Capabilities
}
Capabilities is the local interface that used to generate mocks for foreign interface.
type ChannelPolicyManagerGetter ¶
type ChannelPolicyManagerGetter interface {
policies.ChannelPolicyManagerGetter
}
ChannelPolicyManagerGetter is the local interface that used to generate mocks for foreign interface.
type ChannelResources ¶
type ChannelResources interface {
// GetMSPIDs returns the IDs for the application MSPs
// that have been defined in the channel
GetMSPIDs() []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.
type IdentityDeserializer ¶
type IdentityDeserializer interface {
msp.IdentityDeserializer
}
IdentityDeserializer is the local interface that used to generate mocks for foreign interface.
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 Mapper ¶
type Mapper interface {
txvalidatorplugin.Mapper
}
Mapper is the local interface that used to generate mocks for foreign interface.
type Plugin ¶
type Plugin interface {
validation.Plugin
}
Plugin is the local interface that used to generate mocks for foreign interface.
type PluginFactory ¶
type PluginFactory interface {
validation.PluginFactory
}
PluginFactory is the local interface that used to generate mocks for foreign interface.
type PluginValidator ¶
type PluginValidator struct {
sync.Mutex
txvalidatorplugin.Mapper
QueryExecutorCreator
msp.IdentityDeserializer
policies.ChannelPolicyManagerGetter
CollectionResources
// contains filtered or unexported fields
}
PluginValidator values transactions with validation plugins.
func NewPluginValidator ¶
func NewPluginValidator(pm txvalidatorplugin.Mapper, qec QueryExecutorCreator, deserializer msp.IdentityDeserializer, capabilities vc.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
vp.PolicyEvaluator
}
func (*PolicyEvaluatorWrapper) DeserializeIdentity ¶
func (id *PolicyEvaluatorWrapper) DeserializeIdentity(serializedIdentity []byte) (vi.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 PolicyManager ¶
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() (vs.QueryResult, error)
type StateFetcherImpl ¶
type StateFetcherImpl struct {
QueryExecutorCreator
}
func (*StateFetcherImpl) FetchState ¶
func (sf *StateFetcherImpl) FetchState() (vs.State, error)
type StateImpl ¶
type StateImpl struct {
ledger.QueryExecutor
}