multiplexer

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type In

type In interface {
	// Messages returns channel that multiplexer receives messages from.
	Messages() <-chan *consumer.Message

	// Acks returns a channel that multiplexer sends a message that was pulled
	// from the `Messages()` channel of this input after the message has been
	// send to the output.
	Acks() chan<- *consumer.Message

	// Stop signals the input to stop and blocks waiting for its goroutines to
	// complete.
	Stop()
}

In defines an interface of a multiplexer input.

type Int32Slice

type Int32Slice []int32

func (Int32Slice) Len

func (p Int32Slice) Len() int

func (Int32Slice) Less

func (p Int32Slice) Less(i, j int) bool

func (Int32Slice) Swap

func (p Int32Slice) Swap(i, j int)

type Out

type Out interface {
	// Messages returns channel that multiplexer sends messages to.
	Messages() chan<- *consumer.Message
}

Out defines an interface of multiplexer output.

type SpawnInF

type SpawnInF func(partition int32) In

SpawnInF is a function type that is used by multiplexer to spawn inputs for assigned partitions during rewiring.

type T

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

T fetches messages from inputs and multiplexes them to the output, giving preferences to inputs with higher lag. Multiplexes assumes ownership over inputs in the sense that it decides when an new input instance needs to started, or the old one stopped.

func New

func New(namespace *actor.ID, spawnInF SpawnInF) *T

New creates a new multiplexer instance.

func (*T) IsRunning

func (m *T) IsRunning() bool

IsRunning returns `true` if multiplexer is running pumping events from the inputs to the output.

func (*T) Stop

func (m *T) Stop()

Stop synchronously stops the multiplexer.

func (*T) WireUp

func (m *T) WireUp(output Out, assigned []int32)

WireUp ensures that inputs of all assigned partitions are spawned and multiplexed to the specified output. It stops inputs for partitions that are no longer assigned, spawns inputs for newly assigned partitions, and restarts the multiplexer, if either output or any of inputs has changed.

Jump to

Keyboard shortcuts

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