service

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package service defines the interfaces of a microservice, which the connector implements.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigChangedHandler

type ConfigChangedHandler func(ctx context.Context, changed func(string) bool) error

StartupHandler handles the OnStartup callback.

type Configurable

type Configurable interface {
	DefineConfig(name string, options ...cfg.Option) error
	Config(name string) (value string)
	SetConfig(name string, value any) error
	ResetConfig(name string) error

	SetOnConfigChanged(handler ConfigChangedHandler) error
}

Configurable are the actions used to configure the microservice.

type Executor

type Executor interface {
	Go(ctx context.Context, f func(ctx context.Context) (err error)) error
	Parallel(jobs ...func() (err error)) error
}

Executor are actions for running jobs in Go routines.

type FS

type FS interface {
	fs.FS
	fs.ReadDirFS
	fs.ReadFileFS
}

FS is a file system that can be associated with the connector.

type Identifier

type Identifier interface {
	ID() string
	Hostname() string
	Description() string
	Version() int
	Deployment() string
	Plane() string
	Locality() string
}

Identifier are the properties used to uniquely identify and address the microservice.

type Logger

type Logger interface {
	LogDebug(ctx context.Context, msg string, args ...any)
	LogInfo(ctx context.Context, msg string, args ...any)
	LogWarn(ctx context.Context, msg string, args ...any)
	LogError(ctx context.Context, msg string, args ...any)
}

Subscriber are the actions used to output log messages.

type Publisher

type Publisher interface {
	Request(ctx context.Context, options ...pub.Option) (*http.Response, error)
	Publish(ctx context.Context, options ...pub.Option) <-chan *pub.Response
}

Publisher are the actions used to publish to the bus.

type PublisherSubscriber

type PublisherSubscriber interface {
	Publisher
	Subscriber
}

PublisherSubscriber is both a publisher and a subscriber.

type Resourcer

type Resourcer interface {
	SetResFS(resFS FS) error
	ResFS() FS
}

Resourcer provides access to the connector's FS.

type Service

Service are all the actions that a connector provides.

type ShutdownHandler

type ShutdownHandler func(ctx context.Context) error

StartupHandler handles the OnShutdown callback.

type StarterStopper

type StarterStopper interface {
	Startup() (err error)
	Shutdown() error
	IsStarted() bool
	Lifetime() context.Context

	SetHostname(hostname string) error
	SetDeployment(deployment string) error
	SetPlane(plane string) error

	SetOnStartup(handler StartupHandler) error
	SetOnShutdown(handler ShutdownHandler) error
}

StarterStopper are the lifecycle actions of the microservice.

type StartupHandler

type StartupHandler func(ctx context.Context) error

StartupHandler handles the OnStartup callback.

type Subscriber

type Subscriber interface {
	Subscribe(method string, path string, handler sub.HTTPHandler, options ...sub.Option) error
	Unsubscribe(method string, path string) error
}

Subscriber are the actions used to subscribe to the bus.

type Ticker

type Ticker interface {
	StartTicker(name string, interval time.Duration, handler TickerHandler) error
}

Ticker are actions used to schedule recurring jobs.

type TickerHandler

type TickerHandler func(ctx context.Context) error

TickerHandler handles the ticker callbacks.

type Tracer

type Tracer interface {
	StartSpan(ctx context.Context, spanName string, opts ...trc.Option) (context.Context, trc.Span)
	Span(ctx context.Context) trc.Span
	ForceTrace(ctx context.Context)
}

Tracer are the actions used to operate distributed tracing spans.

Jump to

Keyboard shortcuts

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