consumer

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package consumer contains the Consumer protocol handler. It sets up a client which is handling the data coming through a ReadWriteCloser given from the Connector function.

Example:

var wg sync.WaitGroup

consumer, err := Make(func() (io.ReadWriteCloser, error) {
	return net.Dial("tcp","127.0.0.1:2000")
}, channels, terminate, logger)
if err != nil {
	panic(fmt.Sprintf("Could not create consumer: %v", err.Error()))
}
consumer.Run(&wg)

Index

Constants

This section is empty.

Variables

View Source
var ErrTerminated = errors.New("terminated")

ErrTerminated is returned when the client stops due to it being stopped through the terminated channel

Functions

func Make

func Make(connector Connector, channels channels.Consumer, terminate <-chan struct{}, logger *zap.Logger) (util.Runner, error)

Make creates a new consumer protocol handler

Types

type Connector

type Connector func() (io.ReadWriteCloser, error)

Connector is a function signature that is called when a new consumer connection should be attempted.

Jump to

Keyboard shortcuts

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