Documentation ¶
Overview ¶
Package queue implements different kinds of queues
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base interface { // Next item in the Queue, this function blocks until the next item is available. // It returns <nil> to all callers when Destroy() is called. Next() interface{} IsEmpty() bool // Destroy the queue Destroy() }
Base interface for Queue
type JIT ¶
type JIT interface { Base // Add an Item to the JIT Queue, will be returned by Next() at item.Time() Add(item JITItem) // Schedule an Item to the JIT Queue, will be returned by Next() at time Schedule(i interface{}, time time.Time) }
JIT is a just-in-time implementation of the Queue. It allows setting a time for each item in the queue. The item will be returned by Next() immediately after this time.
type Schedule ¶
type Schedule interface { Base // Add an Item to the Schedule, queued to be returned at item.Time(), // this func returns the conflicts based on item.Time() and item.Duration() Add(item ScheduleItem) []ScheduleItem // Conflicts based on time and duration Conflicts(time time.Time, duration time.Duration) []ScheduleItem // Conflicts based on timestamp and duration ConflictsForTimestamp(timestamp int64, duration time.Duration) []ScheduleItem // Schedule an item at the given time, with the given duration // this func returns the conflicts based on item time and duration Schedule(i interface{}, time time.Time, duration time.Duration) []ScheduleItem // Schedule an item at the given time+timestamp, with the given duration // this func returns the conflicts based on item timestamp and duration ScheduleWithTimestamp(i interface{}, time time.Time, timestamp int64, duration time.Duration) []ScheduleItem // ScheduleASAP schedules an item as soon as possible, given its duration and considering the existing Schedule // this func returns the time at which the item is scheduled ScheduleASAP(i interface{}, duration time.Duration) time.Time }
Schedule is an extension of the JIT Queue that allows setting a duration next to the time of an item. This allows to calculate the conflicts that an item has
func NewSchedule ¶
func NewSchedule() Schedule
NewSchedule returns a new Schedule (see Schedule interface)
type ScheduleItem ¶
ScheduleItem has a Time() and Duration()
type ScheduleItemWithTimestamp ¶
ScheduleItemWithTimestamp has a Timestamp() and Duration()
Click to show internal directories.
Click to hide internal directories.