Documentation ¶
Overview ¶
Package queue contains methods and structures for manipulating and persisting data that should be repeatedly processed in a prioritized (but changing) order.
Esepcially useful for combining with systems like pubsub to receive events that change the order of queue processing.
Index ¶
- type Fixer
- type PersistClient
- type Queue
- func (q *Queue) Current() map[string]time.Time
- func (q *Queue) Fix(name string, when time.Time, later bool) error
- func (q *Queue) FixAll(whens map[string]time.Time, later bool) error
- func (q *Queue) Init(log logrus.FieldLogger, names []string, when time.Time)
- func (q *Queue) Send(ctx context.Context, receivers chan<- string, frequency time.Duration) error
- func (q *Queue) Status() (int, *string, time.Time)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fixer ¶
Fixer will adjust the queue until the context expires.
func FixPersistent ¶
func FixPersistent(logr logrus.FieldLogger, client PersistClient, path gcs.Path, tick <-chan time.Time) Fixer
FixPersistent persists the queue to the remote path every tick.
The first time it will load the state. Thereafter it will save the state. This includes restarts due to expiring contexts -- it will just load once.
type PersistClient ¶
PersistClient contains interfaces for reading from and writing to a Path.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue can send names to receivers at a specific frequency.
Also contains the ability to modify the next time to send names. First call must be to Init(). Exported methods are safe to call concurrently.
func (*Queue) Fix ¶
Fix the next time to send the group to receivers.
If later is set then it will move out the next update time, otherwise it will only reduce it.
func (*Queue) FixAll ¶
FixAll will fix multiple groups inside a single critical section.
If later is set then it will move out the next update time, otherwise it will only reduce it.
func (*Queue) Init ¶
Init (or reinit) the queue with the specified groups, which should be updated at frequency.