Documentation
¶
Index ¶
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 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