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 ¶
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 ¶
Catalog of service metadata. Only the services which are discoverable in this context are included.
func (*Registry) Clone ¶
Clone the registry shallowly. The new registry may be used to add or replace services without affecting the original registry.
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.