Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Package ¶
type Package struct { Cancel context.CancelFunc Data interface{} // contains filtered or unexported fields }
Package is a data entry with a context to ensure async execution or cancellation if necessary
func (*Package) Start ¶
func (p *Package) Start(tbk *io.TimeBucketKey, h ShelfHandler)
Start causes the package to begin listening to it's context's done channel which is set by the deadline passed to the context. This is done in a separate goroutine
type Shelf ¶
Shelf stores packages, which have shelf lives (^^) and are meant to have the shelf's handler executed after some deadline
func NewShelf ¶
func NewShelf(h ShelfHandler) *Shelf
NewShelf initializes a new shelf with the provided handler function
func (*Shelf) Store ¶
func (s *Shelf) Store(tbk *io.TimeBucketKey, data interface{}, deadline time.Time)
Store a new package to the shelf. This operation cancels, and replaces the existing package with the same TimeBucketKey on the shelf, so make sure not to prematurely store new packages before the previous have a chance to finish naturally.
type ShelfHandler ¶
type ShelfHandler *func(tbk io.TimeBucketKey, data interface{}) error
ShelfHandler gets executed by a shelf on its packages
func NewShelfHandler ¶
func NewShelfHandler(f func(tbk io.TimeBucketKey, data interface{}) error) ShelfHandler
NewShelfHandler creates a new ShelfHandler from a supplied function