server

package
v0.0.86 Latest Latest
Warning

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

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

Documentation

Overview

Package server is a wrapper for the Client gRPC API. It provides a simple interface to interact with and mock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ServerAddr string
	Token      string
	Conn       *grpc.ClientConn
	Server     protos.InternalClient
}

func New

func New(serverAddr, serverToken string) (*Client, error)

New dials a streamdal GRPC server and returns IServerClient

func (*Client) GetSetPipelinesCommandByService added in v0.0.85

func (c *Client) GetSetPipelinesCommandByService(ctx context.Context, service string) (*protos.GetSetPipelinesCommandsByServiceResponse, error)

func (*Client) GetTailStream

func (c *Client) GetTailStream(ctx context.Context) (protos.Internal_SendTailClient, error)

func (*Client) HeartBeat

func (c *Client) HeartBeat(ctx context.Context, req *protos.HeartbeatRequest) error

func (*Client) NewAudience

func (c *Client) NewAudience(ctx context.Context, aud *protos.Audience, sessionID string) error

func (*Client) Notify

func (c *Client) Notify(ctx context.Context, pipeline *protos.Pipeline, step *protos.PipelineStep, aud *protos.Audience) error

func (*Client) Reconnect

func (c *Client) Reconnect() error

func (*Client) Register

func (*Client) SendMetrics

func (c *Client) SendMetrics(ctx context.Context, counters []*types.CounterEntry) error

func (*Client) SendSchema

func (c *Client) SendSchema(ctx context.Context, aud *protos.Audience, jsonSchema []byte) error

type IServerClient

type IServerClient interface {
	// GetSetPipelinesCommandByService is called in New() in order to get all AttachCommands in a synchronous manner
	// before we allow the client to start processing.
	GetSetPipelinesCommandByService(ctx context.Context, service string) (*protos.GetSetPipelinesCommandsByServiceResponse, error)

	// GetTailStream returns a gRPC client stream used to send TailResponses to the streamdal server
	GetTailStream(ctx context.Context) (protos.Internal_SendTailClient, error)

	// HeartBeat sends a heartbeat to the streamdal server
	HeartBeat(ctx context.Context, req *protos.HeartbeatRequest) error

	// NewAudience announces a new audience to the streamdal server
	NewAudience(ctx context.Context, aud *protos.Audience, sessionID string) error

	// Notify calls to streamdal server to trigger the configured notification rules for the specified step
	Notify(ctx context.Context, pipeline *protos.Pipeline, step *protos.PipelineStep, aud *protos.Audience) error

	// Reconnect closes any open gRPC connection to the streamdal server and re-establishes a new connection
	// This method won't perform retries as that should be determined by the caller
	Reconnect() error

	// Register registers a new client with the streamdal server.
	// This is ran in a goroutine and constantly listens for commands from the streamdal server
	// such as AttachPipeline, DetachPipeline, etc
	Register(ctx context.Context, req *protos.RegisterRequest) (protos.Internal_RegisterClient, error)

	// SendMetrics ships counter(s) to the server
	SendMetrics(ctx context.Context, counters []*types.CounterEntry) error

	// SendSchema sends a schema to the streamdal server
	SendSchema(ctx context.Context, aud *protos.Audience, jsonSchema []byte) error
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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