duplicator

package
v0.0.0-...-9b4e82f Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: MIT Imports: 6 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnlinkDuplicator

func UnlinkDuplicator(input, output *ChannelDuplicator)

* Unlink two duplicators from each other

Types

type ChannelDuplicator

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

* Channel Duplicators are a core part of the design and are used to link together the pipeline of the program They basically just a fan-in -> fan-out channel inputs get fanned onto the transfer channel, then out to each listening. This makes linking different parts of the program together super easy since you can tie outputs to inputs.

func MakeDuplicator

func MakeDuplicator(name string) *ChannelDuplicator

* name is only used for debugging, that's honestly the worst part of this design choice Tracing out a rouge message is impossible without this (cant really break on a line of code being called multiple times for each event)

func (*ChannelDuplicator) DiableSink

func (ch *ChannelDuplicator) DiableSink()

func (*ChannelDuplicator) EnableCopyMode

func (ch *ChannelDuplicator) EnableCopyMode()

* Copy mode is

func (*ChannelDuplicator) EnableDebug

func (ch *ChannelDuplicator) EnableDebug()

* a lot of printing but uuids make is not to bad to trace though whats happening

func (*ChannelDuplicator) EnableSink

func (ch *ChannelDuplicator) EnableSink()

func (*ChannelDuplicator) GetBufferedOutput

func (ch *ChannelDuplicator) GetBufferedOutput(buffSize int64) chan interface{}

* Return a new buffered output essentially used where ever you can have different levels of processing at each end (a socket would need a bufferd since you can add messages quicker than you can send them)

func (*ChannelDuplicator) GetOutput

func (ch *ChannelDuplicator) GetOutput() chan interface{}

* Return a new output channel that is being fan-out from the transfer

func (*ChannelDuplicator) Offer

func (ch *ChannelDuplicator) Offer(value interface{})

* offer a single value directly onto the transfer

func (*ChannelDuplicator) RegisterInput

func (ch *ChannelDuplicator) RegisterInput(inputChannel <-chan interface{})

* Register a input to be fanned onto the transfer

func (*ChannelDuplicator) SetName

func (ch *ChannelDuplicator) SetName(name string)

func (*ChannelDuplicator) StopDuplicator

func (ch *ChannelDuplicator) StopDuplicator()

func (*ChannelDuplicator) UnregisterOutput

func (ch *ChannelDuplicator) UnregisterOutput(remove chan interface{})

* remove a channel

Jump to

Keyboard shortcuts

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