Documentation ¶
Index ¶
- Constants
- type Bundle
- func (b *Bundle) APIPolicyMapper() PolicyMapper
- func (b *Bundle) ChaincodeRegistry() ChaincodeRegistry
- func (b *Bundle) ChannelConfig() channelconfig.Resources
- func (b *Bundle) ConfigtxValidator() configtx.Validator
- func (b *Bundle) NewFromChannelConfig(chanConf channelconfig.Resources) (*Bundle, error)
- func (b *Bundle) PolicyManager() policies.Manager
- func (b *Bundle) RootGroupKey() string
- func (b *Bundle) ValidateNew(resources Resources) error
- type BundleSource
- func (bs *BundleSource) APIPolicyMapper() PolicyMapper
- func (bs *BundleSource) ChaincodeRegistry() ChaincodeRegistry
- func (bs *BundleSource) ChannelConfig() channelconfig.Resources
- func (bs *BundleSource) ConfigtxValidator() configtx.Validator
- func (bs *BundleSource) NewFromChannelConfig(chanConf channelconfig.Resources) (*Bundle, error)
- func (bs *BundleSource) PolicyManager() policies.Manager
- func (bs *BundleSource) StableBundle() *Bundle
- func (bs *BundleSource) Update(newBundle *Bundle)
- func (bs *BundleSource) ValidateNew(resources Resources) error
- type ChaincodeDefinition
- type ChaincodeGroup
- type ChaincodeRegistry
- type PolicyMapper
- type Resources
Constants ¶
const ( PeerPoliciesGroupKey = "PeerPolicies" APIsGroupKey = "APIs" ChaincodesGroupKey = "Chaincodes" )
const RootGroupKey = "Resources"
RootGroupKey is the namespace in the config tree for this set of config
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bundle ¶
type Bundle struct {
// contains filtered or unexported fields
}
Bundle stores an immutable group of resources configuration
func NewBundle ¶
func NewBundle(channelID string, config *cb.Config, chanConf channelconfig.Resources) (*Bundle, error)
NewBundle creates a resources config bundle which implements the Resources interface.
func NewBundleFromEnvelope ¶
func NewBundleFromEnvelope(envConfig *cb.Envelope, chanConf channelconfig.Resources) (*Bundle, error)
NewBundleFromEnvelope creates a new resources config bundle. TODO, this method should probably be removed, as the resourcesconfig is never in an Envelope naturally. TODO, add an atomic BundleSource
func (*Bundle) APIPolicyMapper ¶
func (b *Bundle) APIPolicyMapper() PolicyMapper
APIPolicyMapper returns a way to map API names to policies governing their invocation.
func (*Bundle) ChaincodeRegistry ¶
func (b *Bundle) ChaincodeRegistry() ChaincodeRegistry
ChaincodeRegistery returns a way to query for chaincodes defined in this channel.
func (*Bundle) ChannelConfig ¶
func (b *Bundle) ChannelConfig() channelconfig.Resources
ChannelConfig returns the channel config which this resources config depends on. Note, consumers of the resourcesconfig should almost never refer to the PolicyManager within the channel config, and should instead refer to the PolicyManager exposed by this Bundle.
func (*Bundle) ConfigtxValidator ¶
ConfigtxValidator returns a reference to a configtx.Validator which can process updates to this config.
func (*Bundle) NewFromChannelConfig ¶
func (b *Bundle) NewFromChannelConfig(chanConf channelconfig.Resources) (*Bundle, error)
NewFromChannelConfig builds a new Bundle, based on this Bundle, but with a different underlying channel config. This is usually invoked when a channel config update is processed.
func (*Bundle) PolicyManager ¶
PolicyManager returns a policy manager which can resolve names both in the /Channel and /Resources namespaces.
func (*Bundle) RootGroupKey ¶
RootGroupKey returns the name of the key for the root group (the namespace for this config).
func (*Bundle) ValidateNew ¶
ValidateNew is currently a no-op. The idea is that there may be additional checking which needs to be done between an old resource configuration and a new one. In the channel resource configuration case, we add some checks to make sure that the MSP IDs have not changed, and that the consensus type has not changed. There is currently no such check required in the peer resources, but, in the interest of following the pattern established by the channel configuration, it is included here.
type BundleSource ¶
type BundleSource struct {
// contains filtered or unexported fields
}
BundleSource stores a reference to the current peer resource configuration bundle It also provides a method to update this bundle. The assorted methods of BundleSource largely pass through to the underlying bundle, but do so through an atomic pointer so that cross go-routine reads are not vulnerable to out-of-order execution memory type bugs.
func NewBundleSource ¶
func NewBundleSource(bundle *Bundle, callbacks ...func(*Bundle)) *BundleSource
NewBundleSource creates a new BundleSource with an initial Bundle value The callbacks will be invoked whenever the Update method is called for the BundleSource. Note, these callbacks are called immediately before this function returns.
func (*BundleSource) APIPolicyMapper ¶
func (bs *BundleSource) APIPolicyMapper() PolicyMapper
APIPolicyMapper returns a way to map API names to policies governing their invocation.
func (*BundleSource) ChaincodeRegistry ¶
func (bs *BundleSource) ChaincodeRegistry() ChaincodeRegistry
ChaincodeRegistery returns a way to query for chaincodes defined in this channel.
func (*BundleSource) ChannelConfig ¶
func (bs *BundleSource) ChannelConfig() channelconfig.Resources
ChannelConfig returns the channel config which this resources config depends on. Note, consumers of the resourcesconfig should almost never refer to the PolicyManager within the channel config, and should instead refer to the PolicyManager exposed by this Bundle.
func (*BundleSource) ConfigtxValidator ¶
func (bs *BundleSource) ConfigtxValidator() configtx.Validator
ConfigtxValidator returns a reference to a configtx.Validator which can process updates to this config.
func (*BundleSource) NewFromChannelConfig ¶
func (bs *BundleSource) NewFromChannelConfig(chanConf channelconfig.Resources) (*Bundle, error)
NewFromChannelConfig passes through the the underlying bundle
func (*BundleSource) PolicyManager ¶
func (bs *BundleSource) PolicyManager() policies.Manager
PolicyManager returns a policy manager which can resolve names both in the /Channel and /Resources namespaces.
func (*BundleSource) StableBundle ¶
func (bs *BundleSource) StableBundle() *Bundle
StableBundle returns a pointer to a stable Bundle. It is stable because calls to its assorted methods will always return the same result, as the underlying data structures are immutable. For instance, calling BundleSource.PolicyManager() and BundleSource.APIPolicyMapper() to get first the the policy manager and then references into that policy manager could result in a bug because an update might replace the underlying Bundle in between. Therefore, for operations which require consistency between the Bundle calls, the caller should first retrieve a StableBundle, then operate on it.
func (*BundleSource) Update ¶
func (bs *BundleSource) Update(newBundle *Bundle)
Update sets a new bundle as the bundle source and calls any registered callbacks
func (*BundleSource) ValidateNew ¶
func (bs *BundleSource) ValidateNew(resources Resources) error
ValidateNew passes through to the current bundle
type ChaincodeDefinition ¶
type ChaincodeDefinition interface { // CCName returns the name of this chaincode (the name it was put in the ChaincodeRegistry with). CCName() string // Hash returns the hash of the chaincode. Hash() []byte // CCVersion returns the version of the chaincode. CCVersion() string // Validation returns how to validate transactions for this chaincode. // The string returned is the name of the validation method (usually 'vscc') // and the bytes returned are the argument to the validation (in the case of // 'vscc', this is a marshaled pb.VSCCArgs message). Validation() (string, []byte) // Endorsement returns how to endorse proposals for this chaincode. // The string returns is the name of the endorsement method (usually 'escc'). Endorsement() string }
ChaincodeDefinition describes all of the necessary information for a peer to decide whether to endorse a proposal and whether to validate a transaction, for a particular chaincode.
type ChaincodeGroup ¶
type ChaincodeGroup struct {
// contains filtered or unexported fields
}
ChaincodeGroup represents the ConfigGroup named Chaincodes off the resources group
func (*ChaincodeGroup) CCName ¶
func (cg *ChaincodeGroup) CCName() string
Name returns the name of this chaincode (the name it was put in the ChaincodeRegistry with).
func (*ChaincodeGroup) CCVersion ¶
func (cg *ChaincodeGroup) CCVersion() string
Version returns the version of the chaincode.
func (*ChaincodeGroup) Endorsement ¶
func (cg *ChaincodeGroup) Endorsement() string
Endorsement returns how to endorse proposals for this chaincode. The string returns is the name of the endorsement method (usually 'escc').
func (*ChaincodeGroup) Hash ¶
func (cg *ChaincodeGroup) Hash() []byte
Hash returns the hash of the chaincode.
func (*ChaincodeGroup) Validation ¶
func (cg *ChaincodeGroup) Validation() (string, []byte)
Validation returns how to validate transactions for this chaincode. The string returned is the name of the validation method (usually 'vscc') and the bytes returned are the argument to the validation (in the case of 'vscc', this is a marshaled pb.VSCCArgs message).
type ChaincodeRegistry ¶
type ChaincodeRegistry interface { // ChaincodeByName returns the chaincode definition if it is exists, and whether it exists ChaincodeByName(name string) (ChaincodeDefinition, bool) }
ChaincodeRegistry allows for querying chaincode info by name
type PolicyMapper ¶
type PolicyMapper interface { // PolicyRefForAPI takes the name of an API, and returns the policy name // or the empty string if the API is not found PolicyRefForAPI(apiName string) string }
PolicyMapper is an interface for
type Resources ¶
type Resources interface { // ConfigtxValidator returns a reference to a configtx.Validator which can process updates to this config. ConfigtxValidator() configtx.Validator // PolicyManager returns a policy manager which can resolve names both in the /Channel and /Resources namespaces. // Note, the result of this method is almost definitely the one you want. Calling ChannelConfig().PolicyManager() // will return a policy manager which can only resolve policies in the /Channel namespace. PolicyManager() policies.Manager // APIPolicyMapper returns a way to map API names to policies governing their invocation. APIPolicyMapper() PolicyMapper // ChaincodeRegistery returns a way to query for chaincodes defined in this channel. ChaincodeRegistry() ChaincodeRegistry // ChannelConfig returns the channelconfig.Resources which this config depends on. ChannelConfig() channelconfig.Resources }
Resources defines a way to query peer resources associated with a channel.