scheduler

package
v0.0.0-...-906b757 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AggregationTypeNo     = iota
	AggregationTypeSkip   = iota
	AggregationTypeAppend = iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregationType

type AggregationType int

type Config

type Config struct {
	ProjectID           string
	IngressSubscription string
	DefaultEgress       EgressTopicConfig
	Routing             map[string]EgressTopicConfig
}

func ParseConfig

func ParseConfig(buffer []byte) (Config, error)

type EgressTopicConfig

type EgressTopicConfig struct {
	Name        string
	Aggregation AggregationType
}

type Ingress

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

func NewIngress

func NewIngress(config IngressConfig) *Ingress

func (*Ingress) Receive

func (p *Ingress) Receive(ctx context.Context, data []byte, attributes map[string]string) error

type IngressConfig

type IngressConfig struct {
	Router     Router
	Storage    storage.SchedulerStorage
	TimeSource TimeSource
}

type Router

type Router interface {
	io.Closer
	Publish(ctx context.Context, msgType string, data []byte, attributes map[string]string) (msgqueue.PublishResult, error)
}

func NewRouter

func NewRouter(ctx context.Context, config Config) (Router, error)

type SystemTime

type SystemTime struct{}

func (SystemTime) Now

func (SystemTime) Now() time.Time

type Ticker

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

func NewTicker

func NewTicker(config TickerConfig) *Ticker

func (*Ticker) HandleMessage

func (t *Ticker) HandleMessage(ctx context.Context, msg storage.ScheduledMessage) error

func (*Ticker) RunTicker

func (h *Ticker) RunTicker(ctx context.Context)

Activates ticker loop

type TickerConfig

type TickerConfig struct {
	Router     Router
	Storage    storage.SchedulerStorage
	TimeSource TimeSource
}

type TimeSource

type TimeSource interface {
	Now() time.Time
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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