Documentation
¶
Overview ¶
Package types provides marker's, these are here against dependency cycles.
If this marker's would live in config for example, everything would import from config which means config isn't allowed to import a logger from log for example.
Index ¶
Constants ¶
const ( PriorityLogger = 1000 PriorityMetrics = 1100 PriorityRegistry = 1200 PriorityEvent = 1300 PriorityServer = 1400 PriorityClient = 1500 )
Priority constants.
Variables ¶
var Components = container.NewPriorityList[Component]()
Components is the container for client implementations.
var (
// DefaultSeperator is used to split a service name into config section keys.
DefaultSeperator = "."
)
Functions ¶
func RegisterComponent ¶ added in v0.1.1
RegisterComponent adds a component to the container.
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(ctx 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.
type ServiceVersion ¶ added in v0.1.0
type ServiceVersion string
ServiceVersion is the version of the Service.