package
1.2.17
Repository: https://github.com/hubmakerlabs/replicatr.git
Documentation: pkg.go.dev

# README

qu

observable signal channels

simple channels that act as breakers or momentary one-shot triggers.

can enable logging to get detailed information on channel state, and channels do not panic if closed channels are attempted to be closed or signalled with.

provides a neat function based syntax for usage.

wait function does require use of the <- receive operator prefix to be used in a select statement.

usage

creating channels:

unbuffered

newSigChan := qu.T()

buffered

newBufferedSigChan := qu.Ts(5)

closing

newSigChan.Q()

signalling

newBufferedSigChan.Signal()

logging features

numberOpenUnbufferedChannels := GetOpenUnbufferedChanCount()

numberOpenBufferedChannels := GetOpenBufferedChanCount()

print a list of closed and open channels known by qu:

PrintChanState() 

garbage collection

this library automatically cleans up closed channels once a minute to free resources that have become unused.

# Functions

GetOpenBufferedChanCount returns the number of qu channels that are still open.
GetOpenUnbufferedChanCount returns the number of qu channels that are still open.
PrintChanState creates an output showing the current state of the channels being monitored This is a function for use by the programmer while debugging.
SetLogging switches on and off the channel logging.
T creates an unbuffered chan struct{} for trigger and quit signalling (momentary and breaker switches).
Ts creates a buffered chan struct{} which is specifically intended for signalling without blocking, generally one is the size of buffer to be used, though there might be conceivable cases where the channel should accept more signals without blocking the caller.