Documentation ¶
Index ¶
- Variables
- func Config() map[string]any
- func Init(ctx Context, r *Registry) error
- type Extension
- type Factory
- type Instance
- type InstanceBase
- type InstanceConfig
- type Properties
- type Registry
- func (r *Registry) Catalog(ctx Context) []Service
- func (r *Registry) Clone() *Registry
- func (r *Registry) CreateServer(ctx Context, serviceConfig runtime.ServiceConfig, initial []*snapshot.Service, ...) (runtime.InstanceServer, []runtime.ServiceState, <-chan error, error)
- func (r *Registry) MustRegister(f Factory)
- func (r *Registry) Register(f Factory) error
- type Service
Constants ¶
This section is empty.
Variables ¶
var Extensions []*Extension
Extensions that have been registered via Extend or otherwise.
Functions ¶
Types ¶
type Extension ¶
type Extension struct { Name string // Can be overridden to avoid conflicts. Config any // Pointer to a custom struct type, or nil. Init func(Context, *Registry) error }
Extension declaration.
type Factory ¶
type Factory interface { Properties() Properties Discoverable(ctx Context) bool CreateInstance(ctx Context, config InstanceConfig, snapshot []byte) (Instance, error) }
Factory creates instances of a particular service implementation.
See https://github.com/gate-computer/gate/blob/main/doc/service.md for service naming conventions.
type Instance ¶
type Instance interface { Ready(ctx Context) error Start(ctx Context, send chan<- packet.Thunk, abort func(error)) error Handle(ctx Context, send chan<- packet.Thunk, received packet.Buf) (packet.Buf, error) Shutdown(ctx Context, suspend bool) (snapshot []byte, err error) }
Instance of a service. Corresponds to a program instance.
type InstanceBase ¶
type InstanceBase struct{}
InstanceBase provides default implementations for some Instance methods.
func (InstanceBase) Ready ¶
func (InstanceBase) Ready(Context) error
type InstanceConfig ¶
InstanceConfig for a service instance.
type Properties ¶
type Properties struct { Service Streams bool // Should Instance.Handle() receive flow and data packets? }
Properties of a service implementation.
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) CreateServer ¶
func (r *Registry) CreateServer(ctx Context, serviceConfig runtime.ServiceConfig, initial []*snapshot.Service, send chan<- packet.Thunk) (runtime.InstanceServer, []runtime.ServiceState, <-chan error, error)
func (*Registry) MustRegister ¶
MustRegister a service implementation. May replace an existing service. Panicks if service information is invalid.