Version: v0.8.0 Latest Latest

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

Go to latest
Published: Jun 6, 2022 License: Apache-2.0 Imports: 10 Imported by: 0



Package services is all about handling services: from storing the latest data of a service to providing a interface for the openapi client code contained in pkg/openapi.



This section is empty.


This section is empty.


This section is empty.


type Datastore

type Datastore interface {
	// GetEvents receives the current services and runs a difference between
	// them and their previous state (the one already existing in memory).
	// It returns the differences in form of events.
	GetEvents(services map[string]*openapi.Service) map[string]*openapi.Event

Datastore holds services in their current state

func NewDatastore

func NewDatastore() Datastore

NewDatastore returns a new services datastore

type Handler

type Handler interface {
	// Send these events to an external handler.
	Send(services []openapi.Event) error

Handler is in charge of handling services, i.e. sending them to endpoints specified by CN-WAN Reader OpenAPI's specification.

func NewHandler

func NewHandler(ctx context.Context, endpoint string) (Handler, error)

NewHandler returns a services handler that uses the endpoints defined in the openAPI specification to send service events.

Jump to

Keyboard shortcuts

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