shared

package
v0.0.0-...-3458964 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *zap.Logger

Functions

This section is empty.

Types

type AddHelper

type AddHelper interface {
	Sum(string, string) (string, error)
}

除了标准的Protocol接口(自动注册) AddHelper 提供了额外的接口,用来自定义额外处理逻辑及调用时机

type AddHelperImpl

type AddHelperImpl struct{}

func (*AddHelperImpl) Sum

func (*AddHelperImpl) Sum(a, b string) (string, error)

type GRPCAddHelperClient

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

GRPCClient is an implementation of KV that talks over RPC.

func (*GRPCAddHelperClient) Sum

func (m *GRPCAddHelperClient) Sum(a, b string) (string, error)

type GRPCAddHelperServer

type GRPCAddHelperServer struct {
	// This is the real implementation
	Impl AddHelper
}

Here is the gRPC server that GRPCClient talks to.

func (*GRPCAddHelperServer) Sum

func (m *GRPCAddHelperServer) Sum(ctx context.Context, req *proto.SumRequest) (resp *proto.SumResponse, err error)

type GRPCClient

type GRPCClient struct {
	Broker *plugin.GRPCBroker
	Client proto.PluginClient
	Logger *zap.Logger
}

GRPCClient is an implementation of KV that talks over RPC.

func (*GRPCClient) Decode

func (m *GRPCClient) Decode(data model.DataReq) model.JsonRes

func (*GRPCClient) Encode

func (m *GRPCClient) Encode(args string) model.JsonRes

func (*GRPCClient) Get

func (m *GRPCClient) Get(key string) (string, error)

func (*GRPCClient) Info

func (m *GRPCClient) Info(args string) model.PluginInfo

func (*GRPCClient) Put

func (m *GRPCClient) Put(key string, value string, a AddHelper) error

type GRPCServer

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

	Broker *plugin.GRPCBroker
}

Here is the gRPC server that GRPCClient talks to.

func (*GRPCServer) Decode

func (*GRPCServer) Encode

func (*GRPCServer) Get

func (*GRPCServer) Info

func (*GRPCServer) Put

func (m *GRPCServer) Put(ctx context.Context, req *proto.PutRequest) (*proto.Empty, error)

type Protocol

type Protocol interface {
	Put(key string, value string, a AddHelper) error
	Get(key string) (string, error)
	Info(args string) model.PluginInfo
	Encode(args string) model.JsonRes
	Decode(data model.DataReq) model.JsonRes
}

GRPC协议插件接口.

Jump to

Keyboard shortcuts

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