Documentation
¶
Overview ¶
Package lifecycle exposes plugin identity, declared capabilities, and process readiness over gRPC.
Index ¶
- type Client
- func (c *Client) BindHostServices(ctx context.Context, brokerID uint32, version uint32) (uint32, error)
- func (c *Client) GetCapabilities(ctx context.Context) (*lifecyclepb.GetCapabilitiesResponse, error)
- func (c *Client) GetDiagnostics(ctx context.Context, maxSchemaVersion uint32) (*lifecyclepb.GetDiagnosticsResponse, error)
- func (c *Client) GetInfo(ctx context.Context) (*lifecyclepb.GetInfoResponse, error)
- func (c *Client) GetProfilingStatus(ctx context.Context) (*lifecyclepb.ProfilingStatusResponse, error)
- func (c *Client) HealthCheck(ctx context.Context) (*lifecyclepb.HealthCheckResponse, error)
- func (c *Client) ServeActivities(ctx context.Context, reporter activity.Reporter) (stop func(), err error)
- func (c *Client) ServeHostConnections(ctx context.Context, service hostconnections.Service) (stop func(), err error)
- type Plugin
- type Server
- func (s *Server) BindHostServices(_ context.Context, req *lifecyclepb.BindHostServicesRequest) (*lifecyclepb.BindHostServicesResponse, error)
- func (s *Server) GetCapabilities(_ context.Context, _ *emptypb.Empty) (*lifecyclepb.GetCapabilitiesResponse, error)
- func (s *Server) GetDiagnostics(_ context.Context, _ *lifecyclepb.GetDiagnosticsRequest) (*lifecyclepb.GetDiagnosticsResponse, error)
- func (s *Server) GetInfo(_ context.Context, _ *emptypb.Empty) (*lifecyclepb.GetInfoResponse, error)
- func (s *Server) GetProfilingStatus(_ context.Context, _ *emptypb.Empty) (*lifecyclepb.ProfilingStatusResponse, error)
- func (s *Server) HealthCheck(_ context.Context, _ *emptypb.Empty) (*lifecyclepb.HealthCheckResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the generated gRPC client for the PluginLifecycle service.
func NewClient ¶
func NewClient(c lifecyclepb.PluginLifecycleClient) *Client
NewClient creates a properly initialized lifecycle Client.
func (*Client) BindHostServices ¶ added in v0.13.0
func (c *Client) BindHostServices(ctx context.Context, brokerID uint32, version uint32) (uint32, error)
BindHostServices negotiates the callback service for this plugin process.
func (*Client) GetCapabilities ¶
func (c *Client) GetCapabilities(ctx context.Context) (*lifecyclepb.GetCapabilitiesResponse, error)
GetCapabilities returns declared transports, not authorization or per-resource operation support.
func (*Client) GetDiagnostics ¶ added in v0.17.0
func (c *Client) GetDiagnostics(ctx context.Context, maxSchemaVersion uint32) (*lifecyclepb.GetDiagnosticsResponse, error)
GetDiagnostics pulls the plugin's measurement snapshot. Older plugins return codes.Unimplemented.
func (*Client) GetInfo ¶
func (c *Client) GetInfo(ctx context.Context) (*lifecyclepb.GetInfoResponse, error)
GetInfo returns plugin identity and protocol metadata, or an error for an uninitialized client.
func (*Client) GetProfilingStatus ¶ added in v0.11.0
func (c *Client) GetProfilingStatus(ctx context.Context) (*lifecyclepb.ProfilingStatusResponse, error)
GetProfilingStatus queries the profiler owned by the plugin process.
func (*Client) HealthCheck ¶
func (c *Client) HealthCheck(ctx context.Context) (*lifecyclepb.HealthCheckResponse, error)
HealthCheck queries process serving status, not native connection health.
func (*Client) ServeActivities ¶ added in v0.15.0
func (c *Client) ServeActivities(ctx context.Context, reporter activity.Reporter) (stop func(), err error)
ServeActivities negotiates a process-scoped reporting backchannel independent of delegated host connections. Context bounds negotiation only. Call stop when the process retires. An uncertain binding failure requires retiring the process.
func (*Client) ServeHostConnections ¶ added in v0.13.0
func (c *Client) ServeHostConnections(ctx context.Context, service hostconnections.Service) (stop func(), err error)
ServeHostConnections binds a callback server to this plugin process. The caller must invoke stop when the process or its grants retire. The context bounds binding only; stop owns the accepted server's lifetime. A binding error can follow remote acceptance. Retire the process on error instead of retrying a binding whose outcome is uncertain.
type Plugin ¶
type Plugin struct {
plugin.Plugin
// Impl is the concrete server implementation (set on plugin side).
Impl *Server
}
Plugin implements the go-plugin.Plugin interface for the lifecycle service. On the server side it registers the Server implementation. On the client side it returns a Client that wraps the gRPC stub.
func (*Plugin) GRPCClient ¶
func (p *Plugin) GRPCClient( _ context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn, ) (any, error)
GRPCClient returns a lifecycle client using the supplied connection.
func (*Plugin) GRPCServer ¶
GRPCServer installs the lifecycle server supplied in Impl.
type Server ¶
type Server struct {
lifecyclepb.UnimplementedPluginLifecycleServer
PluginID string
Version string
SDKProtocolVersion int32
Capabilities []string
ProfilingStatus func() profiling.Status
// Diagnostics snapshots in-plugin measurements; nil serves an empty snapshot.
Diagnostics func() ([]*lifecyclepb.DiagMetric, bool)
// StartUnixNano identifies this process incarnation to the host.
StartUnixNano int64
HostConnections *hostconnections.Binding
Activities *activity.Binding
// contains filtered or unexported fields
}
Server implements the PluginLifecycle gRPC service. It is auto-populated by sdk.Plugin.Serve() — plugin authors never touch it.
func (*Server) BindHostServices ¶ added in v0.13.0
func (s *Server) BindHostServices(_ context.Context, req *lifecyclepb.BindHostServicesRequest) (*lifecyclepb.BindHostServicesResponse, error)
BindHostServices dials and binds the host callback exactly once.
func (*Server) GetCapabilities ¶
func (s *Server) GetCapabilities(_ context.Context, _ *emptypb.Empty) (*lifecyclepb.GetCapabilitiesResponse, error)
GetCapabilities returns the registered capability snapshot. Direct callers must not mutate its slice.
func (*Server) GetDiagnostics ¶ added in v0.17.0
func (s *Server) GetDiagnostics(_ context.Context, _ *lifecyclepb.GetDiagnosticsRequest) (*lifecyclepb.GetDiagnosticsResponse, error)
GetDiagnostics returns the bounded measurement snapshot. Schema 1 is the only payload; the response states its version so a host that understands fewer versions can reject it rather than misread it.
func (*Server) GetInfo ¶
func (s *Server) GetInfo(_ context.Context, _ *emptypb.Empty) (*lifecyclepb.GetInfoResponse, error)
GetInfo returns the process metadata captured at lifecycle registration.
func (*Server) GetProfilingStatus ¶ added in v0.11.0
func (s *Server) GetProfilingStatus(_ context.Context, _ *emptypb.Empty) (*lifecyclepb.ProfilingStatusResponse, error)
GetProfilingStatus reports current listener facts and this process's PID.
func (*Server) HealthCheck ¶
func (s *Server) HealthCheck(_ context.Context, _ *emptypb.Empty) (*lifecyclepb.HealthCheckResponse, error)
HealthCheck reports that this plugin process serves RPCs; it does not probe providers.