Documentation
¶
Overview ¶
Package plugin connects courier and a provider running as its own service over courier.plugin.v1.ProviderService. A plugin written in Go implements provider.Provider and calls Serve; one in another language implements the service from proto/courier/plugin/v1. Courier dials a plugin with Dial; where and how the plugin runs (a sidecar, another container, a process the image starts) is the deployment's concern.
Index ¶
- Constants
- Variables
- func Serve(address string, p provider.Provider, opts ...ServeOption) error
- func ServeListener(ctx context.Context, lis net.Listener, p provider.Provider, ...) error
- type Client
- func (c *Client) Check(ctx context.Context, ch provider.Channel) error
- func (c *Client) Close() error
- func (c *Client) Describe(ctx context.Context) (provider.Descriptor, error)
- func (c *Client) Health(ctx context.Context) error
- func (c *Client) Send(ctx context.Context, d provider.Delivery) ([]byte, error)
- func (c *Client) Target() string
- func (c *Client) WaitDescribe(ctx context.Context) (provider.Descriptor, error)
- type DialOption
- type ServeOption
Constants ¶
const ServiceName = "courier.plugin.v1.ProviderService"
ServiceName is the plugin service's name in the gRPC health protocol.
Variables ¶
var ErrNotServing = errors.New("not serving")
ErrNotServing: the plugin's health is not SERVING.
Functions ¶
func Serve ¶
func Serve(address string, p provider.Provider, opts ...ServeOption) error
Serve runs p as a plugin on address (unix:///path or host:port) until SIGINT or SIGTERM.
func ServeListener ¶
func ServeListener(ctx context.Context, lis net.Listener, p provider.Provider, opts ...ServeOption) error
ServeListener serves p on lis until ctx ends, with the standard gRPC health service: SERVING while it runs, NOT_SERVING once it stops.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a plugin as a provider.Provider.
func Dial ¶
func Dial(target string, opts ...DialOption) (*Client, error)
Dial prepares a connection to a plugin: target is "unix:///path" or "host:port". Nothing connects until the first call; gRPC reconnects with backoff whenever the plugin goes away, and keepalive pings notice a dead peer. Without WithTLS the connection is plaintext: keep such a plugin next to courier (a sidecar, a unix socket on a shared volume).
func (*Client) WaitDescribe ¶
WaitDescribe is Describe that waits for the plugin to come up, until ctx ends: courier's startup, when the plugin may start after it.
type DialOption ¶
type DialOption func(*[]grpc.DialOption)
DialOption configures Dial.
func WithDialOptions ¶
func WithDialOptions(opts ...grpc.DialOption) DialOption
WithDialOptions adds gRPC dial options (interceptors, limits).
func WithTLS ¶
func WithTLS(cfg *tls.Config) DialOption
WithTLS dials over TLS (mTLS when cfg carries a client certificate).
type ServeOption ¶
type ServeOption func(*serveOptions)
ServeOption configures Serve and ServeListener.
func WithServerOptions ¶
func WithServerOptions(opts ...grpc.ServerOption) ServeOption
WithServerOptions adds gRPC server options (interceptors, limits).
func WithServerTLS ¶
func WithServerTLS(cfg *tls.Config) ServeOption
WithServerTLS serves over TLS (mTLS when cfg requires client certificates); courier dials with its plugin's tls settings.