shared

package
v6.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package shared contains types which are shared between plugin implementation and plugin clients

Package shared contains shared data between the host and plugins.

Index

Constants

This section is empty.

Variables

View Source
var Handshake = plugin.HandshakeConfig{
	MagicCookieKey:   "MANTIX_PLUGIN_MAGIC_COOKIE",
	MagicCookieValue: "really-complex-permanent-string-value",
}

Handshake is a common handshake that is shared by plugin and host. See https://github.com/hashicorp/terraform/blob/ba6e243bd97fda935f903da0d420e5ed94e35c9e/plugin/serve.go#L24

Functions

This section is empty.

Types

type GRPCClient

type GRPCClient struct {
	// contains filtered or unexported fields
}

GRPCClient is an implementation of WrapperPluginClient service that talks over RPC.

func (*GRPCClient) EstablishMessageStream

func (c *GRPCClient) EstablishMessageStream() (proto.WrapperPlugin_EstablishMessageStreamClient, error)

func (*GRPCClient) GetRateLimiters

func (*GRPCClient) GetSchema

func (*GRPCClient) SetAllConnectionConfigs

func (*GRPCClient) SetCacheOptions

func (*GRPCClient) SetConnectionConfig

func (*GRPCClient) SetRateLimiters

type GRPCServer

type GRPCServer struct {
	proto.UnimplementedWrapperPluginServer
	// This is the real implementation
	Impl WrapperPluginServer
}

GRPCServer is the gRPC server that GRPCClient talks to.

func (*GRPCServer) Execute

func (*GRPCServer) GetRateLimiters

func (*GRPCServer) GetSchema

func (*GRPCServer) SetCacheOptions

func (*GRPCServer) SetRateLimiters

type WrapperPlugin

type WrapperPlugin struct {
	// GRPCPlugin must still implement the Stub interface
	plugin.Plugin
	// Concrete implementation, written in Go. This is only used for plugins
	// that are written in Go.
	Impl WrapperPluginServer
}

This is the implementation of plugin.GRPCServer so we can serve/consume this.

func (*WrapperPlugin) GRPCClient

func (p *WrapperPlugin) GRPCClient(ctx context.Context, _ *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

return a GRPCClient, called by Dispense

func (*WrapperPlugin) GRPCServer

func (p *WrapperPlugin) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error

type WrapperPluginClient

type WrapperPluginClient interface {
	GetSchema(request *proto.GetSchemaRequest) (*proto.GetSchemaResponse, error)
	Execute(req *proto.ExecuteRequest) (proto.WrapperPlugin_ExecuteClient, context.Context, context.CancelFunc, error)
	//nolint:staticcheck // SetConnectionConfigRequest is the generated wire type for the WrapperPlugin gRPC service and must match its signature; see #970
	SetConnectionConfig(req *proto.SetConnectionConfigRequest) (*proto.SetConnectionConfigResponse, error)
	SetAllConnectionConfigs(req *proto.SetAllConnectionConfigsRequest) (*proto.SetConnectionConfigResponse, error)
	UpdateConnectionConfigs(req *proto.UpdateConnectionConfigsRequest) (*proto.UpdateConnectionConfigsResponse, error)
	GetSupportedOperations(req *proto.GetSupportedOperationsRequest) (*proto.GetSupportedOperationsResponse, error)
	SetCacheOptions(req *proto.SetCacheOptionsRequest) (*proto.SetCacheOptionsResponse, error)
	SetRateLimiters(req *proto.SetRateLimitersRequest) (*proto.SetRateLimitersResponse, error)
	GetRateLimiters(req *proto.GetRateLimitersRequest) (*proto.GetRateLimitersResponse, error)
	EstablishMessageStream() (proto.WrapperPlugin_EstablishMessageStreamClient, error)
	SetConnectionCacheOptions(req *proto.SetConnectionCacheOptionsRequest) (*proto.SetConnectionCacheOptionsResponse, error)
}

type WrapperPluginServer

type WrapperPluginServer interface {
	GetSchema(req *proto.GetSchemaRequest) (*proto.GetSchemaResponse, error)
	Execute(req *proto.ExecuteRequest, stream proto.WrapperPlugin_ExecuteServer) error
	//nolint:staticcheck // SetConnectionConfigRequest is the generated wire type for the WrapperPlugin gRPC service and must match its signature; see #970
	SetConnectionConfig(req *proto.SetConnectionConfigRequest) (*proto.SetConnectionConfigResponse, error)
	SetAllConnectionConfigs(req *proto.SetAllConnectionConfigsRequest) (*proto.SetConnectionConfigResponse, error)
	UpdateConnectionConfigs(req *proto.UpdateConnectionConfigsRequest) (*proto.UpdateConnectionConfigsResponse, error)
	GetSupportedOperations(req *proto.GetSupportedOperationsRequest) (*proto.GetSupportedOperationsResponse, error)
	SetCacheOptions(req *proto.SetCacheOptionsRequest) (*proto.SetCacheOptionsResponse, error)
	SetRateLimiters(req *proto.SetRateLimitersRequest) (*proto.SetRateLimitersResponse, error)
	GetRateLimiters(req *proto.GetRateLimitersRequest) (*proto.GetRateLimitersResponse, error)
	EstablishMessageStream(server proto.WrapperPlugin_EstablishMessageStreamServer) error
	SetConnectionCacheOptions(req *proto.SetConnectionCacheOptionsRequest) (*proto.SetConnectionCacheOptionsResponse, error)
}

this is the interface for the plugin service NOTE there are 2 versions - the server interface (implemented by the actual plugin) - the client interface (implemented by the client stub) this is because the signature of the client and server are difference when using grpc streaming

Jump to

Keyboard shortcuts

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