types

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: Apache-2.0 Imports: 3 Imported by: 36

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

View Source
const (
	PriorityLogger   = 1000
	PriorityMetrics  = 1100
	PriorityRegistry = 1200
	PriorityEvent    = 1300
	PriorityHandler  = 1350
	PriorityServer   = 1400
	PriorityClient   = 1500
	PriorityKVStore  = 1600
	PriorityCustom   = 2000
)

Priority constants.

Variables

View Source
var (
	// DefaultSeparator is used to split a service name into config section keys.
	DefaultSeparator = "."
)

Functions

func JoinServiceName added in v0.3.0

func JoinServiceName(sections []string) string

JoinServiceName joins a splitted servicename back together.

func SplitServiceName

func SplitServiceName[T ~string](serviceName T) []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(ctx context.Context) 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 Components added in v0.1.1

type Components = container.PriorityList[Component]

Components is the container type for components.

func NewComponents added in v0.3.0

func NewComponents() *Components

NewComponents returns a new container for components.

func ProvideComponents added in v0.3.0

func ProvideComponents() (*Components, error)

ProvideComponents is a wire injector for fresh components.

Jump to

Keyboard shortcuts

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