service

package
v0.0.0-...-0e4e454 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory interface {
	ServiceName() string
	ServiceVersion() string
	Discoverable(ctx context.Context) bool
	CreateInstance(ctx context.Context, config InstanceConfig) Instance
	RestoreInstance(ctx context.Context, config InstanceConfig, snapshot []byte) (Instance, error)
}

Factory creates instances of a particular service implementation.

See https://github.com/tsavola/gate/blob/master/Service.md for service naming conventions.

type Instance

type Instance interface {
	Resume(ctx context.Context, send chan<- packet.Buf)
	Handle(ctx context.Context, send chan<- packet.Buf, received packet.Buf)
	Suspend() (snapshot []byte)
	Shutdown()
}

Instance of a service. Corresponds to a program instance.

type InstanceConfig

type InstanceConfig struct {
	packet.Service
}

InstanceConfig for a service instance.

type Registry

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

Registry is a runtime.ServiceRegistry implementation. It multiplexes packets to service implementations.

func (*Registry) Catalog

func (r *Registry) Catalog(ctx context.Context) (services []Service)

Catalog of service metadata. Only the services which are discoverable in this context are included.

func (*Registry) Clone

func (r *Registry) Clone() *Registry

Clone the registry shallowly. The new registry may be used to add or replace services without affecting the original registry.

func (*Registry) Register

func (r *Registry) Register(f Factory)

Register a service implementation.

func (*Registry) StartServing

func (r *Registry) StartServing(ctx context.Context, serviceConfig runtime.ServiceConfig, initial []snapshot.Service, send chan<- packet.Buf, recv <-chan packet.Buf,
) (runtime.ServiceDiscoverer, []runtime.ServiceState, error)

StartServing implements the runtime.ServiceRegistry interface function.

type Service

type Service struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

Service metadata.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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