standardstream

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2018 License: ISC Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(options ...func(*Client)) stream.Client

NewClient returns a new standardstream client.

Types

type Client

type Client struct {
	// ConsumerFD is the file descriptor to consume messages from. If undefined,
	// the `os.Stdin` descriptor will be used.
	ConsumerFD *os.File

	// ProducerFD is the file descriptor to produce messages to. If undefined, the
	// `os.Stdout` descriptor will be used.
	ProducerFD io.Writer

	// Logger is the configurable logger instance to log messages from this
	// streamclient. If left undefined, a noop logger will be used.
	Logger *zap.Logger
}

Client provides access to the streaming capabilities.

func (*Client) NewConsumer

func (c *Client) NewConsumer() stream.Consumer

NewConsumer returns a consumer that can iterate over messages on a stream.

func (*Client) NewConsumerAndProducer

func (c *Client) NewConsumerAndProducer() (stream.Consumer, stream.Producer)

NewConsumerAndProducer is a convenience method that returns both a consumer and a producer, with a single function call.

func (*Client) NewProducer

func (c *Client) NewProducer() stream.Producer

NewProducer returns a producer that outputs messages to stdout.

type Consumer

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

Consumer implements the stream.Consumer interface for standardstream.

func (*Consumer) Close

func (c *Consumer) Close() error

Close closes the consumer connection.

func (*Consumer) Messages

func (c *Consumer) Messages() <-chan *stream.Message

Messages returns the read channel for the messages that are returned by the stream.

type Producer

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

Producer represents the object that will produce messages to a stream.

func (*Producer) Close

func (p *Producer) Close() error

Close closes the producer connection

func (*Producer) Messages

func (p *Producer) Messages() chan<- *stream.Message

Messages returns the write channel for messages to be produced.

func (*Producer) PartitionKey

func (p *Producer) PartitionKey(f func(*stream.Message) []byte)

PartitionKey can be used to define the key to use for partitioning messages.

Jump to

Keyboard shortcuts

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