shared

package
v0.0.0-...-fe78729 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Handshake = plugin.HandshakeConfig{

	ProtocolVersion:  1,
	MagicCookieKey:   "KAFKA_OFFSET_PLUGIN",
	MagicCookieValue: "kafka-offset",
}

Handshake is a common handshake that is shared by plugin and host.

View Source
var PluginMap = map[string]plugin.Plugin{
	"kafka_grpc": &KafkaGRPCPlugin{},
}

PluginMap is the map of plugins we can dispense.

Functions

This section is empty.

Types

type GRPCClient

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

GRPCClient is an implementation of KV that talks over RPC.

func (*GRPCClient) WriteKafkaMetrics

func (plugin *GRPCClient) WriteKafkaMetrics(m []any) error

WriteKafkaMetrics send to grpc server proto.KafkaGauge & proto.KafkaMeter

type GRPCServer

type GRPCServer struct {
	// This is the real implementation
	Impl KafkaPlugin

	proto.UnimplementedKafkaPluginServer
}

GRPCServer gRPC server that GRPCClient talks to.

func (*GRPCServer) WriteKafkaMetrics

func (s *GRPCServer) WriteKafkaMetrics(ctx context.Context, in *proto.WriteKafkaMetricsRequest) (*proto.Empty, error)

WriteKafkaMetrics send to plugin proto.KafkaGauge & proto.KafkaMeter

type KafkaGRPCPlugin

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

KafkaGRPCPlugin go-plugin struct to make of plugin

func (*KafkaGRPCPlugin) GRPCClient

func (p *KafkaGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (any, error)

GRPCClient build GRPC client over go-plugin

func (*KafkaGRPCPlugin) GRPCServer

func (p *KafkaGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

GRPCServer register kafka plugin over GRPC

type KafkaPlugin

type KafkaPlugin interface {
	WriteKafkaMetrics([]any) error
}

KafkaPlugin interface of sink plugin

Jump to

Keyboard shortcuts

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