util

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Couple

func Couple(in types.Producer, out types.Consumer) error

Couple connects a producer to a consumer.

Types

type ClosablePool

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

ClosablePool keeps a reference to a pool of closable types and closes them in tiers.

func NewClosablePool

func NewClosablePool() *ClosablePool

NewClosablePool creates a fresh pool of closable types.

func (*ClosablePool) Add

func (c *ClosablePool) Add(tier int, closable types.Closable)

Add adds a closable type to the pool, tiers are used to partition and order the closing of types (starting at the lowest tier and working upwards). Closable types in a single tier are closed in the order that they are added.

func (*ClosablePool) Close

func (c *ClosablePool) Close(timeout time.Duration) error

Close attempts to close and clean up all stored closables in the determined order. If the timeout is met whilst working through the pool there is no indication of how far the pool has been progressed, thus this timeout should only be used for preventing severe blocking of a service.

type MockInputType added in v0.1.1

type MockInputType struct {
	MsgChan chan types.Message
	ResChan <-chan types.Response
}

MockInputType implements the input.Type interface.

func (MockInputType) CloseAsync added in v0.1.1

func (m MockInputType) CloseAsync()

CloseAsync does nothing.

func (*MockInputType) MessageChan added in v0.1.1

func (m *MockInputType) MessageChan() <-chan types.Message

MessageChan returns the messages channel.

func (*MockInputType) StartListening added in v0.1.1

func (m *MockInputType) StartListening(resChan <-chan types.Response) error

StartListening sets the channel used for reading responses.

func (MockInputType) WaitForClose added in v0.1.1

func (m MockInputType) WaitForClose(time.Duration) error

WaitForClose does nothing.

type MockOutputType added in v0.1.1

type MockOutputType struct {
	ResChan chan types.Response
	MsgChan <-chan types.Message
}

MockOutputType implements the output.Type interface.

func (MockOutputType) CloseAsync added in v0.1.1

func (m MockOutputType) CloseAsync()

CloseAsync does nothing.

func (*MockOutputType) ResponseChan added in v0.1.1

func (m *MockOutputType) ResponseChan() <-chan types.Response

ResponseChan returns the errors channel.

func (*MockOutputType) StartReceiving added in v0.1.1

func (m *MockOutputType) StartReceiving(msgs <-chan types.Message) error

StartReceiving sets the read channel. This implementation is NOT thread safe.

func (MockOutputType) WaitForClose added in v0.1.1

func (m MockOutputType) WaitForClose(time.Duration) error

WaitForClose does nothing.

Directories

Path Synopsis
Package disk contains cross platform disk statistics utilities.
Package disk contains cross platform disk statistics utilities.
Package service contains utilities for bootstrapping a server such as config, logging and metrics.
Package service contains utilities for bootstrapping a server such as config, logging and metrics.
config
Package config contains utilities for reading and parsing service configuration files.
Package config contains utilities for reading and parsing service configuration files.
log
Package log contains utilities for logging in a modular interface.
Package log contains utilities for logging in a modular interface.
metrics
Package metrics contains a type for aggregating and propagating metrics to various services based on configuration.
Package metrics contains a type for aggregating and propagating metrics to various services based on configuration.
Package test contains helpers for setting up test utilties.
Package test contains helpers for setting up test utilties.
Package text includes utilities for working with text that might contain variables.
Package text includes utilities for working with text that might contain variables.
Package throttle implements throttle strategies.
Package throttle implements throttle strategies.

Jump to

Keyboard shortcuts

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