registry

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0, EPL-2.0 Imports: 7 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(r *Registration)

Register allows services to register

func RegistrationsMap

func RegistrationsMap() map[Type][]*Registration

RegistrationsMap returns map with all service registrations

Types

type GrpcServer

type GrpcServer interface {
	Start() error
	Stop() error
}

GrpcServer manages start and stop opeerations of the gRPC server

type GrpcService

type GrpcService interface {
	Register(*grpc.Server) error
}

GrpcService allows GRPC services to be registered with the underlying server

type Registration

type Registration struct {
	ID       string
	Type     Type
	InitFunc func(registryCtx *ServiceRegistryContext) (interface{}, error)
}

Registration holds service's information that will be added to the registry

func (*Registration) Init

Init the registered plugin

type ServiceInfo

type ServiceInfo struct {
	Config       interface{}
	Registration *Registration
	// contains filtered or unexported fields
}

ServiceInfo holds service information

func (*ServiceInfo) Err

func (p *ServiceInfo) Err() error

Err returns the errors during initialization. returns nil if not error was encountered

func (*ServiceInfo) Instance

func (p *ServiceInfo) Instance() (interface{}, error)

Instance returns the instance and any initialization error of the plugin

type ServiceRegistryContext

type ServiceRegistryContext struct {
	Context      context.Context
	Config       interface{}
	Registration *Registration
	// contains filtered or unexported fields
}

ServiceRegistryContext holds information for the service's registry context

func NewContext

func NewContext(ctx context.Context, config interface{}, r *Registration, services *Set) *ServiceRegistryContext

NewContext returns a new registry ServiceRegistryContext

func (*ServiceRegistryContext) Get

func (i *ServiceRegistryContext) Get(t Type) (interface{}, error)

Get returns the first service by its type

func (*ServiceRegistryContext) GetAll

func (i *ServiceRegistryContext) GetAll() []*ServiceInfo

GetAll services in the set

func (*ServiceRegistryContext) GetByType

func (i *ServiceRegistryContext) GetByType(t Type) (map[string]*ServiceInfo, error)

GetByType returns all services with the specific type.

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set defines a plugin collection, used with RegistryContext.

This maintains ordering and unique indexing over the set.

func NewServiceInfoSet

func NewServiceInfoSet() *Set

NewServiceInfoSet returns an initialized service info set

func (*Set) Add

func (ps *Set) Add(p *ServiceInfo) error

Add a service info to the set

func (*Set) Get

func (ps *Set) Get(t Type) (interface{}, error)

Get returns the first service instance by its type

func (*Set) GetAll

func (ps *Set) GetAll(t Type) []*ServiceInfo

GetAll returns all service infos by a type

type Type

type Type string

Type is the type of the service in the registry

const (
	// EventsManagerService implements THE events manager service
	EventsManagerService Type = "container-management.service.events.manager.v1"
	// NetworkManagerService implements THE network manager service
	NetworkManagerService Type = "container-management.service.net.manager.v1"
	// ContainerClientService implements THE containers API client service
	ContainerClientService Type = "container-management.service.ctrs.client.v1"
	// ContainerManagerService implements THE container manager service
	ContainerManagerService Type = "container-management.service.ctrs.manager.v1"
	// SystemInfoService implements THE system information service
	SystemInfoService Type = "container-management.service.system.info.v1"
	// ThingsContainerManagerService implements THE container management via the IoT Rollouts and IoT Things services
	ThingsContainerManagerService Type = "container-management.service.things.ctrs.manager.v1"
	// GRPCService implements a grpc service
	GRPCService Type = "container-management.service.grpc.v1"
	// GRPCServer implements a grpc server
	GRPCServer Type = "container-management.server.grpc.v1"
	// DeploymentManagerService implements THE container deployment manager service
	DeploymentManagerService Type = "container-management.service.deployment.ctrs.manager.v1"
	// UpdateAgentService implements the UpdateAgent API for containers domain
	UpdateAgentService Type = "container-management.service.ctrs.updateagent.v1"
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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