Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinarySearchFileByDate ¶
func BinarySearchFileByDate(file string, lastUpdated time.Time, parse func(line string) (time.Time, error)) (offset int64, err error)
BinarySearchFileByDate returns the offset of the first line which date is after lastUpdated this could panic if the parse function isn't guaranteed to work on every line of the file
Types ¶
type CircularQueue ¶
type CircularQueue[T any] struct { // contains filtered or unexported fields }
Thread Safe circular queue implmentation using a slice for byte slices
func CircularQueueInit ¶
func CircularQueueInit[T any](capacity int) *CircularQueue[T]
Creates a new circular queue of given capacity
func (*CircularQueue[T]) All ¶
func (q *CircularQueue[T]) All() []T
Returns all the elements of the queue
func (*CircularQueue[T]) Capacity ¶
func (q *CircularQueue[T]) Capacity() int
Returns the capacity of the queue
func (*CircularQueue[T]) Front ¶
func (q *CircularQueue[T]) Front() T
Returns the element at the front of the queue
func (*CircularQueue[T]) Len ¶
func (q *CircularQueue[T]) Len() int
Returns the number of elements in the queue
func (*CircularQueue[T]) Pop ¶
func (q *CircularQueue[T]) Pop() (element T, err error)
Pops the element at the front of the queue If the queue is empty, returns the zero value followed by an error
func (*CircularQueue[T]) Push ¶
func (q *CircularQueue[T]) Push(element T)
Adds a new element to the queue
type Schedule ¶
type Schedule struct {
// contains filtered or unexported fields
}
Schedule is a struct that holds a list of tasks and their corresponding target time to run The invariant is that the target time must be increasing in the jobs list. So the excutation algorithm is trivial. Run the task, sleep until the next target time, repeat.