events

package
v0.32.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Producer

type Producer interface {
	Connect(context.Context, *grpc.ClientConn) error
}

Producer is an object that uses a gRPC connection to emit events to the server.

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

Scheduler holds timeSlice objects and provides an methods to update them..

func NewScheduler

func NewScheduler(logger log.Logger) *Scheduler

NewScheduler returns a new Scheduler.

func (*Scheduler) All

func (s *Scheduler) All() TimeSlice

All returns all current timeSlice objects.

func (*Scheduler) NamesForTime

func (s *Scheduler) NamesForTime(t time.Time) []string

NamesForTime returns all event names that are scheduled for a given timeSlice.

func (*Scheduler) Next

func (s *Scheduler) Next() *time.Time

Next determines the next occurring event in the series.

func (*Scheduler) Report

func (s *Scheduler) Report()

func (*Scheduler) Set

func (s *Scheduler) Set(t time.Time, name string) error

Set appends the name given to the time slot given.

func (*Scheduler) Step

func (s *Scheduler) Step()

Step deletes the next timeSlice. This is determined to be the timeSlice that has just run. The expectation is that Step() is called once the events have completed firing to advance to the next position in time.

func (*Scheduler) TimesForName

func (s *Scheduler) TimesForName(n string) []time.Time

TimesForName returns all timeSlices for a given event name.

func (*Scheduler) WaitForNext

func (s *Scheduler) WaitForNext() []string

WaitForNext is a blocking function that waits for the next available time to arrive before returning the names to the caller.

type TimeSlice

type TimeSlice map[time.Time][]string

TimeSlice is an association between a specific time, and the names of the events that should fire at that time.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL