Switch notifier to scheduler
This commit is contained in:
parent
689ae7cfc7
commit
491a42d352
@ -290,9 +290,9 @@ func (r *runtime) Start() error {
|
|||||||
r.closed = make(chan bool)
|
r.closed = make(chan bool)
|
||||||
|
|
||||||
var events <-chan Event
|
var events <-chan Event
|
||||||
if r.options.Notifier != nil {
|
if r.options.Scheduler != nil {
|
||||||
var err error
|
var err error
|
||||||
events, err = r.options.Notifier.Notify()
|
events, err = r.options.Scheduler.Notify()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO: should we bail here?
|
// TODO: should we bail here?
|
||||||
log.Debugf("Runtime failed to start update notifier")
|
log.Debugf("Runtime failed to start update notifier")
|
||||||
@ -327,9 +327,9 @@ func (r *runtime) Stop() error {
|
|||||||
log.Debugf("Runtime stopping %s", service.Name)
|
log.Debugf("Runtime stopping %s", service.Name)
|
||||||
service.Stop()
|
service.Stop()
|
||||||
}
|
}
|
||||||
// stop the notifier too
|
// stop the scheduler
|
||||||
if r.options.Notifier != nil {
|
if r.options.Scheduler != nil {
|
||||||
return r.options.Notifier.Close()
|
return r.options.Scheduler.Close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,9 +365,9 @@ func (k *kubernetes) Start() error {
|
|||||||
k.closed = make(chan bool)
|
k.closed = make(chan bool)
|
||||||
|
|
||||||
var events <-chan runtime.Event
|
var events <-chan runtime.Event
|
||||||
if k.options.Notifier != nil {
|
if k.options.Scheduler != nil {
|
||||||
var err error
|
var err error
|
||||||
events, err = k.options.Notifier.Notify()
|
events, err = k.options.Scheduler.Notify()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO: should we bail here?
|
// TODO: should we bail here?
|
||||||
log.Debugf("Runtime failed to start update notifier")
|
log.Debugf("Runtime failed to start update notifier")
|
||||||
@ -395,9 +395,9 @@ func (k *kubernetes) Stop() error {
|
|||||||
close(k.closed)
|
close(k.closed)
|
||||||
// set not running
|
// set not running
|
||||||
k.running = false
|
k.running = false
|
||||||
// stop the notifier too
|
// stop the scheduler
|
||||||
if k.options.Notifier != nil {
|
if k.options.Scheduler != nil {
|
||||||
return k.options.Notifier.Close()
|
return k.options.Scheduler.Close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,16 +8,16 @@ type Option func(o *Options)
|
|||||||
|
|
||||||
// Options configure runtime
|
// Options configure runtime
|
||||||
type Options struct {
|
type Options struct {
|
||||||
// Notifier for updates
|
// Scheduler for updates
|
||||||
Notifier Notifier
|
Scheduler Scheduler
|
||||||
// Service type to manage
|
// Service type to manage
|
||||||
Type string
|
Type string
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithNotifier specifies a notifier for updates
|
// WithScheduler specifies a scheduler for updates
|
||||||
func WithNotifier(n Notifier) Option {
|
func WithScheduler(n Scheduler) Option {
|
||||||
return func(o *Options) {
|
return func(o *Options) {
|
||||||
o.Notifier = n
|
o.Scheduler = n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,15 +30,15 @@ type Runtime interface {
|
|||||||
Stop() error
|
Stop() error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notifier is an update notifier
|
// Scheduler is a runtime service scheduler
|
||||||
type Notifier interface {
|
type Scheduler interface {
|
||||||
// Notify publishes notification events
|
// Notify publishes schedule events
|
||||||
Notify() (<-chan Event, error)
|
Notify() (<-chan Event, error)
|
||||||
// Close stops the notifier
|
// Close stops the scheduler
|
||||||
Close() error
|
Close() error
|
||||||
}
|
}
|
||||||
|
|
||||||
// EventType defines notification event
|
// EventType defines schedule event
|
||||||
type EventType int
|
type EventType int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
Loading…
Reference in New Issue
Block a user