shared

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Handshake = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "PLUGIN",
	MagicCookieValue: "handler",
}

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

Functions

func GetMetadataFromContext

func GetMetadataFromContext(ctx context.Context, key string) []string

GetMetadataFromContext gets metadata from the asserted MetadataContext type from the generic context.Context interface

func SetMetadataFromContext

func SetMetadataFromContext(ctx context.Context, kv ...string) error

SetMetadataFromContext sets metadata into the asserted MetadataContext type from the generic context.Context interface

Types

type HandlerPrivatePlugin

type HandlerPrivatePlugin struct {
	// Impl Injection
	Impl mgmtPB.MgmtPrivateServiceServer
}

HandlerPrivatePlugin is the implementation of plugin.Plugin so we can serve/consume this

func (HandlerPrivatePlugin) Client

func (HandlerPrivatePlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

Client is to implement the plugin.Plugin interface method

func (*HandlerPrivatePlugin) Server

func (h *HandlerPrivatePlugin) Server(*plugin.MuxBroker) (interface{}, error)

Server is to implement the plugin.Plugin interface method

type HandlerPrivateRPC

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

HandlerPrivateRPC is an implementation that talks over RPC

func (*HandlerPrivateRPC) CreateUserAdmin

CreateUserAdmin is method interface for plugin client

func (*HandlerPrivateRPC) DeleteUserAdmin

DeleteUserAdmin is method interface for plugin client

func (*HandlerPrivateRPC) GetUserAdmin

GetUserAdmin is method interface for plugin client

func (*HandlerPrivateRPC) ListUsersAdmin

ListUsersAdmin is method interface for plugin client

func (*HandlerPrivateRPC) LookUpUserAdmin

LookUpUserAdmin is method interface for plugin client

func (*HandlerPrivateRPC) UpdateUserAdmin

UpdateUserAdmin is method interface for plugin client

type HandlerPrivateRPCServer

type HandlerPrivateRPCServer struct {
	// This is the real implementation
	Impl mgmtPB.MgmtPrivateServiceServer
}

HandlerPrivateRPCServer is the RPC server that HandlerRPC talks to, conforming to the requirements of net/rpc

func (*HandlerPrivateRPCServer) CreateUserAdmin

func (h *HandlerPrivateRPCServer) CreateUserAdmin(reqW *RequestWrapper, respW *ResponseWrapper) error

CreateUserAdmin is the implementation for plugin server

func (*HandlerPrivateRPCServer) DeleteUserAdmin

func (h *HandlerPrivateRPCServer) DeleteUserAdmin(reqW *RequestWrapper, respW *ResponseWrapper) error

DeleteUserAdmin is the implementation for plugin server

func (*HandlerPrivateRPCServer) GetUserAdmin

func (h *HandlerPrivateRPCServer) GetUserAdmin(reqW *RequestWrapper, respW *ResponseWrapper) error

GetUserAdmin is the implementation for plugin server

func (*HandlerPrivateRPCServer) ListUsersAdmin

func (h *HandlerPrivateRPCServer) ListUsersAdmin(reqW *RequestWrapper, respW *ResponseWrapper) error

ListUsersAdmin is the implementation for plugin server

func (*HandlerPrivateRPCServer) LookUpUserAdmin

func (h *HandlerPrivateRPCServer) LookUpUserAdmin(reqW *RequestWrapper, respW *ResponseWrapper) error

LookUpUserAdmin is the implementation for plugin server

func (*HandlerPrivateRPCServer) UpdateUserAdmin

func (h *HandlerPrivateRPCServer) UpdateUserAdmin(reqW *RequestWrapper, respW *ResponseWrapper) error

UpdateUserAdmin is the implementation for plugin server

type HandlerPublicPlugin

type HandlerPublicPlugin struct {
	// Impl Injection
	Impl mgmtPB.MgmtPublicServiceServer
}

HandlerPublicPlugin is the implementation of plugin.Plugin so we can serve/consume this

func (HandlerPublicPlugin) Client

func (HandlerPublicPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

Client is to implement the plugin.Plugin interface method

func (*HandlerPublicPlugin) Server

func (h *HandlerPublicPlugin) Server(*plugin.MuxBroker) (interface{}, error)

Server is to implement the plugin.Plugin interface method

type HandlerPublicRPC

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

HandlerPublicRPC is an implementation that talks over RPC

func (*HandlerPublicRPC) ExistUsername

ExistUsername is method interface for plugin client

func (*HandlerPublicRPC) Liveness

func (h *HandlerPublicRPC) Liveness(ctx context.Context, req *mgmtPB.LivenessRequest) (resp *mgmtPB.LivenessResponse, err error)

Liveness is method interface for plugin client

func (*HandlerPublicRPC) PatchAuthenticatedUser

PatchAuthenticatedUser is method interface for plugin client

func (*HandlerPublicRPC) QueryAuthenticatedUser

QueryAuthenticatedUser is method interface for plugin client

func (*HandlerPublicRPC) Readiness

Readiness is method interface for plugin client

type HandlerPublicRPCServer

type HandlerPublicRPCServer struct {
	// This is the real implementation
	Impl mgmtPB.MgmtPublicServiceServer
}

HandlerPublicRPCServer is the RPC server that HandlerRPC talks to, conforming to the requirements of net/rpc

func (*HandlerPublicRPCServer) ExistUsername

func (h *HandlerPublicRPCServer) ExistUsername(reqW *RequestWrapper, respW *ResponseWrapper) error

ExistUsername is method interface for plugin server

func (*HandlerPublicRPCServer) Liveness

func (h *HandlerPublicRPCServer) Liveness(reqW *RequestWrapper, respW *ResponseWrapper) error

Liveness is method interface for plugin server

func (*HandlerPublicRPCServer) PatchAuthenticatedUser

func (h *HandlerPublicRPCServer) PatchAuthenticatedUser(reqW *RequestWrapper, respW *ResponseWrapper) error

PatchAuthenticatedUser is method interface for plugin server

func (*HandlerPublicRPCServer) QueryAuthenticatedUser

func (h *HandlerPublicRPCServer) QueryAuthenticatedUser(reqW *RequestWrapper, respW *ResponseWrapper) error

QueryAuthenticatedUser is method interface for plugin server

func (*HandlerPublicRPCServer) Readiness

func (h *HandlerPublicRPCServer) Readiness(reqW *RequestWrapper, respW *ResponseWrapper) error

Readiness is method interface for plugin server

type MetadataContext

type MetadataContext struct {
	context.Context
	MD *metadata.MD
}

MetadataContext is to be shared with plugin handler to pass custom HTTP code using grpc/metadata in the server side. This is a workaround for that we can't directly pass context through gob.

type RequestWrapper

type RequestWrapper struct {
	MetadataContext *MetadataContext
	RequestMessage  interface{}
}

RequestWrapper wrap a request protobuf message

type ResponseWrapper

type ResponseWrapper struct {
	MetadataContext *MetadataContext
	ResponseMessage interface{}
	StatusCode      codes.Code
	StatusMessage   string
	StatusDetails   []interface{}
}

ResponseWrapper wrap a response protobuf message with its status returned by gRPC

Jump to

Keyboard shortcuts

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