{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.1.1","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package resourcesconfig\n\n## Constants\n\n```go\nconst (\n\tPeerPoliciesGroupKey = \"PeerPolicies\"\n\tAPIsGroupKey         = \"APIs\"\n\tChaincodesGroupKey   = \"Chaincodes\"\n)\n```\n\n```go\nconst RootGroupKey = \"Resources\"\n```\nRootGroupKey is the namespace in the config tree for this set of config\n\n## Types\n\n```go\ntype Bundle struct {\n\t// contains filtered or unexported fields\n}\n```\nBundle stores an immutable group of resources configuration\n\n```go\nfunc NewBundle(channelID string, config *cb.Config, chanConf channelconfig.Resources) (*Bundle, error)\n```\nNewBundle creates a resources config bundle which implements the Resources interface.\n\n```go\nfunc NewBundleFromEnvelope(envConfig *cb.Envelope, chanConf channelconfig.Resources) (*Bundle, error)\n```\nNewBundleFromEnvelope 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\n\n```go\nfunc (b *Bundle) APIPolicyMapper() PolicyMapper\n```\nAPIPolicyMapper returns a way to map API names to policies governing their invocation.\n\n```go\nfunc (b *Bundle) ChaincodeRegistry() ChaincodeRegistry\n```\nChaincodeRegistery returns a way to query for chaincodes defined in this channel.\n\n```go\nfunc (b *Bundle) ChannelConfig() channelconfig.Resources\n```\nChannelConfig 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.\n\n```go\nfunc (b *Bundle) ConfigtxValidator() configtx.Validator\n```\nConfigtxValidator returns a reference to a configtx.Validator which can process updates to this config.\n\n```go\nfunc (b *Bundle) NewFromChannelConfig(chanConf channelconfig.Resources) (*Bundle, error)\n```\nNewFromChannelConfig 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.\n\n```go\nfunc (b *Bundle) PolicyManager() policies.Manager\n```\nPolicyManager returns a policy manager which can resolve names both in the /Channel and /Resources namespaces.\n\n```go\nfunc (b *Bundle) RootGroupKey() string\n```\nRootGroupKey returns the name of the key for the root group (the namespace for this config).\n\n```go\nfunc (b *Bundle) ValidateNew(resources Resources) error\n```\nValidateNew 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.\n\n```go\ntype BundleSource struct {\n\t// contains filtered or unexported fields\n}\n```\nBundleSource 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.\n\n```go\nfunc NewBundleSource(bundle *Bundle, callbacks ...func(*Bundle)) *BundleSource\n```\nNewBundleSource 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.\n\n```go\nfunc (bs *BundleSource) APIPolicyMapper() PolicyMapper\n```\nAPIPolicyMapper returns a way to map API names to policies governing their invocation.\n\n```go\nfunc (bs *BundleSource) ChaincodeRegistry() ChaincodeRegistry\n```\nChaincodeRegistery returns a way to query for chaincodes defined in this channel.\n\n```go\nfunc (bs *BundleSource) ChannelConfig() channelconfig.Resources\n```\nChannelConfig 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.\n\n```go\nfunc (bs *BundleSource) ConfigtxValidator() configtx.Validator\n```\nConfigtxValidator returns a reference to a configtx.Validator which can process updates to this config.\n\n```go\nfunc (bs *BundleSource) NewFromChannelConfig(chanConf channelconfig.Resources) (*Bundle, error)\n```\nNewFromChannelConfig passes through the the underlying bundle\n\n```go\nfunc (bs *BundleSource) PolicyManager() policies.Manager\n```\nPolicyManager returns a policy manager which can resolve names both in the /Channel and /Resources namespaces.\n\n```go\nfunc (bs *BundleSource) StableBundle() *Bundle\n```\nStableBundle 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.\n\n```go\nfunc (bs *BundleSource) Update(newBundle *Bundle)\n```\nUpdate sets a new bundle as the bundle source and calls any registered callbacks\n\n```go\nfunc (bs *BundleSource) ValidateNew(resources Resources) error\n```\nValidateNew passes through to the current bundle\n\n```go\ntype ChaincodeDefinition interface {\n\t// CCName returns the name of this chaincode (the name it was put in the ChaincodeRegistry with).\n\tCCName() string\n\n\t// Hash returns the hash of the chaincode.\n\tHash() []byte\n\n\t// CCVersion returns the version of the chaincode.\n\tCCVersion() string\n\n\t// Validation returns how to validate transactions for this chaincode.\n\t// The string returned is the name of the validation method (usually 'vscc')\n\t// and the bytes returned are the argument to the validation (in the case of\n\t// 'vscc', this is a marshaled pb.VSCCArgs message).\n\tValidation() (string, []byte)\n\n\t// Endorsement returns how to endorse proposals for this chaincode.\n\t// The string returns is the name of the endorsement method (usually 'escc').\n\tEndorsement() string\n}\n```\nChaincodeDefinition 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.\n\n```go\ntype ChaincodeGroup struct {\n\t// contains filtered or unexported fields\n}\n```\nChaincodeGroup represents the ConfigGroup named Chaincodes off the resources group\n\n```go\nfunc (cg *ChaincodeGroup) CCName() string\n```\nName returns the name of this chaincode (the name it was put in the ChaincodeRegistry with).\n\n```go\nfunc (cg *ChaincodeGroup) CCVersion() string\n```\nVersion returns the version of the chaincode.\n\n```go\nfunc (cg *ChaincodeGroup) Endorsement() string\n```\nEndorsement returns how to endorse proposals for this chaincode. The string returns is the name of the endorsement method (usually 'escc').\n\n```go\nfunc (cg *ChaincodeGroup) Hash() []byte\n```\nHash returns the hash of the chaincode.\n\n```go\nfunc (cg *ChaincodeGroup) Validation() (string, []byte)\n```\nValidation 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).\n\n```go\ntype ChaincodeRegistry interface {\n\t// ChaincodeByName returns the chaincode definition if it is exists, and whether it exists\n\tChaincodeByName(name string) (ChaincodeDefinition, bool)\n}\n```\nChaincodeRegistry allows for querying chaincode info by name\n\n```go\ntype PolicyMapper interface {\n\t// PolicyRefForAPI takes the name of an API, and returns the policy name\n\t// or the empty string if the API is not found\n\tPolicyRefForAPI(apiName string) string\n}\n```\nPolicyMapper is an interface for\n\n```go\ntype Resources interface {\n\t// ConfigtxValidator returns a reference to a configtx.Validator which can process updates to this config.\n\tConfigtxValidator() configtx.Validator\n\n\t// PolicyManager returns a policy manager which can resolve names both in the /Channel and /Resources namespaces.\n\t// Note, the result of this method is almost definitely the one you want.  Calling ChannelConfig().PolicyManager()\n\t// will return a policy manager which can only resolve policies in the /Channel namespace.\n\tPolicyManager() policies.Manager\n\n\t// APIPolicyMapper returns a way to map API names to policies governing their invocation.\n\tAPIPolicyMapper() PolicyMapper\n\n\t// ChaincodeRegistery returns a way to query for chaincodes defined in this channel.\n\tChaincodeRegistry() ChaincodeRegistry\n\n\t// ChannelConfig returns the channelconfig.Resources which this config depends on.\n\tChannelConfig() channelconfig.Resources\n}\n```\nResources defines a way to query peer resources associated with a channel.\n\n","path":"github.com/eric-erki/https-hyperledger.org/common/resourcesconfig","name":"resourcesconfig","synopsis":"","isRedistributable":true}
