goplugin

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const KeepAliveTickDuration = 5 * time.Second // TODO from config

Variables

View Source
var ErrPluginUnavailable = errors.New("plugin unavailable")

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 PluginClient

type PluginClient struct {
	net.AtomicBroker
	net.AtomicClient
	*net.BrokerExt
}

func NewPluginClient

func NewPluginClient(broker net.Broker, brokerCfg net.BrokerConfig, conn *grpc.ClientConn) *PluginClient

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
	// 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, p P, newService func(context.Context, any) (S, error),
	lggr logger.Logger, cmd func() *exec.Cmd, stopCh chan struct{})

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]) Start

func (s *PluginService[P, S]) Start(context.Context) 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

func (*ServiceClient) Start

func (s *ServiceClient) Start(ctx context.Context) error

type ServiceServer

type ServiceServer struct {
	pb.UnimplementedServiceServer
	Srv services.Service
}

func (*ServiceServer) Close

func (s *ServiceServer) Close(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error)

func (*ServiceServer) HealthReport

func (s *ServiceServer) HealthReport(ctx context.Context, empty *emptypb.Empty) (*pb.HealthReportReply, error)

func (*ServiceServer) Ready

func (s *ServiceServer) Ready(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, 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()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL