Documentation
¶
Overview ¶
Package grpc provides the gRPC-based plugin runtime implementation.
Index ¶
- func NewHCLogAdapter() hclog.Logger
- type GrpcPlugin
- type GrpcRunner
- func (r *GrpcRunner) Call(ctx context.Context, function string, params json.RawMessage) (json.RawMessage, error)
- func (r *GrpcRunner) Health(ctx context.Context) (*plugin.HealthStatus, error)
- func (r *GrpcRunner) Load(_ context.Context, m *plugin.Manifest) (*plugin.PluginInfo, error)
- func (r *GrpcRunner) SetHostAPI(api plugin.HostAPI)
- func (r *GrpcRunner) Start(ctx context.Context, config json.RawMessage) error
- func (r *GrpcRunner) Stop(ctx context.Context) error
- type HCLogAdapter
- type HostServer
- func (h *HostServer) EmitEvent(ctx context.Context, req *pb.EmitEventRequest) (*emptypb.Empty, error)
- func (h *HostServer) GetConfig(ctx context.Context, req *pb.GetConfigRequest) (*pb.GetConfigResponse, error)
- func (h *HostServer) HTTPRequest(ctx context.Context, req *pb.HTTPCallRequest) (*pb.HTTPCallResponse, error)
- func (h *HostServer) KVDelete(ctx context.Context, req *pb.KVDeleteRequest) (*emptypb.Empty, error)
- func (h *HostServer) KVGet(ctx context.Context, req *pb.KVGetRequest) (*pb.KVGetResponse, error)
- func (h *HostServer) KVSet(ctx context.Context, req *pb.KVSetRequest) (*emptypb.Empty, error)
- func (h *HostServer) Log(ctx context.Context, req *pb.LogRequest) (*emptypb.Empty, error)
- func (h *HostServer) Register(s *grpc.Server)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHCLogAdapter ¶
NewHCLogAdapter creates a logger adapter that discards go-plugin internal logs.
Types ¶
type GrpcPlugin ¶
type GrpcPlugin struct {
goPlugin.NetRPCUnsupportedPlugin
}
GrpcPlugin is the hashicorp/go-plugin adapter.
func (*GrpcPlugin) GRPCClient ¶
func (*GrpcPlugin) GRPCClient(_ context.Context, _ *goPlugin.GRPCBroker, c *grpc.ClientConn) (any, error)
func (*GrpcPlugin) GRPCServer ¶
func (*GrpcPlugin) GRPCServer(_ *goPlugin.GRPCBroker, _ *grpc.Server) error
type GrpcRunner ¶
type GrpcRunner struct {
// contains filtered or unexported fields
}
GrpcRunner implements plugin.Runner using hashicorp/go-plugin.
func NewGrpcRunner ¶
func NewGrpcRunner(m *plugin.Manifest) (*GrpcRunner, error)
NewGrpcRunner creates a gRPC runner for a plugin manifest.
func (*GrpcRunner) Call ¶
func (r *GrpcRunner) Call(ctx context.Context, function string, params json.RawMessage) (json.RawMessage, error)
Call invokes a named function on the plugin.
func (*GrpcRunner) Health ¶
func (r *GrpcRunner) Health(ctx context.Context) (*plugin.HealthStatus, error)
Health checks the plugin's readiness.
func (*GrpcRunner) Load ¶
func (r *GrpcRunner) Load(_ context.Context, m *plugin.Manifest) (*plugin.PluginInfo, error)
Load connects to the plugin process and retrieves its PluginInfo.
func (*GrpcRunner) SetHostAPI ¶
func (r *GrpcRunner) SetHostAPI(api plugin.HostAPI)
SetHostAPI sets the HostAPI for this runner (called by PluginManager).
func (*GrpcRunner) Start ¶
func (r *GrpcRunner) Start(ctx context.Context, config json.RawMessage) error
Start initializes the plugin via the Init() RPC.
type HCLogAdapter ¶
HCLogAdapter adapts go-plugin's hclog to flowbot's logging.
type HostServer ¶
type HostServer struct {
pb.UnimplementedHostServiceServer
// contains filtered or unexported fields
}
HostServer implements pb.HostServiceServer and delegates to a plugin.HostAPI.
func NewHostServer ¶
func NewHostServer(api plugin.HostAPI) *HostServer
NewHostServer creates a HostServer with the given HostAPI.
func (*HostServer) EmitEvent ¶
func (h *HostServer) EmitEvent(ctx context.Context, req *pb.EmitEventRequest) (*emptypb.Empty, error)
func (*HostServer) GetConfig ¶
func (h *HostServer) GetConfig(ctx context.Context, req *pb.GetConfigRequest) (*pb.GetConfigResponse, error)
func (*HostServer) HTTPRequest ¶
func (h *HostServer) HTTPRequest(ctx context.Context, req *pb.HTTPCallRequest) (*pb.HTTPCallResponse, error)
func (*HostServer) KVDelete ¶
func (h *HostServer) KVDelete(ctx context.Context, req *pb.KVDeleteRequest) (*emptypb.Empty, error)
func (*HostServer) KVGet ¶
func (h *HostServer) KVGet(ctx context.Context, req *pb.KVGetRequest) (*pb.KVGetResponse, error)
func (*HostServer) KVSet ¶
func (h *HostServer) KVSet(ctx context.Context, req *pb.KVSetRequest) (*emptypb.Empty, error)
func (*HostServer) Log ¶
func (h *HostServer) Log(ctx context.Context, req *pb.LogRequest) (*emptypb.Empty, error)
func (*HostServer) Register ¶
func (h *HostServer) Register(s *grpc.Server)
Register registers this server on a gRPC server.