Documentation
¶
Index ¶
- type ClientConfig
- type Config
- type GRPCBroker
- type GRPCConfig
- type Handle
- func (h *Handle) Client() any
- func (h *Handle) Close(ctx context.Context) error
- func (h *Handle) Info() Info
- func (h *Handle) PluginPath() string
- func (h *Handle) ReadFile(resource string) ([]byte, error)
- func (h *Handle) ResolvePath(resource string) (string, error)
- func (h *Handle) RootPath() string
- type HandshakeConfig
- type Info
- type Manager
- type Protocol
- type WASMConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientConfig ¶
type ClientConfig = hcplugin.ClientConfig
type Config ¶
type Config struct {
TempDir string
GRPC *GRPCConfig
WASM *WASMConfig
}
type GRPCBroker ¶ added in v0.1.2
type GRPCBroker struct {
// contains filtered or unexported fields
}
GRPCBroker wraps hashicorp go-plugin broker for host-side usage.
func (*GRPCBroker) AcceptAndServe ¶ added in v0.1.2
func (b *GRPCBroker) AcceptAndServe(id uint32, register func(*grpc.Server))
AcceptAndServe serves a gRPC server on broker stream id.
func (*GRPCBroker) NextID ¶ added in v0.1.2
func (b *GRPCBroker) NextID() uint32
NextID returns a unique broker stream ID.
type GRPCConfig ¶
type GRPCConfig struct {
HandshakeConfig HandshakeConfig
RunAsUser string
AllowedProtocols []Protocol
Stderr io.Writer
SyncStdout io.Writer
SyncStderr io.Writer
// Loader is used by the default gRPC preset.
// If nil, the preset returns *grpc.ClientConn as client.
Loader func(ctx context.Context, conn *grpc.ClientConn) (any, error)
// LoaderWithBroker is used by the default gRPC preset.
// If set, it takes precedence over Loader and receives GRPCBroker.
LoaderWithBroker func(ctx context.Context, broker *GRPCBroker, conn *grpc.ClientConn) (any, error)
ClientConfigOverride func(*ClientConfig)
}
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
func (*Handle) PluginPath ¶
func (*Handle) ReadFile ¶ added in v0.1.1
ReadFile reads bytes from a plugin resource under Content.
func (*Handle) ResolvePath ¶ added in v0.1.1
ResolvePath maps a plugin resource reference to an absolute file path under Content.
The resource can be one of: - "/greet.txt" - "greet.txt" - "Content/greet.txt" - "<plugin-file>.plg/Content/greet.txt"
type HandshakeConfig ¶
type Info ¶
type Protocol ¶
type Protocol string
const (
ProtocolGRPC Protocol = Protocol(hcplugin.ProtocolGRPC)
)
type WASMConfig ¶
type WASMConfig struct {
// Loader receives resolved module path from info.Command and returns:
// 1) plugin client instance used by caller
// 2) cleanup function invoked on Unload
Loader func(ctx context.Context, modulePath string, info Info) (client any, cleanup func(context.Context) error, err error)
// Reserved for future parity with design doc.
RuntimeConfigOverride any
}
Click to show internal directories.
Click to hide internal directories.