Documentation
¶
Overview ¶
Code generated by mockery v2.13.0-beta.1. DO NOT EDIT.
Index ¶
- Constants
- func Get(parent string, key string, client etcdClient) (string, error)
- func IsKeyNotFoundError(err error) bool
- type ConfigurationContext
- type ConfigurationReader
- type DoguRegistry
- type MockRegistrydeprecated
- func (mr *MockRegistry) BlueprintRegistry() ConfigurationContext
- func (mr *MockRegistry) DoguConfig(dogu string) ConfigurationContext
- func (mr *MockRegistry) DoguRegistry() DoguRegistry
- func (mr *MockRegistry) GetNode() (Node, error)
- func (mr *MockRegistry) GlobalConfig() ConfigurationContext
- func (mr *MockRegistry) HostConfig(hostService string) ConfigurationContext
- func (mr *MockRegistry) RootConfig() WatchConfigurationContext
- func (mr *MockRegistry) State(dogu string) State
- type Node
- type Registry
- type State
- type WatchConfigurationContext
Constants ¶
const ( // DirectoryGlobal contains the registry key to the global registry. DirectoryGlobal = "_global" // KeyDoguPublicKey contains the key to a dogu's public key. KeyDoguPublicKey = "public.pem" )
Variables ¶
This section is empty.
Functions ¶
func Get ¶ added in v0.2.0
Get returns a configuration value from the current context, otherwise it returns an error. If the given key cannot be found a KeyNotFoundError is returned.
func IsKeyNotFoundError ¶
IsKeyNotFoundError returns true if the given error is a or contains a registry keyNotFoundError, otherwise false. It returns false if the given error is nil.
Types ¶
type ConfigurationContext ¶
type ConfigurationContext interface {
// Set sets a configuration value in current context
Set(key, value string) error
// SetWithLifetime sets a configuration value in current context with the given lifetime
SetWithLifetime(key, value string, timeToLiveInSeconds int) error
// Refresh resets the time to live of a key
Refresh(key string, timeToLiveInSeconds int) error
// Get returns a configuration value from the current context
Get(key string) (string, error)
// GetAll returns a map of key value pairs
GetAll() (map[string]string, error)
// Delete removes a configuration key and value from the current context
Delete(key string) error
// DeleteRecursive removes a configuration key or directory from the current context
DeleteRecursive(key string) error
// Exists returns true if configuration key exists in the current context
Exists(key string) (bool, error)
// RemoveAll remove all configuration keys
RemoveAll() error
// GetOrFalse return false and empty string when the configuration value does not exist.
// Otherwise, return true and the configuration value, even when the configuration value is an empty string.
GetOrFalse(key string) (bool, string, error)
}
ConfigurationContext is able to manage the configuration of a single context
type ConfigurationReader ¶
type ConfigurationReader struct {
Configuration ConfigurationContext
}
ConfigurationReader is a simple abstraction for reading and converting registry value
func NewConfigurationReader ¶
func NewConfigurationReader(configuration ConfigurationContext) *ConfigurationReader
NewConfigurationReader creates a new ConfigurationReader
func (*ConfigurationReader) GetBool ¶
func (configReader *ConfigurationReader) GetBool(key string) (bool, error)
GetBool reads the configuration value and converts it to a boolean. If the key could not be found, the function will return false.
type DoguRegistry ¶
type DoguRegistry interface {
// Enable enables the given dogu
Enable(dogu *core.Dogu) error
// Register registeres the dogu on the registry
Register(dogu *core.Dogu) error
// Unregister unregisters the dogu on the registry
Unregister(name string) error
// Get returns the dogu which the given name
Get(name string) (*core.Dogu, error)
// GetAll returns all installed dogus
GetAll() ([]*core.Dogu, error)
// IsEnabled returns true if the dogu is installed
IsEnabled(name string) (bool, error)
}
DoguRegistry manages dogus on a ecosystem
type MockRegistry
deprecated
type MockRegistry struct {
// contains filtered or unexported fields
}
MockRegistry is a in memory implementation of the registry interface. This registry is only for testing purposes and should never be used in production environments.
Deprecated: MockRegistry exists for historical compatibility and should not be used. Use mocks.Registry instead.
func (*MockRegistry) BlueprintRegistry ¶
func (mr *MockRegistry) BlueprintRegistry() ConfigurationContext
GlobalConfig returns a mock implementation of the global configuration context
func (*MockRegistry) DoguConfig ¶
func (mr *MockRegistry) DoguConfig(dogu string) ConfigurationContext
DoguConfig returns a mock implementation of a dogu configuration context
func (*MockRegistry) DoguRegistry ¶
func (mr *MockRegistry) DoguRegistry() DoguRegistry
DoguRegistry returns a mock implementation of the dogu registry
func (*MockRegistry) GetNode ¶ added in v0.5.0
func (mr *MockRegistry) GetNode() (Node, error)
GetNode was added to deprecated mock for legacy code support and has no functionality
func (*MockRegistry) GlobalConfig ¶
func (mr *MockRegistry) GlobalConfig() ConfigurationContext
GlobalConfig returns a mock implementation of the global configuration context
func (*MockRegistry) HostConfig ¶
func (mr *MockRegistry) HostConfig(hostService string) ConfigurationContext
func (*MockRegistry) RootConfig ¶ added in v0.3.0
func (mr *MockRegistry) RootConfig() WatchConfigurationContext
RootConfig was added to deprecated mock for legacy code support and has no functionality
func (*MockRegistry) State ¶
func (mr *MockRegistry) State(dogu string) State
State is currently not implemented and returns always nil
type Node ¶ added in v0.5.0
type Node struct {
// SubNodes contains all direct children of the current node.
SubNodes []Node
// IsDir is true if the current node is a dir, false if the node is a key
IsDir bool
// FullKey is the full path of a key including the path of all its parents.
FullKey string
// Value is the value of the node - empty string if the node is a directory
Value string
}
Node Represents the structure (key/value/dir) of the etcd
func (Node) HasSubNodes ¶ added in v0.5.0
HasSubNodes returns true if the SubNodes attribute has values, otherwise false
func (Node) Key ¶ added in v0.5.0
Key Returns the direct key of the node - parent paths are excluded
func (Node) SubNodeByName ¶ added in v0.5.0
SubNodeByName Searches in the direct sub nodes for a node with the given key and returns it if found. Returns empty node otherwise.
type Registry ¶
type Registry interface {
// GlobalConfig returns a ConfigurationContext for the global context
GlobalConfig() ConfigurationContext
// HostConfig returns a ConfigurationContext for the host context
HostConfig(hostService string) ConfigurationContext
// DoguConfig returns a ConfigurationContext for the given dogu
DoguConfig(dogu string) ConfigurationContext
// State returns the state object for the given dogu
State(dogu string) State
// DoguRegistry returns an object which is able to manage dogus
DoguRegistry() DoguRegistry
// BlueprintRegistry to maintain a blueprint history
BlueprintRegistry() ConfigurationContext
// RootConfig returns a WatchConfigurationContext for the root context
RootConfig() WatchConfigurationContext
// GetNode returns all keys that are included in any path, packed as Node
GetNode() (Node, error)
}
Registry represents the main registry of a cloudogu ecosystem. The registry manage dogus, their configuration and their states.
type State ¶
type State interface {
// Get returns the current state value
Get() (string, error)
// Set sets the state of the dogu
Set(value string) error
// Remove removes the state of the dogu
Remove() error
}
State handles state related functions of a dogu
type WatchConfigurationContext ¶ added in v0.2.0
type WatchConfigurationContext interface {
// Watch watches for changes of the provided key and sends the event through the channel
Watch(ctx context.Context, key string, recursive bool, eventChannel chan *client.Response)
// Get returns a configuration value from the current context
Get(key string) (string, error)
// GetChildrenPaths returns an array of all children keys of the given key
GetChildrenPaths(key string) ([]string, error)
}
WatchConfigurationContext is just able to watch and query the configuration of a single context