scheduled

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

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

Dispatcher

func NewDispatcher

func NewDispatcher(lister func() (map[int64]*pb.Checker, error), reload time.Duration, log logs.Logger) *Dispatcher

func (*Dispatcher) Put

func (p *Dispatcher) Put(c *pb.Checker)

func (*Dispatcher) Remove

func (p *Dispatcher) Remove(id int64)

func (*Dispatcher) Run

func (p *Dispatcher) Run(ctx context.Context) error

func (*Dispatcher) Watch

func (p *Dispatcher) Watch() <-chan *fetcher.Event

type IDSet

type IDSet map[int64]struct{}

IDSet .

func (IDSet) Contains

func (s IDSet) Contains(id int64) bool

func (IDSet) Put

func (s IDSet) Put(id int64)

type Node

type Node struct {
	ID string
}

Node .

type RedisScheduleStorage

type RedisScheduleStorage struct {
	Root      string
	Redis     *redis.Client
	NodesFunc func() ([]*Node, error)
}

RedisScheduleStorage

func (*RedisScheduleStorage) Add

func (s *RedisScheduleStorage) Add(nodeID string, id int64) error

func (*RedisScheduleStorage) Del

func (s *RedisScheduleStorage) Del(nodeID string, id int64) error

func (*RedisScheduleStorage) Foreach

func (s *RedisScheduleStorage) Foreach(nodeID string, h func(int64) bool) error

func (*RedisScheduleStorage) Get

func (s *RedisScheduleStorage) Get(nodeID string) (IDSet, error)

func (*RedisScheduleStorage) Nodes

func (s *RedisScheduleStorage) Nodes() ([]*Node, error)

func (*RedisScheduleStorage) NodesKeepAlive

func (s *RedisScheduleStorage) NodesKeepAlive(nodes []*Node, ttl time.Duration) error

func (*RedisScheduleStorage) RemoveNode

func (s *RedisScheduleStorage) RemoveNode(nodeID string) error

type ScheduleStorage

type ScheduleStorage interface {
	Nodes() ([]*Node, error)
	NodesKeepAlive(nodes []*Node, ttl time.Duration) error
	RemoveNode(nodeID string) error
	Get(nodeID string) (IDSet, error)
	Add(nodeID string, id int64) error
	Del(nodeID string, id int64) error
	Foreach(nodeID string, h func(int64) bool) error
}

ScheduleStorage .

type Scheduler

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

Scheduler .

func NewScheduler

func NewScheduler(source storage.Interface, storage ScheduleStorage, interval time.Duration, log logs.Logger) *Scheduler

NewScheduler .

func (*Scheduler) ListIDs

func (s *Scheduler) ListIDs(nodeID string) (list []int64, err error)

func (*Scheduler) RemoveNode

func (s *Scheduler) RemoveNode(nodeID string)

func (*Scheduler) Reschedule

func (s *Scheduler) Reschedule()

Reschedule .

func (*Scheduler) Run

func (s *Scheduler) Run(ctx context.Context)

Run .

Jump to

Keyboard shortcuts

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