rpc

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbortArgs

type AbortArgs struct {
	Rollout *v1alpha1.Rollout
	Context *types.RpcStepContext
}

type Response

type Response struct {
	Result types.RpcStepResult
	Error  types.RpcError
}

type RpcStepPlugin

type RpcStepPlugin struct {
	// Impl Injection
	Impl StepPlugin
}

RpcStepPlugin This is the implementation of plugin.Plugin so we can serve/consume

This has two methods: Server must return an RPC server for this plugin type. We construct a StepRPCServer for this.

Client must return an implementation of our interface that communicates over an RPC client. We return StepPluginRPC for this.

Ignore MuxBroker. That is used to create more multiplexed streams on our plugin connection and is a more advanced use case.

func (RpcStepPlugin) Client

func (RpcStepPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (any, error)

func (*RpcStepPlugin) Server

func (p *RpcStepPlugin) Server(*plugin.MuxBroker) (any, error)

type RunArgs

type RunArgs struct {
	Rollout *v1alpha1.Rollout
	Context *types.RpcStepContext
}

type StepPlugin

type StepPlugin interface {
	InitPlugin() types.RpcError
	types.RpcStep
}

StepPlugin is the interface that we're exposing as a plugin. It needs to match metricproviders.Providers but we can not import that package because it would create a circular dependency.

type StepPluginRPC

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

StepPluginRPC Here is an implementation that talks over RPC

func (*StepPluginRPC) Abort

Abort reverts previous operation executed by the step if necessary

func (*StepPluginRPC) InitPlugin

func (g *StepPluginRPC) InitPlugin() types.RpcError

InitPlugin is the client aka the controller side function that calls the server side rpc (plugin) this gets called once during startup of the plugin and can be used to set up informers, k8s clients, etc.

func (*StepPluginRPC) Run

Run executes the step

func (*StepPluginRPC) Terminate

func (g *StepPluginRPC) Terminate(rollout *v1alpha1.Rollout, context *types.RpcStepContext) (types.RpcStepResult, types.RpcError)

Terminate stops the execution of a running step and exits early

func (*StepPluginRPC) Type

func (g *StepPluginRPC) Type() string

Type returns the type of the traffic routing reconciler

type StepRPCServer

type StepRPCServer struct {
	// This is the real implementation
	Impl StepPlugin
}

StepRPCServer Here is the RPC server that MetricsPluginRPC talks to, conforming to the requirements of net/rpc

func (*StepRPCServer) Abort

func (s *StepRPCServer) Abort(args any, resp *Response) error

Abort reverts previous operation executed by the step if necessary

func (*StepRPCServer) InitPlugin

func (s *StepRPCServer) InitPlugin(args any, resp *types.RpcError) error

InitPlugin this is the server aka the controller side function that receives calls from the client side rpc (controller) this gets called once during startup of the plugin and can be used to set up informers or k8s clients etc.

func (*StepRPCServer) Run

func (s *StepRPCServer) Run(args any, resp *Response) error

Run executes the step

func (*StepRPCServer) Terminate

func (s *StepRPCServer) Terminate(args any, resp *Response) error

Terminate stops the execution of a running step and exits early

func (*StepRPCServer) Type

func (s *StepRPCServer) Type(args any, resp *string) error

Type returns the type of the traffic routing reconciler

type TerminateArgs

type TerminateArgs struct {
	Rollout *v1alpha1.Rollout
	Context *types.RpcStepContext
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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