Documentation
¶
Overview ¶
Package types provides marker's, these are here against dependency cycles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
// DefaultSeperator is used to split a service name into config section keys.
DefaultSeperator = "."
)
Functions ¶
func SplitServiceName ¶
func SplitServiceName(serviceName ServiceName) []string
SplitServiceName splits the serviceName into a string slice, separated by the global DefaultSeperator. Each item will be used as a key in the config.
Example:
ServiceName: "com.example.service"
Config:
```yaml
com:
example:
service:
...
```
Types ¶
type Component ¶
type Component interface {
// Start the component. E.g. connect to the broker.
Start() error
// Stop the component. E.g. disconnect from the broker.
// The context will contain a timeout, and cancelation should be respected.
Stop(context.Context) error
// Type returns the component type, e.g. broker.
Type() string
// String returns the component plugin name.
String() string
}
Component needs to be implemented by every component.
type ConfigData ¶
ConfigData holds a single config file marshaled to map[string]any, this needs to be done to marshal data back into a components config struct.
After a config source (e.g. a yaml file, or remote resource) has been parsed, it will be passed around inside this data type. Each component then gets a list of data sources, which layer by layer get applied to eventually construct your final component config.