Documentation ¶
Index ¶
- Variables
- func Backwards(to int, fx func(int))
- func BackwardsIf(to int, fx func(int, func()))
- func BackwardsSkip(to int, fx func(int, func()))
- func Capitalize(s string) string
- func ConvertToInt(target string, def int) int
- func Elapsed(ms time.Time, diff time.Time) time.Duration
- func ElapsedIn(ms time.Time, diff time.Time) int64
- func Failed(msg string, v ...interface{}) string
- func FatalFailed(fr FatalPrinter, msg string, v ...interface{})
- func FatalPassed(fr FatalPrinter, msg string, v ...interface{})
- func Forwards(to int, fx func(int))
- func ForwardsIf(to int, fx func(int, func()))
- func ForwardsSkip(to int, fx func(int, func()))
- func GoDefer(title string, fx func())
- func GoDeferCall(title string, fx func(), cb func(interface{}))
- func GoSilent(title string, fx func())
- func GoSilentCall(title string, fx func(), cb func(interface{}))
- func GzipWalker(file string, tmp io.Writer) error
- func Lift(conClose bool, rs ...Reactor)
- func LiftOnly(rs ...Reactor)
- func LogFailed(pr LogPrinter, msg string, v ...interface{})
- func LogPassed(pr LogPrinter, msg string, v ...interface{})
- func MakeDuration(target string, def int) time.Duration
- func Passed(msg string, v ...interface{}) string
- func PrintFailed(pr SimplePrinter, msg string, v ...interface{})
- func PrintPassed(pr SimplePrinter, msg string, v ...interface{})
- func RandAlpha(n int) string
- func RandString(n int) string
- func RecoveryHandler(tag string, opFunc func() error) error
- func RecoveryHandlerCallback(tag string, opFunc func() error, cb func(interface{})) error
- func Report(e error, msg string)
- func SilentRecoveryHandler(tag string, opFunc func() error) error
- func SilentRecoveryHandlerCallback(tag string, opFunc func() error, cb func(interface{})) error
- func TarWalker(rootpath string, w io.Writer) error
- func ToCamelCase(set []string) string
- func ToDuration(ms time.Time) time.Duration
- func UnwrapAny(a ActionInterface) (*Action, *ActDepend)
- type ActDepend
- func NewActDepend(r ActionInterface, max int) *ActDepend
- func NewActDependBy(r ActionInterface, v ActionInterface, max int) *ActDepend
- func NewActDependWith(root ActionInterface, r ...ActionInterface) *ActDepend
- func UnwrapActDepend(a ActionInterface) *ActDepend
- func UnwrapActDependWrap(a ActionInterface) *ActDepend
- func (a *ActDepend) Chain(max int) *ActDepend
- func (a *ActDepend) ChainAction(f ActionInterface) ActionInterface
- func (a *ActDepend) ChainLastAction(f ActionInterface) ActionInterface
- func (a *ActDepend) ChainWith(r ...ActionInterface) *ActDepend
- func (a *ActDepend) End()
- func (a *ActDepend) EqualRoot(r ActionInterface) bool
- func (a *ActDepend) First() ActionInterface
- func (a *ActDepend) Fullfill(b interface{})
- func (a *ActDepend) Fullfilled() bool
- func (a *ActDepend) IsIndexFullfilled(ind int) bool
- func (a *ActDepend) Last() ActionInterface
- func (a *ActDepend) Mix(ind int, base ActionInterface)
- func (a *ActDepend) MixLast(ind int, base ActionInterface)
- func (a *ActDepend) OverrideAfter(index int, fx func(b interface{}, a ActionInterface)) ActionInterface
- func (a *ActDepend) OverrideBefore(index int, fx func(b interface{}, a ActionInterface)) ActionInterface
- func (a *ActDepend) Size() int
- func (a *ActDepend) Sync(ms int) <-chan interface{}
- func (a *ActDepend) Then(fx func(b interface{}, a ActionInterface)) ActionInterface
- func (a *ActDepend) Use(ind int) ActionInterface
- func (a *ActDepend) UseThen(fx func(b interface{}, a ActionInterface), f ActionInterface) ActionInterface
- func (a *ActDepend) When(fx func(b interface{}, a ActionInterface)) ActionInterface
- func (a *ActDepend) WhenOnly(fx func(b interface{})) ActionInterface
- func (a *ActDepend) Wrap() *ActionWrap
- type Action
- func (a *Action) Chain(max int) *ActDepend
- func (a *Action) ChainAction(f ActionInterface) ActionInterface
- func (a *Action) ChainLastAction(f ActionInterface) ActionInterface
- func (a *Action) ChainWith(r ...ActionInterface) *ActDepend
- func (a *Action) Fullfill(b interface{})
- func (a *Action) Fullfilled() bool
- func (a *Action) Sync(ms int) <-chan interface{}
- func (a *Action) Then(fx func(b interface{}, a ActionInterface)) ActionInterface
- func (a *Action) UseThen(fx func(b interface{}, a ActionInterface), f ActionInterface) ActionInterface
- func (a *Action) When(fx func(b interface{}, e ActionInterface)) ActionInterface
- func (a *Action) WhenOnly(fx func(b interface{})) ActionInterface
- func (a *Action) Wrap() *ActionWrap
- type ActionInterface
- type ActionMod
- type ActionStack
- type ActionStackInterface
- type ActionWrap
- func (a *ActionWrap) Chain(m int) *ActDepend
- func (a *ActionWrap) ChainAction(f ActionInterface) ActionInterface
- func (a *ActionWrap) ChainLastAction(f ActionInterface) ActionInterface
- func (a *ActionWrap) ChainWith(r ...ActionInterface) *ActDepend
- func (a *ActionWrap) Fullfill(b interface{})
- func (a *ActionWrap) Fullfilled() bool
- func (a *ActionWrap) Sync(ms int) <-chan interface{}
- func (a *ActionWrap) Then(fx func(b interface{}, a ActionInterface)) ActionInterface
- func (a *ActionWrap) UseThen(fx func(b interface{}, a ActionInterface), f ActionInterface) ActionInterface
- func (a *ActionWrap) When(fx func(b interface{}, a ActionInterface)) ActionInterface
- func (a *ActionWrap) WhenOnly(fx func(b interface{})) ActionInterface
- func (a *ActionWrap) Wrap() *ActionWrap
- type Buffer
- type BufferCloser
- type ChannelStream
- type CloseIndicator
- type Collector
- func (c Collector) Clear()
- func (c Collector) Clone() Collector
- func (c Collector) Copy(m map[string]interface{})
- func (c Collector) Each(fx StringEachfunc)
- func (c Collector) Get(k string) interface{}
- func (c Collector) Has(k string) bool
- func (c Collector) HasMatch(k string, v interface{}) bool
- func (c Collector) Keys() []string
- func (c Collector) Remove(k string)
- func (c Collector) Set(k string, v interface{})
- type Collectors
- type Connector
- type Detacher
- type Eachfunc
- type FatalPrinter
- type FileCloser
- type FlatChain
- type FlatChains
- type FlatHandler
- type FlatReactor
- func (f *FlatReactor) Bind(rx Reactor, cl bool)
- func (f *FlatReactor) Close() error
- func (f *FlatReactor) CloseNotify() <-chan bool
- func (f *FlatReactor) Detach(rm Reactor)
- func (f *FlatReactor) React(op SignalMuxHandler, cl bool) Reactor
- func (f *FlatReactor) Reply(v interface{})
- func (f *FlatReactor) ReplyError(err error)
- func (f *FlatReactor) Send(b interface{})
- func (f *FlatReactor) SendError(err error)
- func (f *FlatReactor) UseRoot(rx Reactor)
- type FuncWriter
- type FunctionStack
- type LogPrinter
- type Mappable
- type Maps
- type NextHandler
- type PoolConfig
- type PoolStat
- type PressureStream
- type Queue
- type Reactor
- func DistributeSignals(rs Reactor, ms ...Sender) Reactor
- func FileLoader() Reactor
- func FlatAlways(v interface{}) Reactor
- func FlatSimple(fx func(Reactor, interface{})) Reactor
- func FlatStack() Reactor
- func JSONReactor() Reactor
- func LiftOut(conClose bool, rs ...Reactor) Reactor
- func MergeReactors(rs ...Reactor) Reactor
- func QueueReactor(ps *PressureStream) (qr Reactor)
- func ReactIdentity() Reactor
- func Reactive(fx SignalMuxHandler) Reactor
- func ReactorStack() Reactor
- type Replier
- type ReplyCloser
- type ResetTimer
- type SecureMap
- func (m *SecureMap) Clear()
- func (m *SecureMap) Clone() Mappable
- func (m *SecureMap) Copy(src map[interface{}]interface{})
- func (m *SecureMap) CopySecureMap(src Mappable)
- func (m *SecureMap) Each(fn Eachfunc)
- func (m *SecureMap) Get(key interface{}) interface{}
- func (m *SecureMap) Has(key interface{}) bool
- func (m *SecureMap) HasMatch(key, value interface{}) bool
- func (m *SecureMap) Keys() []interface{}
- func (m *SecureMap) Remove(key interface{})
- func (m *SecureMap) Set(key, value interface{})
- type SecureStack
- func (f *SecureStack) Add(fx interface{}) int
- func (f *SecureStack) Clear()
- func (f *SecureStack) Delete(ind int)
- func (f *SecureStack) Each(fx func(interface{}))
- func (f *SecureStack) Get(ind int) interface{}
- func (f *SecureStack) Set(ind int, d interface{})
- func (f *SecureStack) Size() int
- func (f *SecureStack) Splice(begin, end int) []interface{}
- func (f *SecureStack) String() string
- type SendBinder
- type SendCloser
- type SendReplier
- type SendReplyCloser
- type SendReplyDetachCloser
- type SendReplyDetacher
- type Sender
- type SenderDetachCloser
- type SignalMuxHandler
- type SimplePrinter
- type SingleStack
- type Stackers
- type StringEachfunc
- type StringMappable
- type SwitchInterface
- type SyncCollector
- func (c *SyncCollector) Clear()
- func (c *SyncCollector) Clone() SyncCollectors
- func (c *SyncCollector) Copy(m map[string]interface{})
- func (c *SyncCollector) Each(fx StringEachfunc)
- func (c *SyncCollector) Get(k string) interface{}
- func (c *SyncCollector) Has(k string) bool
- func (c *SyncCollector) HasMatch(k string, v interface{}) bool
- func (c *SyncCollector) Keys() []string
- func (c *SyncCollector) Remove(k string)
- func (c *SyncCollector) Set(k string, v interface{})
- type SyncCollectors
- type TimeWait
- type Wait
- type WaitGen
- type WaitInterface
- type Work
- type WorkPool
- func (w *WorkPool) Add(context interface{}, do int) error
- func (w *WorkPool) Do(c interface{}, wo Work)
- func (w *WorkPool) DoWait(c interface{}, wo Work, t time.Duration) error
- func (w *WorkPool) Name() string
- func (w *WorkPool) Reset(context interface{}, rmw int)
- func (w *WorkPool) Shutdown()
- func (w *WorkPool) Stat() PoolStat
Constants ¶
This section is empty.
Variables ¶
var ( //ErrInvalidMinWorkers defines an error when the minimum worker provided is below or at 0 ErrInvalidMinWorkers = errors.New("Invalid minimum worker value") //ErrInvalidMaxWorkers is returned when the max worker value is incorrect ErrInvalidMaxWorkers = errors.New("Invalid maximum worker value") //ErrInvalidAddRequest is returned when the pool has reached its maximum worker value and cant add anymore ErrInvalidAddRequest = errors.New("Pool is at maximum worker efficiency") //ErrWorkRequestDenied is returned when the pool is unable to service a task ErrWorkRequestDenied = errors.New("Pool unable to accept task") )
var ( //ErrBadState stands for a struct in a bad state ErrBadState = errors.New("") )
var ErrBufferEmpty = errors.New("Buffer: Is Empty")
ErrBufferEmpty is returned when a op is performed with an empty buffer
var ErrEmptyStack = errors.New("Stack Empty")
ErrEmptyStack is returned when a stack is empty
var ErrFailedBind = errors.New("Failed to Bind Reactors")
ErrFailedBind represent a failure in binding two Reactors
var ErrQueueEmpty = errors.New("Queue: Is Empty")
ErrQueueEmpty is returned when the queue has no more elements
var ErrReactorClosed = errors.New("Reactor is Closed")
ErrReactorClosed returned when reactor is closed
var ErrValueType = errors.New("Value is not a string type")
ErrValueType is returned by FileLoader if it gets a type that is not a string
Functions ¶
func BackwardsIf ¶
BackwardsIf takes a value and walks Backward till 0 unless the stop function is called
func BackwardsSkip ¶
BackwardsSkip takes a value and walks Backward till 0 unless the skip function is called it will go through all sequence
func Capitalize ¶
Capitalize capitalizes the first character in a string
func ConvertToInt ¶
ConvertToInt wraps the internal int coverter
func Elapsed ¶
Elapsed takes a time and delta it from the current time to return a duration in milliseconds
func FatalFailed ¶
func FatalFailed(fr FatalPrinter, msg string, v ...interface{})
FatalFailed uses the log to print out the failed message
func FatalPassed ¶
func FatalPassed(fr FatalPrinter, msg string, v ...interface{})
FatalPassed uses the log to print out the passed message
func ForwardsIf ¶
ForwardsIf takes a value and walks Backward till 0 unless the stop func is called
func ForwardsSkip ¶
ForwardsSkip takes a value and walks Backward till 0 unless the skip func is called it will go throuh all sequence
func GoDefer ¶
func GoDefer(title string, fx func())
GoDefer letsw you run a function inside a goroutine that gets a defer recovery
func GoDeferCall ¶
func GoDeferCall(title string, fx func(), cb func(interface{}))
GoDeferCall letsw you run a function inside a goroutine that gets a defer recovery
func GoSilent ¶
func GoSilent(title string, fx func())
GoSilent letsw you run a function inside a goroutine that gets a defer recovery
func GoSilentCall ¶
func GoSilentCall(title string, fx func(), cb func(interface{}))
GoSilentCall lets you run a function inside a goroutine that gets a defer recovery
func GzipWalker ¶
GzipWalker walks a path and turns it into a tar written into a bytes.Buffer
func LiftOnly ¶
func LiftOnly(rs ...Reactor)
LiftOnly calls the Lift function to lift the Reactors and sets the close bool to false to prevent closing each other
func LogFailed ¶
func LogFailed(pr LogPrinter, msg string, v ...interface{})
LogFailed uses the log to print out the failed message
func LogPassed ¶
func LogPassed(pr LogPrinter, msg string, v ...interface{})
LogPassed uses the log to print out the passed message
func MakeDuration ¶
MakeDuration allows you to make create a duration from a string
func PrintFailed ¶
func PrintFailed(pr SimplePrinter, msg string, v ...interface{})
PrintFailed uses the log to print out the failed message
func PrintPassed ¶
func PrintPassed(pr SimplePrinter, msg string, v ...interface{})
PrintPassed uses the log to print out the passed message
func RandString ¶
RandString generates a set of random numbers of a set length
func RecoveryHandler ¶
RecoveryHandler provides a recovery handler functions for use to automate the recovery processes
func RecoveryHandlerCallback ¶
RecoveryHandlerCallback provides a recovery handler functions for use to automate the recovery processes
func SilentRecoveryHandler ¶
SilentRecoveryHandler provides a recovery handler functions for use to automate the recovery processes
func SilentRecoveryHandlerCallback ¶
SilentRecoveryHandlerCallback provides a recovery handler functions for use to automate the recovery processes
func ToCamelCase ¶
ToCamelCase takes a string set and returns the camelcase version
func ToDuration ¶
ToDuration returns the duration in millisecond of a given time from the current time
func UnwrapAny ¶
func UnwrapAny(a ActionInterface) (*Action, *ActDepend)
UnwrapAny returns two values where the first is not nil if the ActionInterface is a Action or the second non-nil if its a ActDepend
Types ¶
type ActDepend ¶
type ActDepend struct {
// contains filtered or unexported fields
}
ActDepend provides a nice means of creating a new action depending on unfullfilled action
func NewActDepend ¶
func NewActDepend(r ActionInterface, max int) *ActDepend
NewActDepend returns a action resolver based on a root action,when this root action is resolved,it waits on the user to call the actdepend then method to complete the next action,why so has to allow user-based chains where the user must partake in the completion of the final action
func NewActDependBy ¶
func NewActDependBy(r ActionInterface, v ActionInterface, max int) *ActDepend
NewActDependBy provides the actdepend struct but allows specifying the next call in the chan
func NewActDependWith ¶
func NewActDependWith(root ActionInterface, r ...ActionInterface) *ActDepend
NewActDependWith provides the actdepend struct but allows specifying the next call in the chan
func UnwrapActDepend ¶
func UnwrapActDepend(a ActionInterface) *ActDepend
UnwrapActDepend unwraps an ActDepend that has being wrapped with ActionWrap
func UnwrapActDependWrap ¶
func UnwrapActDependWrap(a ActionInterface) *ActDepend
UnwrapActDependWrap unwraps an ActDepend that has being wrapped with ActionWrap
func (*ActDepend) ChainAction ¶
func (a *ActDepend) ChainAction(f ActionInterface) ActionInterface
ChainAction is a convenience method auto completes another action and returns that action,it uses UseThen underneath
func (*ActDepend) ChainLastAction ¶
func (a *ActDepend) ChainLastAction(f ActionInterface) ActionInterface
ChainLastAction is a convenience method auto completes another action and returns that action,it uses UseThen underneath
func (*ActDepend) ChainWith ¶
func (a *ActDepend) ChainWith(r ...ActionInterface) *ActDepend
ChainWith returns ActDepend(ActionDepend) with this action as the root
func (*ActDepend) EqualRoot ¶
func (a *ActDepend) EqualRoot(r ActionInterface) bool
EqualRoot returns true/false if the root is equal
func (*ActDepend) First ¶
func (a *ActDepend) First() ActionInterface
First returns the first ActionInterface in the dependency stack
func (*ActDepend) Fullfill ¶
func (a *ActDepend) Fullfill(b interface{})
Fullfill actually fullfills the root action if its not fullfilled already
func (*ActDepend) Fullfilled ¶
Fullfilled returns true or false if the action is done
func (*ActDepend) IsIndexFullfilled ¶
IsIndexFullfilled returns true/false if the action at the index is fullfilled
func (*ActDepend) Last ¶
func (a *ActDepend) Last() ActionInterface
Last returns the last ActionInterface in the dependency stack
func (*ActDepend) Mix ¶
func (a *ActDepend) Mix(ind int, base ActionInterface)
Mix base the completion of action at a index with a custom action point using OverrideBefore and allows adding an extra step into the dependency action roadmap i.e when the next chain at this index which will complete the next chain if it is not the last as the normal operation of OverrideBefore it will base the completion of that next action on the action being mixed instead of the action at that index,like adding a middleman to a middleman :)
func (*ActDepend) MixLast ¶
func (a *ActDepend) MixLast(ind int, base ActionInterface)
MixLast base adds a new action into the current action stack and calls inserts a ghost action inbetween the action at the index and the next action,when the ghost action is fullfilled the next action is fullfilled It underneaths calls the Action.ChainLastAction which when an ActDepend will resolve the next after the last action has been dissolved
func (*ActDepend) OverrideAfter ¶
func (a *ActDepend) OverrideAfter(index int, fx func(b interface{}, a ActionInterface)) ActionInterface
OverrideAfter allows calling Then with an action after the current index that is you want to listen to the action at this index to fullfill the next index
func (*ActDepend) OverrideBefore ¶
func (a *ActDepend) OverrideBefore(index int, fx func(b interface{}, a ActionInterface)) ActionInterface
OverrideBefore allows calling Then with an action before the current index that is you want to listen to the action at this previous index to fullfill the this action at this index
func (*ActDepend) Sync ¶
Sync returns unbuffered channel which will get resolved with the value of the action when fullfilled
func (*ActDepend) Then ¶
func (a *ActDepend) Then(fx func(b interface{}, a ActionInterface)) ActionInterface
Then adds a function to the action stack or fires immediately if done
func (*ActDepend) Use ¶
func (a *ActDepend) Use(ind int) ActionInterface
Use returns the ActionInterface wrapped by an ActionWrap at the index or nil and supports negative indexing
func (*ActDepend) UseThen ¶
func (a *ActDepend) UseThen(fx func(b interface{}, a ActionInterface), f ActionInterface) ActionInterface
UseThen adds a function with a ActionInterface to the action stack or fires immediately if done once done that action interface is returned
func (*ActDepend) When ¶
func (a *ActDepend) When(fx func(b interface{}, a ActionInterface)) ActionInterface
When adds a function to the action stack with the action as the second arg
func (*ActDepend) WhenOnly ¶
func (a *ActDepend) WhenOnly(fx func(b interface{})) ActionInterface
WhenOnly adds a function to the action stack with the action as the second arg
func (*ActDepend) Wrap ¶
func (a *ActDepend) Wrap() *ActionWrap
Wrap returns actionwrap for the action
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
Action provides a future-style connect approach
func UnwrapAction ¶
func UnwrapAction(a ActionInterface) *Action
UnwrapAction unwraps an ActionInterface to a *Action
func UnwrapActionWrap ¶
func UnwrapActionWrap(a ActionInterface) *Action
UnwrapActionWrap unwraps an action that has being wrapped with ActionWrap
func (*Action) ChainAction ¶
func (a *Action) ChainAction(f ActionInterface) ActionInterface
ChainAction is a convenience method auto completes another action and returns that action,it uses UseThen underneath
func (*Action) ChainLastAction ¶
func (a *Action) ChainLastAction(f ActionInterface) ActionInterface
ChainLastAction is a convenience method auto completes another action and returns that action,it uses UseThen underneath
func (*Action) ChainWith ¶
func (a *Action) ChainWith(r ...ActionInterface) *ActDepend
ChainWith returns ActDepend(ActionDepend) with this action as the root
func (*Action) Fullfill ¶
func (a *Action) Fullfill(b interface{})
Fullfill meets this action of this structure
func (*Action) Fullfilled ¶
Fullfilled returns true or false if the action is done
func (*Action) Sync ¶
Sync returns unbuffered channel which will get resolved with the value of the action when fullfilled or when the supplied value of time has passed it will eject
func (*Action) Then ¶
func (a *Action) Then(fx func(b interface{}, a ActionInterface)) ActionInterface
Then adds a function to the action stack or fires immediately if done
func (*Action) UseThen ¶
func (a *Action) UseThen(fx func(b interface{}, a ActionInterface), f ActionInterface) ActionInterface
UseThen adds a function with a ActionInterface to the action stack or fires immediately if done once done that action interface is returned
func (*Action) When ¶
func (a *Action) When(fx func(b interface{}, e ActionInterface)) ActionInterface
When adds a function to the action stack with the action as the second arg
func (*Action) WhenOnly ¶
func (a *Action) WhenOnly(fx func(b interface{})) ActionInterface
WhenOnly adds a function to the action stack with the action as the second arg
type ActionInterface ¶
type ActionInterface interface { Fullfill(b interface{}) WhenOnly(fx func(interface{})) ActionInterface When(fx func(interface{}, ActionInterface)) ActionInterface Then(fx func(interface{}, ActionInterface)) ActionInterface UseThen(fx func(interface{}, ActionInterface), a ActionInterface) ActionInterface Fullfilled() bool ChainAction(ActionInterface) ActionInterface ChainLastAction(ActionInterface) ActionInterface Chain(int) *ActDepend ChainWith(...ActionInterface) *ActDepend Wrap() *ActionWrap Sync(int) <-chan interface{} }
ActionInterface defines member functions
type ActionMod ¶
type ActionMod func(a ActionStackInterface) (ActionInterface, ActionInterface)
ActionMod defines a function type that modifies a actionstack actions and returns them or the new actions
type ActionStack ¶
type ActionStack struct {
// contains filtered or unexported fields
}
ActionStack provides two internal stack for success and error
func NewActionStackBy ¶
func NewActionStackBy(d ActionInterface, e ActionInterface) *ActionStack
NewActionStackBy returns a new actionstack with the predefined actions from a previous actionstack with modification
func NewActionStackFrom ¶
func NewActionStackFrom(a ActionStackInterface, mod ActionMod) *ActionStack
NewActionStackFrom returns a new actionstack with the predefined actions from a previous actionstack with modification
func (*ActionStack) Complete ¶
func (a *ActionStack) Complete(b interface{}) ActionInterface
Complete allows completion of an action stack
func (*ActionStack) Done ¶
func (a *ActionStack) Done() ActionInterface
Done returns the action for the done state
func (*ActionStack) Error ¶
func (a *ActionStack) Error() ActionInterface
Error returns the action for the error state
type ActionStackInterface ¶
type ActionStackInterface interface { Complete(b interface{}) ActionInterface Done() ActionInterface Error() ActionInterface }
ActionStackInterface defines actionstack member method rules
type ActionWrap ¶
type ActionWrap struct {
// contains filtered or unexported fields
}
ActionWrap safty wraps action for limited access to its fullfill function
func NewActionWrap ¶
func NewActionWrap(a *Action) *ActionWrap
NewActionWrap returns a action wrapped in a actionwrap
func (*ActionWrap) Chain ¶
func (a *ActionWrap) Chain(m int) *ActDepend
Chain returns ActDepend(ActionDepend) with this action as the root
func (*ActionWrap) ChainAction ¶
func (a *ActionWrap) ChainAction(f ActionInterface) ActionInterface
ChainAction is a convenience method auto completes another action and returns that action,it uses UseThen underneath
func (*ActionWrap) ChainLastAction ¶
func (a *ActionWrap) ChainLastAction(f ActionInterface) ActionInterface
ChainLastAction is a convenience method auto completes another action and returns that action,it uses UseThen underneath
func (*ActionWrap) ChainWith ¶
func (a *ActionWrap) ChainWith(r ...ActionInterface) *ActDepend
ChainWith returns ActDepend(ActionDepend) with this action as the root
func (*ActionWrap) Fullfill ¶
func (a *ActionWrap) Fullfill(b interface{})
Fullfill meets this action of this structure
func (*ActionWrap) Fullfilled ¶
func (a *ActionWrap) Fullfilled() bool
Fullfilled returns true or false if the action is done
func (*ActionWrap) Sync ¶
func (a *ActionWrap) Sync(ms int) <-chan interface{}
Sync returns unbuffered channel which will get resolved with the value of the action when fullfilled
func (*ActionWrap) Then ¶
func (a *ActionWrap) Then(fx func(b interface{}, a ActionInterface)) ActionInterface
Then adds a function to the action stack or fires immediately if done
func (*ActionWrap) UseThen ¶
func (a *ActionWrap) UseThen(fx func(b interface{}, a ActionInterface), f ActionInterface) ActionInterface
UseThen adds a function with a ActionInterface to the action stack or fires immediately if done once done that action interface is returned
func (*ActionWrap) When ¶
func (a *ActionWrap) When(fx func(b interface{}, a ActionInterface)) ActionInterface
When adds a function to the action stack with the action as the second arg
func (*ActionWrap) WhenOnly ¶
func (a *ActionWrap) WhenOnly(fx func(b interface{})) ActionInterface
WhenOnly adds a function to the action stack with the action as the second arg
func (*ActionWrap) Wrap ¶
func (a *ActionWrap) Wrap() *ActionWrap
Wrap returns actionwrap for the action
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer provides a infinite receive space for handling incoming data, providing a good back pressure mechanism
func (*Buffer) Enqueue ¶
func (b *Buffer) Enqueue(item interface{})
Enqueue adds an item into the buffers end
type BufferCloser ¶
BufferCloser closes a byte.Buffer
func NewBufferCloser ¶
func NewBufferCloser(bu *bytes.Buffer) *BufferCloser
NewBufferCloser returns a new closer for a bytes.Buffer
type ChannelStream ¶
type ChannelStream struct { Data chan interface{} Error chan error // contains filtered or unexported fields }
ChannelStream provides a simple struct for exposing outputs from Reactor to outside
func NewChannelStream ¶
func NewChannelStream() *ChannelStream
NewChannelStream returns a new channel stream instance with blocked channels, so ensure to fullfill the contract of removing the data you need only
func (*ChannelStream) Close ¶
func (c *ChannelStream) Close()
Close ends the capability to use the ChannelStream channels
func (*ChannelStream) Listen ¶
func (c *ChannelStream) Listen(m Reactor)
Listen binds into a reactor and will pipe any response into its Data or Error channels, always use this to bind to reactors, to ensure safety in code use i.e dont try to pipe into the channels your own way
type CloseIndicator ¶
type CloseIndicator interface {
CloseNotify() <-chan bool
}
CloseIndicator was created as a later means of providing a simply indicator of the close state of a Reactor
type Collector ¶
type Collector map[string]interface{}
Collector defines a typ of map string
func (Collector) Each ¶
func (c Collector) Each(fx StringEachfunc)
Each iterates through all items in the collector
type Collectors ¶
Collectors defines member function rules for collector
type Connector ¶
type Connector interface { // Bind provides a convenient way of binding 2 reactors Bind(r Reactor, closeAlong bool) // React generates a reactor based off its caller React(s SignalMuxHandler, closeAlong bool) Reactor }
Connector defines the core connecting methods used for binding with a Reactor
type Detacher ¶
type Detacher interface {
Detach(Reactor)
}
Detacher details the detach interface used by the Reactor
type Eachfunc ¶
type Eachfunc func(interface{}, interface{}, func())
Eachfunc defines the type of the Mappable.Each rule
type FatalPrinter ¶
type FatalPrinter interface {
Fatal(v ...interface{})
}
FatalPrinter provides a hasher,stop after print interface with Fatal function
type FileCloser ¶
FileCloser provides a means of closing a file
func NewFileCloser ¶
func NewFileCloser(path string) (*FileCloser, error)
NewFileCloser returns a new file closer
type FlatChain ¶
type FlatChain struct {
// contains filtered or unexported fields
}
FlatChain provides a simple middleware like
func NewFlatChain ¶
func NewFlatChain(fx FlatHandler) *FlatChain
NewFlatChain returns a new flatchain instance
func (*FlatChain) Next ¶
func (r *FlatChain) Next(rx FlatChains)
Next sets the next flat chains else passes it down to the last chain to set as next chain
type FlatChains ¶
type FlatChains interface { Call(error, interface{}) Next(FlatChains) }
FlatChains define a simple flat chain
type FlatHandler ¶
type FlatHandler func(error, interface{}, NextHandler)
FlatHandler provides a handler for flatchain
type FlatReactor ¶
type FlatReactor struct {
// contains filtered or unexported fields
}
FlatReactor provides a pure functional reactor which uses an internal wait group to ensure if close is called that call values where delivered
func FlatIdentity ¶
func FlatIdentity() *FlatReactor
FlatIdentity returns flatreactor that resends its inputs as outputs with no changes
func FlatReactive ¶
func FlatReactive(op SignalMuxHandler) *FlatReactor
FlatReactive returns a new functional reactor
func (*FlatReactor) Bind ¶
func (f *FlatReactor) Bind(rx Reactor, cl bool)
Bind connects two reactors
func (*FlatReactor) Close ¶
func (f *FlatReactor) Close() error
Close closes the reactor and removes all connections
func (*FlatReactor) CloseNotify ¶
func (f *FlatReactor) CloseNotify() <-chan bool
CloseNotify provides a channel for notifying a close event
func (*FlatReactor) Detach ¶
func (f *FlatReactor) Detach(rm Reactor)
Detach removes the given reactor from its connections
func (*FlatReactor) React ¶
func (f *FlatReactor) React(op SignalMuxHandler, cl bool) Reactor
React builds a new reactor from this one
func (*FlatReactor) Reply ¶
func (f *FlatReactor) Reply(v interface{})
Reply allows the reply of an data message
func (*FlatReactor) ReplyError ¶
func (f *FlatReactor) ReplyError(err error)
ReplyError allows the reply of an error message
func (*FlatReactor) Send ¶
func (f *FlatReactor) Send(b interface{})
Send applies a message value to the handler
func (*FlatReactor) SendError ¶
func (f *FlatReactor) SendError(err error)
SendError applies a error value to the handler
func (*FlatReactor) UseRoot ¶
func (f *FlatReactor) UseRoot(rx Reactor)
UseRoot Adds this reactor as a root of the called reactor
type FuncWriter ¶
type FuncWriter struct {
// contains filtered or unexported fields
}
FuncWriter provides a means of creation io.Writer on functions
func NewFuncWriter ¶
func NewFuncWriter(fx func([]byte)) *FuncWriter
NewFuncWriter returns a new function writer instance
func (*FuncWriter) Close ¶
func (w *FuncWriter) Close() error
Close provides a basic io.WriteCloser write method
type FunctionStack ¶
type FunctionStack struct {
// contains filtered or unexported fields
}
FunctionStack provides addition of functions into a stack
func NewFunctionStack ¶
func NewFunctionStack() *FunctionStack
NewFunctionStack returns a new functionstack instance
func (*FunctionStack) Add ¶
func (f *FunctionStack) Add(fx func(...interface{})) int
Add adds a function into the stack
func (*FunctionStack) Delete ¶
func (f *FunctionStack) Delete(ind int)
Delete removes the function at the provided index
func (*FunctionStack) Each ¶
func (f *FunctionStack) Each(d ...interface{})
Each runs through the function lists and executing with args
func (*FunctionStack) Size ¶
func (f *FunctionStack) Size() int
Size returns the total number of listeners
type LogPrinter ¶
type LogPrinter interface {
Log(v ...interface{})
}
LogPrinter provides a simple printer interface with normal log function
type Mappable ¶
type Mappable interface { Clear() HasMatch(k, v interface{}) bool Each(f Eachfunc) Keys() []interface{} Copy(map[interface{}]interface{}) CopySecureMap(Mappable) Has(interface{}) bool Get(interface{}) interface{} Remove(interface{}) Set(k, v interface{}) Clone() Mappable }
Mappable defines member function rules for securemap
type Maps ¶
type Maps interface { Clear() HasMatch(k string, v interface{}) bool Each(f StringEachfunc) Keys() []string Copy(map[string]interface{}) Has(string) bool Get(string) interface{} Remove(string) Set(k string, v interface{}) }
Maps define a set of method rules for maps of the string key types
type NextHandler ¶
type NextHandler func(error, interface{})
NextHandler provides next call for flat chains
type PoolConfig ¶
type PoolConfig struct { MaxWorkers int64 MinWorkers int64 MetricInterval func() time.Duration MetricHandler func(PoolStat) }
PoolConfig defines the configuration details for a workpool
type PoolStat ¶
type PoolStat struct { //date of the state Stamp time.Time MaxWorkers int64 MinWorkers int64 //total current workers goroutined Workers int64 //total executed works Executed int64 //pending work in pool Pending int64 //active work in pool Active int64 }
PoolStat defines the stat returned when checking health of pool
type PressureStream ¶
type PressureStream struct {
Signals, Errors chan interface{}
// contains filtered or unexported fields
}
PressureStream provides a higher api for handling pressure requests of two levels (data and errors),there by providing a simple but strong foundation for higher level constructs
func BuildPressureStream ¶
func BuildPressureStream(dataSignals, errorSignals chan interface{}) *PressureStream
BuildPressureStream returns a new PressureStream instance
func NewPressureStream ¶
func NewPressureStream() *PressureStream
NewPressureStream returns a new PressureStream
func (*PressureStream) Close ¶
func (ps *PressureStream) Close()
Close closes the PressureStream but ensures the function only returns control when the both back queues have been closed
func (*PressureStream) RemainingErrors ¶
func (ps *PressureStream) RemainingErrors() int
RemainingErrors returns the current size of error queue
func (*PressureStream) RemainingSignals ¶
func (ps *PressureStream) RemainingSignals() int
RemainingSignals returns the current size of signal queue
func (*PressureStream) SendError ¶
func (ps *PressureStream) SendError(d error)
SendError delivers data into the data channel
func (*PressureStream) SendSignal ¶
func (ps *PressureStream) SendSignal(d interface{})
SendSignal delivers data into the data channel
type Queue ¶
type Queue struct { Deq chan interface{} // contains filtered or unexported fields }
Queue is a simple queue with the capability of handling infinite receivals and retrieving with a more control system
func (*Queue) Close ¶
func (q *Queue) Close()
Close sets the internal operations channels to a close state and waits till the buffer operations are complete to return, hence ensuring the last items where delivered
type Reactor ¶
type Reactor interface { io.Closer CloseIndicator Connector Sender Replier Detacher UseRoot(Reactor) }
Reactor provides an interface definition for the reactor type to allow compatibility by future extenders when composing with other structs.
func DistributeSignals ¶
DistributeSignals provide a function that takes a React and other multiple Reactors and distribute the data from the first reactor to others
func FlatAlways ¶
func FlatAlways(v interface{}) Reactor
FlatAlways returns a reactor with consistently returns the provided value
func FlatSimple ¶
FlatSimple returns a reactor using the SimpleMuxer as a mux generator
func JSONReactor ¶
func JSONReactor() Reactor
JSONReactor provides a json encoding Reactor,takes any input and tries to transform it into a json using the default json.Marshal function
func LiftOut ¶
LiftOut uses Lift to chain a set of reactors and returns a new reactor which is the last in the chain
func MergeReactors ¶
MergeReactors merges data from a set of Senders into a new reactor stream
func QueueReactor ¶
func QueueReactor(ps *PressureStream) (qr Reactor)
QueueReactor provides a reactor that listens on the supplied queue for data and error messages but if the queue gets closed then the reactor is closed along
func ReactIdentity ¶
func ReactIdentity() Reactor
ReactIdentity is more written to provide a backward compatibility for cold using the old channel based reactor
func ReactorStack ¶
func ReactorStack() Reactor
ReactorStack returns a Stacker as a reactor with an identity reactor as root
type Replier ¶
type Replier interface { Reply(v interface{}) ReplyError(v error) }
Replier defines reply methods to reply to requests
type ReplyCloser ¶
ReplyCloser provides an interface that combines Replier and Closer interfaces
type ResetTimer ¶
type ResetTimer struct {
// contains filtered or unexported fields
}
ResetTimer runs a timer and performs an action
func NewResetTimer ¶
func NewResetTimer(init func(), done func(), d time.Duration, run, boot bool) *ResetTimer
NewResetTimer returns a new reset timer
type SecureMap ¶
type SecureMap struct {
// contains filtered or unexported fields
}
SecureMap simple represents a map with a rwmutex locked in
func SecureMapFrom ¶
func SecureMapFrom(core map[interface{}]interface{}) *SecureMap
SecureMapFrom returns a new securemap
func (*SecureMap) Copy ¶
func (m *SecureMap) Copy(src map[interface{}]interface{})
Copy Copies a map[interface{}]interface{} into the map
func (*SecureMap) CopySecureMap ¶
CopySecureMap Copies a into the map
type SecureStack ¶
type SecureStack struct {
// contains filtered or unexported fields
}
SecureStack provides addition of functions into a stack
func NewSecureStack ¶
func NewSecureStack() *SecureStack
NewSecureStack returns a new concurrent safe array decorator
func (*SecureStack) Add ¶
func (f *SecureStack) Add(fx interface{}) int
Add adds a function into the stack
func (*SecureStack) Delete ¶
func (f *SecureStack) Delete(ind int)
Delete removes the function at the provided index
func (*SecureStack) Each ¶
func (f *SecureStack) Each(fx func(interface{}))
Each runs through the function lists and executing with args
func (*SecureStack) Get ¶
func (f *SecureStack) Get(ind int) interface{}
Get lets you retrieve an item in the list
func (*SecureStack) Set ¶
func (f *SecureStack) Set(ind int, d interface{})
Set lets you retrieve an item in the list
func (*SecureStack) Size ¶
func (f *SecureStack) Size() int
Size returns the total number of listeners
func (*SecureStack) Splice ¶
func (f *SecureStack) Splice(begin, end int) []interface{}
Splice returns a new unique slice from the list
func (*SecureStack) String ¶
func (f *SecureStack) String() string
Strings return the stringified version of the internal list
type SendBinder ¶
SendBinder defines the combination of the Sender and Binding interfaces
type SendCloser ¶
SendCloser provides an interface that combines Sender and Closer interfaces
type SendReplier ¶
SendReplier provides the interface for the combination of senders and repliers
type SendReplyCloser ¶
SendReplyCloser provides the interface for the combination of closers,senders and repliers
type SendReplyDetachCloser ¶
SendReplyDetachCloser provides the interface for the combination of closers, senders,detachers and repliers
type SendReplyDetacher ¶
SendReplyDetacher provides the interface for the combination of senders,detachers and repliers
type Sender ¶
type Sender interface { Send(v interface{}) SendError(v error) }
Sender defines the delivery methods used to deliver data into Reactor process
type SenderDetachCloser ¶
SenderDetachCloser provides an interface that combines Sender and Closer interfaces
type SignalMuxHandler ¶
SignalMuxHandler provides a signal function type:
It takes three arguments: - reactor:(Reactor) the reactor itself for reply processing - failure:(error) the current error being returned when a data is nil - data:(interface{}) the current data being returned,nil when theres an error
func IdentityMuxer ¶
func IdentityMuxer() SignalMuxHandler
IdentityMuxer provides the handoler for a providing a pure piping behaviour where data is left untouched as it comes in and goes out
func IdentityValueMuxer ¶
func IdentityValueMuxer(v interface{}) SignalMuxHandler
IdentityValueMuxer provides the handler for a providing a pure piping behaviour where data passed in is used as the return data value
func SimpleMuxer ¶
func SimpleMuxer(fx func(Reactor, interface{})) SignalMuxHandler
SimpleMuxer provides the handoler for a providing a pure piping behaviour where data is left untouched as it comes in and goes out
type SimplePrinter ¶
type SimplePrinter interface {
Print(v ...interface{})
}
SimplePrinter provides a simple printer interface with normal print function
type SingleStack ¶
type SingleStack struct {
*FunctionStack
}
SingleStack provides a function stack fro single argument functions
func NewSingleStack ¶
func NewSingleStack() *SingleStack
NewSingleStack returns a singlestack instance
func (*SingleStack) Add ¶
func (s *SingleStack) Add(fx func(interface{})) int
Add adds a function into the stack
type Stackers ¶
type Stackers struct { Reactor // contains filtered or unexported fields }
Stackers provides a construct for providing a strict top-down method call for the Bind,React and BindControl for Reactors,it allows passing these function requests to the last Reactor in the stack while still passing data from the top
func ReactStack ¶
ReactStack returns a new Reactor based off the Stacker struct which is safe for concurrent use
func (*Stackers) Bind ¶
Bind wraps the bind method of the Reactor,if no Reactor has been stack then it binds with the root else gets the last Reactor and binds with that instead
func (*Stackers) Clear ¶
func (sr *Stackers) Clear()
Clear clears the stacks and resolves back to root
type StringEachfunc ¶
type StringEachfunc func(interface{}, string, func())
StringEachfunc defines the type of the Mappable.Each rule
type StringMappable ¶
type StringMappable interface { Maps Clone() StringMappable }
StringMappable defines member function rules for securemap
type SwitchInterface ¶
type SwitchInterface interface { Switch() IsOn() bool WhenOn() ActionInterface WhenOff() ActionInterface }
SwitchInterface defines a flux.Switch interface method definition
type SyncCollector ¶
type SyncCollector struct {
// contains filtered or unexported fields
}
SyncCollector provides a mutex controlled map
func NewSyncCollector ¶
func NewSyncCollector() *SyncCollector
NewSyncCollector returns a new collector instance
func (*SyncCollector) Clone ¶
func (c *SyncCollector) Clone() SyncCollectors
Clone makes a new clone of this collector
func (*SyncCollector) Copy ¶
func (c *SyncCollector) Copy(m map[string]interface{})
Copy copies the map into the collector
func (*SyncCollector) Each ¶
func (c *SyncCollector) Each(fx StringEachfunc)
Each iterates through all items in the collector
func (*SyncCollector) Get ¶
func (c *SyncCollector) Get(k string) interface{}
Get returns the value with the key
func (*SyncCollector) HasMatch ¶
func (c *SyncCollector) HasMatch(k string, v interface{}) bool
HasMatch checks if key and value exists and are matching
func (*SyncCollector) Keys ¶
func (c *SyncCollector) Keys() []string
Keys return the keys of the Collector
func (*SyncCollector) Remove ¶
func (c *SyncCollector) Remove(k string)
Remove deletes a key:value pair
func (*SyncCollector) Set ¶
func (c *SyncCollector) Set(k string, v interface{})
Set puts a specific key:value into the collector
type SyncCollectors ¶
type SyncCollectors interface { Maps Clone() SyncCollectors }
SyncCollectors defines member function rules for SyncCollector
type TimeWait ¶
type TimeWait struct {
// contains filtered or unexported fields
}
TimeWait defines a time lock waiter
func NewTimeWait ¶
NewTimeWait returns a new timer wait locker You specifiy two arguments: max int: the maximum number of time you want to check for idleness duration time.Duration: the time to check for each idle times and reduce until zero is reached then close eg. to do a 15seconds check for idleness NewTimeWait(15,time.Duration(1)*time.Second) eg. to do a 25 maximum check before closing per minute NewTimeWait(15,time.Duration(1)*time.Minute)
func (*TimeWait) Add ¶
func (w *TimeWait) Add()
Add increments the lock state to the lock counter unless its already unlocked
func (*TimeWait) Done ¶
func (w *TimeWait) Done()
Done decrements the totalcount of this waitlocker by 1 until its below zero and fullfills with the 0 value
func (*TimeWait) Flush ¶
func (w *TimeWait) Flush()
Flush drops the lock count and forces immediate unlocking of the wait
func (TimeWait) Then ¶
func (w TimeWait) Then() ActionInterface
Then returns an ActionInterface which gets fullfilled when this wait counter reaches zero
type Wait ¶
type Wait struct {
// contains filtered or unexported fields
}
Wait implements the WiatInterface for creating a wait lock which waits until the lock lockcount is finished then executes a action can only be used once, that is ,once the wait counter is -1,you cant add to it anymore
func (*Wait) Add ¶
func (w *Wait) Add()
Add increments the lock state to the lock counter unless its already unlocked
func (*Wait) Done ¶
func (w *Wait) Done()
Done decrements the totalcount of this waitlocker by 1 until its below zero and fullfills with the 0 value
func (*Wait) Flush ¶
func (w *Wait) Flush()
Flush drops the lock count and forces immediate unlocking of the wait
func (Wait) Then ¶
func (w Wait) Then() ActionInterface
Then returns an ActionInterface which gets fullfilled when this wait counter reaches zero
type WaitGen ¶
type WaitGen struct {
// contains filtered or unexported fields
}
WaitGen is a nice way of creating regenerative timers for use wait timers are once timers, once they are clocked out they are of no more use,to allow their nature which has its benefits we get to create WaitGen that generates a new once once a wait gen is over
func NewSimpleWaitGen ¶
func NewSimpleWaitGen(init func(WaitInterface)) *WaitGen
NewSimpleWaitGen returns a wait generator making a timewaiter
func NewTimeWaitGen ¶
func NewTimeWaitGen(steps int, ms time.Duration, init func(WaitInterface)) *WaitGen
NewTimeWaitGen returns a wait generator making a timewaiter
func (*WaitGen) Make ¶
func (w *WaitGen) Make() WaitInterface
Make returns a new WaitInterface or returns the current once
type WaitInterface ¶
type WaitInterface interface { Add() Done() Count() int Flush() Then() ActionInterface }
WaitInterface defines the flux.Wait interface method definitions
func NewWait ¶
func NewWait() WaitInterface
NewWait returns a new Wait instance for the WaitInterface
type Work ¶
type Work interface {
Work(context interface{}, id int)
}
Work defines an interface for a work to be performed
type WorkPool ¶
type WorkPool struct { *PoolConfig // contains filtered or unexported fields }
WorkPool defines a pool for handling workers
func NewPool ¶
func NewPool(context interface{}, name string, config *PoolConfig) (*WorkPool, error)
NewPool creates a new pool instance
func (*WorkPool) DoWait ¶
DoWait adds a task into the pool within a given duration if not accepted by then it returns with an error