Documentation
¶
Index ¶
- Constants
- Variables
- type GRPCClientConn
- type NewService
- type PluginClient
- type PluginService
- func (s *PluginService[P, S]) Close() error
- func (s *PluginService[P, S]) HealthReport() map[string]error
- func (s *PluginService[P, S]) Init(pluginName string, grpcPlug P, newService NewService[S], lggr logger.Logger, ...)
- func (s *PluginService[P, S]) Name() string
- func (s *PluginService[P, S]) Ready() error
- func (s *PluginService[P, S]) Start(context.Context) error
- func (s *PluginService[P, S]) WaitCtx(ctx context.Context) error
- func (s *PluginService[P, S]) XXXTestHook() TestPluginService[P, S]
- type ServiceClient
- type ServiceServer
- func (s *ServiceServer) Close(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error)
- func (s *ServiceServer) HealthReport(ctx context.Context, empty *emptypb.Empty) (*pb.HealthReportReply, error)
- func (s *ServiceServer) Ready(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error)
- type TestPluginService
Constants ¶
const KeepAliveTickDuration = 5 * time.Second // TODO from config
Variables ¶
Functions ¶
This section is empty.
Types ¶
type GRPCClientConn ¶
type GRPCClientConn interface {
// ClientConn returns the underlying client connection.
ClientConn() grpc.ClientConnInterface
}
GRPCClientConn is implemented by clients to expose their connection for efficient proxying.
type NewService ¶ added in v0.5.0
NewService funcs returns an S and a HeathReporter, which should provide the top level health report for the whole plugin, and which may be the same as S.
type PluginClient ¶
type PluginClient struct {
net.AtomicBroker
net.AtomicClient
*net.BrokerExt
}
func NewPluginClient ¶
func NewPluginClient(brokerCfg net.BrokerConfig) *PluginClient
NewPluginClient creates a *PluginClient. Refresh must be called to initialize the net.Broker and *grpc.ClientConn.
func (*PluginClient) Refresh ¶
func (p *PluginClient) Refresh(broker net.Broker, conn *grpc.ClientConn)
type PluginService ¶
type PluginService[P grpcPlugin, S services.Service] struct { services.StateMachine Service S HealthReporter services.HealthReporter // may be the same as Service // contains filtered or unexported fields }
PluginService is a [types.Service] wrapper that maintains an internal [types.Service] created from a [grpcPlugin] client instance by launching and re-launching as necessary.
func (*PluginService[P, S]) Close ¶
func (s *PluginService[P, S]) Close() error
func (*PluginService[P, S]) HealthReport ¶
func (s *PluginService[P, S]) HealthReport() map[string]error
func (*PluginService[P, S]) Init ¶
func (s *PluginService[P, S]) Init( pluginName string, grpcPlug P, newService NewService[S], lggr logger.Logger, cmd func() *exec.Cmd, stopCh chan struct{}, )
Init initializes s and should be called from the constructor of the type that embeds it.
newService transforms the type-less plugin in to a Service and HealthReporter. If the plugin is only type-cast to S then it should be returned as the HealthReporter too. If additional calls are made after casting to create S, then the originally cast value should be returned as the HealthReporter to provide a root level health report.
func (*PluginService[P, S]) Name ¶
func (s *PluginService[P, S]) Name() string
func (*PluginService[P, S]) Ready ¶
func (s *PluginService[P, S]) Ready() error
func (*PluginService[P, S]) WaitCtx ¶
func (s *PluginService[P, S]) WaitCtx(ctx context.Context) error
WaitCtx waits for the service to start up until `ctx.Done` is triggered or it receives the stop signal.
func (*PluginService[P, S]) XXXTestHook ¶
func (s *PluginService[P, S]) XXXTestHook() TestPluginService[P, S]
XXXTestHook returns a TestPluginService. It must only be called once, and before Start.
type ServiceClient ¶
type ServiceClient struct {
// contains filtered or unexported fields
}
ServiceClient is the base client implementation of a loop as a client to the core node or to another loop that is proxied through the core node.
func NewServiceClient ¶
func NewServiceClient(b *net.BrokerExt, cc grpc.ClientConnInterface) *ServiceClient
func (*ServiceClient) ClientConn ¶
func (s *ServiceClient) ClientConn() grpc.ClientConnInterface
ClientConn implements GRPCClientConn interface.
func (*ServiceClient) Close ¶
func (s *ServiceClient) Close() error
func (*ServiceClient) HealthReport ¶
func (s *ServiceClient) HealthReport() map[string]error
func (*ServiceClient) Name ¶
func (s *ServiceClient) Name() string
func (*ServiceClient) Ready ¶
func (s *ServiceClient) Ready() error
type ServiceServer ¶
type ServiceServer struct {
pb.UnimplementedServiceServer
Srv services.Service
}
func (*ServiceServer) HealthReport ¶
func (s *ServiceServer) HealthReport(ctx context.Context, empty *emptypb.Empty) (*pb.HealthReportReply, error)
type TestPluginService ¶
type TestPluginService[P grpcPlugin, S services.Service] chan<- func(*PluginService[P, S])
TestPluginService supports Killing & Resetting a running *pluginService.
func (TestPluginService[P, S]) Kill ¶
func (ch TestPluginService[P, S]) Kill()
func (TestPluginService[P, S]) Reset ¶
func (ch TestPluginService[P, S]) Reset()