types

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2023 License: Apache-2.0 Imports: 3 Imported by: 15

Documentation

Overview

Package types provides marker's, these are here against dependency cycles.

Index

Constants

This section is empty.

Variables

View Source
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

type ConfigData []source.Data

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 ServiceName

type ServiceName string

ServiceName is the name of the Service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL