Versions in this module Expand all Collapse all v0 v0.0.9 Apr 27, 2026 v0.0.8 Apr 21, 2026 Changes in this version + const ConnectionEventTypeConnected + const ConnectionEventTypeDisconnected + const ConnectionEventTypeHeartbeat + const ManagedServerStageAgentShutdown + const ManagedServerStageLifecycle + const ManagedServerStageServe + const ManagedServerStageShutdown + var ErrWatchStreamClosed = errors.New("watch stream closed") + var ErrWatchURLRequired = errors.New("watch url is required") type ConnectionEvent + EventId string + GeneratedAt *time.Time + LifecycleState string + Message string + Ready *bool + Service string + Status string + Type string type Controller + func (c *Controller) ObserveEvent(event ConnectionEvent) + func (c *Controller) RecordError(err error) + type LifecycleHookOptions struct + Lifecycle *ServiceLifecycle + OnError ErrorHandler + type LifecycleHooks struct + func NewLifecycleHooks(options LifecycleHookOptions) (*LifecycleHooks, error) + func (h *LifecycleHooks) OnStart(ctx context.Context) error + func (h *LifecycleHooks) OnStop(ctx context.Context) error + func (h *LifecycleHooks) Status() Status + type LifecycleRunError struct + Err error + func (e *LifecycleRunError) Error() string + func (e *LifecycleRunError) Unwrap() error + type ManagedServerRunError struct + Err error + Stage string + func (e *ManagedServerRunError) Error() string + func (e *ManagedServerRunError) Unwrap() error + type RegisterReplayError struct + Err error + ServiceName string + ServicePort int + func (e *RegisterReplayError) Error() string + func (e *RegisterReplayError) Unwrap() error type Status + DisconnectCount int + LastConnectedAt string + LastDisconnectedAt string + LastError string + LastErrorAt string + LastErrorKind string + LastEventAt string + LastEventId string + LastEventType string + RegisterReplayCount int + RegisterReplayFailureCount int + type WatchEventParseError struct + Err error + EventId string + EventType string + Payload string + func (e *WatchEventParseError) Error() string + func (e *WatchEventParseError) Unwrap() error + type WatchHTTPStatusError struct + Status string + StatusCode int + func (e *WatchHTTPStatusError) Error() string v0.0.7 Apr 18, 2026 v0.0.6 Apr 18, 2026 v0.0.5 Apr 14, 2026 Changes in this version + const DefaultAdminBaseURL + const DefaultReconnectInterval + const DefaultRequestTimeout + const DefaultWatchPath + type Client interface + Deregister func(ctx context.Context, request DeregisterRequest) error + Drain func(ctx context.Context, request DrainRequest) error + Register func(ctx context.Context, request RegisterRequest) error + type ConnectionEvent struct + Connected bool + Err error + type Controller struct + func NewController(client Client, provider DescriptorProvider) (*Controller, error) + func (c *Controller) Deregister(ctx context.Context) error + func (c *Controller) Drain(ctx context.Context, gracePeriod string) error + func (c *Controller) OnConnected(ctx context.Context) error + func (c *Controller) OnDisconnected() + func (c *Controller) Status() Status + type DeregisterRequest struct + Name string + Port int + type DescriptorProvider interface + BuildRegisterRequest func(ctx context.Context) (RegisterRequest, error) + type DrainRequest struct + GracePeriod string + Name string + Port int + type ErrorHandler func(context.Context, error) + type EventSource interface + Subscribe func(ctx context.Context) (<-chan ConnectionEvent, error) + type GRPCDescriptorOptions struct + AppId string + AppName string + DNS string + Env string + Namespace string + Port int + Protocol string + RawServices []*grpc.ServiceDesc + ServiceName string + ServiceOptions *ServiceOptions + Version string + type JSONHTTPClient struct + func NewJSONHTTPClient(baseURL string, timeout time.Duration) *JSONHTTPClient + func (c *JSONHTTPClient) Deregister(ctx context.Context, request DeregisterRequest) error + func (c *JSONHTTPClient) Drain(ctx context.Context, request DrainRequest) error + func (c *JSONHTTPClient) Register(ctx context.Context, request RegisterRequest) error + type KernelInfo struct + Language string + Version string + type LifecycleOptions struct + GracePeriod string + Runtime *LocalRuntime + type LocalRuntime struct + Client *JSONHTTPClient + Controller *Controller + Runner *Runner + Source *WatchSource + func NewLocalRuntime(provider DescriptorProvider, options LocalRuntimeOptions) (*LocalRuntime, error) + func NewLocalRuntimeFromServiceRegistration(descriptor ServiceRegistration, options LocalRuntimeOptions) (*LocalRuntime, error) + func (r *LocalRuntime) Deregister(ctx context.Context) error + func (r *LocalRuntime) Drain(ctx context.Context, gracePeriod string) error + func (r *LocalRuntime) Run(ctx context.Context) error + func (r *LocalRuntime) Status() Status + type LocalRuntimeOptions struct + BaseURL string + OnError ErrorHandler + ReconnectInterval time.Duration + RequestTimeout time.Duration + WatchURL string + func DefaultLocalRuntimeOptions(baseURL string) LocalRuntimeOptions + type ManagedServer struct + func NewManagedServer(options ManagedServerOptions) (*ManagedServer, error) + func (s *ManagedServer) Run(ctx context.Context) error + type ManagedServerOptions struct + Lifecycle *ServiceLifecycle + Serve ServeFunc + Shutdown ShutdownFunc + type RegisterRequest struct + AppID string + AppName string + DNS string + Env string + Kernel KernelInfo + Methods []string + Name string + Namespace string + Port int + Protocol string + Version string + Weight int + type Runner struct + func NewRunner(source EventSource, controller *Controller, onError ErrorHandler) (*Runner, error) + func (r *Runner) Run(ctx context.Context) error + type ServeFunc func(context.Context) error + type ServiceKernel struct + Language string + Version string + func (k *ServiceKernel) Bootstrap() + type ServiceLifecycle struct + func NewServiceLifecycle(options LifecycleOptions) (*ServiceLifecycle, error) + func NewServiceLifecycleFromGRPC(descriptorOptions GRPCDescriptorOptions, runtimeOptions LocalRuntimeOptions, ...) (*ServiceLifecycle, error) + func NewServiceLifecycleFromServiceRegistration(descriptor ServiceRegistration, runtimeOptions LocalRuntimeOptions, ...) (*ServiceLifecycle, error) + func (l *ServiceLifecycle) Deregister(ctx context.Context) error + func (l *ServiceLifecycle) Drain(ctx context.Context) error + func (l *ServiceLifecycle) Shutdown(ctx context.Context) error + func (l *ServiceLifecycle) Start(ctx context.Context) <-chan error + func (l *ServiceLifecycle) Status() Status + type ServiceMeta struct + AppId string + Env string + InstanceId string + Version string + type ServiceNode struct + Kernel *ServiceKernel + Meta *ServiceMeta + Methods map[string]bool + ProtoCount int + RunDate string + Weight int + type ServiceOptions struct + InstanceId string + Kernel *ServiceKernel + MaxRetry uint32 + Namespace string + TTL uint32 + Weight int + func (o *ServiceOptions) Bootstrap() + type ServiceRegistration struct + AppId string + AppName string + DNS string + Env string + Namespace string + Node *ServiceNode + Port int + Protocol string + ServiceName string + Version string + Weight int + func NewServiceRegistrationFromGRPC(options GRPCDescriptorOptions) (ServiceRegistration, error) + type ServiceRegistrationProvider struct + func NewServiceRegistrationProvider(descriptor ServiceRegistration) (*ServiceRegistrationProvider, error) + func (p *ServiceRegistrationProvider) BuildRegisterRequest(ctx context.Context) (RegisterRequest, error) + type ShutdownFunc func(context.Context) error + type Status struct + Connected bool + LastServiceName string + LastServicePort int + Registered bool + type WatchSource struct + func NewWatchSource(watchURL string, reconnectInterval time.Duration) *WatchSource + func (s *WatchSource) Subscribe(ctx context.Context) (<-chan ConnectionEvent, error)