tritond

package
v0.0.0-...-6cc688f Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: ISC Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultZMQHWM configures the high water mark for the push socket.
	// More info: http://api.zeromq.org/4-1:zmq-setsockopt#toc39
	DefaultZMQHWM = 4000

	// DefaultNumIdleConns configures the number of idle sockets to maintain for zmq.
	DefaultNumIdleConns = 10
)

Variables

View Source
var ErrClientClosed = errors.New("Client Closed")

ErrClientClosed indicates that the client has been closed and is not longer usable.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Put sends `data` to a given partition of a stream asynchronously.
	Put(ctx context.Context, stream, partition string, data map[string]interface{}) error

	// Close flushes all in-flight `Put`s and blocks new `Put`s, effectively closing the client.
	Close(ctx context.Context) error
}

Client defines the interface of a tritond client.

func NewClient

func NewClient(opts ...Option) (Client, error)

NewClient creates a Client with the given configuration options

func NewNoopClient

func NewNoopClient() Client

NewNoopClient creates a `Client` that performs no operation and allways returns successfully.

type MockClient

type MockClient struct {
	StreamData     map[string]([](map[string]interface{}))
	PartitionCount map[string]int
	WriteSignal    chan bool
	// contains filtered or unexported fields
}

MockClient implements a client that stores the messages in memory

func NewMockClient

func NewMockClient() *MockClient

NewMockClient returns a new MockClient

func (*MockClient) Close

func (c *MockClient) Close(ctx context.Context) error

Close is a noop for a mock client. Meets `Client` inteface

func (*MockClient) Put

func (c *MockClient) Put(ctx context.Context, stream, partition string, data map[string]interface{}) error

Put implements the client interface

func (*MockClient) Reset

func (c *MockClient) Reset()

Reset resets MockClient to the initial state

type Option

type Option func(c *zeromqClient) error

Option defines a function that can be used to configure a client

func WithHWM

func WithHWM(hwm int) Option

WithHWM sets the high water mark for the zeromq sockets.

func WithNumIdleConns

func WithNumIdleConns(numIdle int) Option

WithNumIdleConns sets the maximum number of idle zmq sockets

func WithZMQEndpoint

func WithZMQEndpoint(endpoint string) Option

WithZMQEndpoint sets the endpoint for zeromq

Jump to

Keyboard shortcuts

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