Documentation
¶
Index ¶
- Constants
- Variables
- type Configuration
- func (m *Configuration) GetBool(key string) bool
- func (m *Configuration) GetString(key string) string
- func (m *Configuration) ID() driver.TMSID
- func (m *Configuration) IsSet(key string) bool
- func (m *Configuration) Serialize(tmsID token.TMSID) ([]byte, error)
- func (m *Configuration) SetValidators(validators []Validator)
- func (m *Configuration) TranslatePath(path string) string
- func (m *Configuration) UnmarshalKey(key string, rawVal any) error
- func (m *Configuration) Validate() error
- type Provider
- type ResourceLimitsProvider
- type Service
- func (m *Service) AddConfiguration(raw []byte) error
- func (m *Service) ConfigurationFor(network, channel, namespace string) (*Configuration, error)
- func (m *Service) Configurations() ([]*Configuration, error)
- func (m *Service) Enabled() bool
- func (m *Service) LookupNamespace(network, channel string) (string, error)
- func (m *Service) ResetConfigurations() error
- func (m *Service) Version() string
- type TMSConfig
- type TokenConfig
- type ValidateConfiguration
- type Validator
Constants ¶
const ( Network = "network" Channel = "channel" Namespace = "namespace" )
const ( RootKey = "token" TMSKey = "tms" )
Variables ¶
var ( TMSPath = config.Join(RootKey, TMSKey) VersionPath = config.Join(RootKey, "version") EnabledPath = config.Join(RootKey, "enabled") // ErrConfigurationNotFound is returned when a configuration is not found ErrConfigurationNotFound = errors.Errorf("configuration not found") )
var ResourceLimitsPath = config.Join(RootKey, "validation", "limits")
ResourceLimitsPath is the configuration key holding the process-wide validator resource limits. It is deliberately not scoped under a TMS (unlike TMSPath): the composition roots that need it (the validator driver service used both by the FSC/DI runtime and by the standalone Fabric chaincode process) only ever have public parameters in scope, never a TMS identifier.
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct {
// contains filtered or unexported fields
}
Configuration is the configuration of a given configuration
func NewConfiguration ¶
func NewConfiguration(cp Provider, keyID string, tmsID driver.TMSID) *Configuration
func (*Configuration) GetBool ¶
func (m *Configuration) GetBool(key string) bool
func (*Configuration) GetString ¶
func (m *Configuration) GetString(key string) string
func (*Configuration) ID ¶
func (m *Configuration) ID() driver.TMSID
func (*Configuration) IsSet ¶
func (m *Configuration) IsSet(key string) bool
func (*Configuration) Serialize ¶
func (m *Configuration) Serialize(tmsID token.TMSID) ([]byte, error)
Serialize serializes this configuration with the respect to the passed tms ID
func (*Configuration) SetValidators ¶
func (m *Configuration) SetValidators(validators []Validator)
SetValidators sets the validators for this configuration.
func (*Configuration) TranslatePath ¶
func (m *Configuration) TranslatePath(path string) string
TranslatePath translates the passed path relative to the config path
func (*Configuration) UnmarshalKey ¶
func (m *Configuration) UnmarshalKey(key string, rawVal any) error
UnmarshalKey takes a single key and unmarshals it into a Struct
func (*Configuration) Validate ¶
func (m *Configuration) Validate() error
type ResourceLimitsProvider ¶ added in v0.15.1
type ResourceLimitsProvider struct {
// contains filtered or unexported fields
}
ResourceLimitsProvider resolves driver.ResourceLimits from key ResourceLimitsPath, overlaying driver.DefaultResourceLimits() onto any field the configuration leaves unset. It is the config-service-backed implementation of driver.ResourceLimitsProvider used by the FSC/DI runtime.
func NewResourceLimitsProvider ¶ added in v0.15.1
func NewResourceLimitsProvider(cp Provider) *ResourceLimitsProvider
NewResourceLimitsProvider returns a driver.ResourceLimitsProvider backed by the passed configuration provider.
func (*ResourceLimitsProvider) ResourceLimits ¶ added in v0.15.1
func (p *ResourceLimitsProvider) ResourceLimits() (driver.ResourceLimits, error)
ResourceLimits implements driver.ResourceLimitsProvider.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service model the configuration service for Panurus
func NewService ¶
NewService creates a new Service configuration.
func (*Service) AddConfiguration ¶
AddConfiguration does the following: - parse raw as a yaml stream - extract the configuration - validate it making sure it contains a new TMS If all good, accept the new TMS Updates to an existing TMS should be rejected.
func (*Service) ConfigurationFor ¶
func (m *Service) ConfigurationFor(network, channel, namespace string) (*Configuration, error)
ConfigurationFor returns a configuration for the given network, channel, and namespace.
func (*Service) Configurations ¶
func (m *Service) Configurations() ([]*Configuration, error)
Configurations returns all configuration configurations.
func (*Service) LookupNamespace ¶
LookupNamespace searches for a configuration that matches the given network and channel, and return its namespace. If no matching configuration is found, an error is returned. If multiple matching configurations are found, an error is returned.
func (*Service) ResetConfigurations ¶
ResetConfigurations resets the internal configurations holder.
type TMSConfig ¶
type TMSConfig struct {
Token TokenConfig `yaml:"token"`
}
TMSConfig is the TMS configuration
type TokenConfig ¶
TokenConfig is used to serialize a TMS configuration
type ValidateConfiguration ¶
type ValidateConfiguration interface {
// ID identities the TMS this configuration refers to.
ID() token.TMSID
// IsSet checks to see if the key has been set in any of the data locations
IsSet(key string) bool
// UnmarshalKey takes a single key and unmarshals it into a struct.
// The key must be relative to the TMS this configuration refers to.
UnmarshalKey(key string, rawVal any) error
// GetString returns the value associated with the key as a string
GetString(key string) string
// GetBool returns the value associated with the key as a bool
GetBool(key string) bool
// TranslatePath translates the passed path relative to the config path
TranslatePath(path string) string
}
ValidateConfiguration provides functions to access the configuration of a given TMS
type Validator ¶
type Validator interface {
// Validate returns nil if the passed configuration is valid, an error otherwise.
Validate(ValidateConfiguration) error
}
Validator is used to validate a TMS configuration