plugin

package
v0.0.0-...-10905f8 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2016 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAvailableWorkers = errors.New("no workers available to process work")
View Source
var ErrUnableToRemoveWorker = errors.New("could not remove worker")
View Source
var ErrWorkNotFound = errors.New("work not found")
View Source
var ErrWorkerAlreadyExists = errors.New("worker already exists")
View Source
var ErrWorkerNotFound = errors.New("worker not found")

Functions

This section is empty.

Types

type Discovery

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

func (*Discovery) Accepts

func (p *Discovery) Accepts(eventType EventType) bool

func (*Discovery) Members

func (p *Discovery) Members() map[string]*Znode

func (*Discovery) Name

func (p *Discovery) Name() string

func (*Discovery) Notify

func (p *Discovery) Notify(event Event)

func (*Discovery) OnLoad

func (p *Discovery) OnLoad(curator *Curator)

func (*Discovery) OnUnload

func (p *Discovery) OnUnload()

func (*Discovery) StartDiscovery

func (p *Discovery) StartDiscovery()

func (*Discovery) StopDiscovery

func (p *Discovery) StopDiscovery()

type EventSpew

type EventSpew struct {
	Log *logrus.Entry
	// contains filtered or unexported fields
}

func (*EventSpew) Accepts

func (p *EventSpew) Accepts(eventType EventType) bool

func (*EventSpew) Name

func (p *EventSpew) Name() string

func (*EventSpew) Notify

func (p *EventSpew) Notify(event Event)

func (*EventSpew) OnLoad

func (p *EventSpew) OnLoad(curator *Curator)

func (*EventSpew) OnUnload

func (p *EventSpew) OnUnload()

type Leader

type Leader struct {
	Signature []byte
	// contains filtered or unexported fields
}

func (*Leader) Accepts

func (p *Leader) Accepts(eventType EventType) bool

func (*Leader) IsLeader

func (p *Leader) IsLeader() bool

func (*Leader) LockPath

func (p *Leader) LockPath() string

func (*Leader) Name

func (p *Leader) Name() string

func (*Leader) Notify

func (p *Leader) Notify(event Event)

func (*Leader) OnLoad

func (p *Leader) OnLoad(curator *Curator)

func (*Leader) OnUnload

func (p *Leader) OnUnload()

func (*Leader) Resign

func (p *Leader) Resign()

func (*Leader) RunForElection

func (p *Leader) RunForElection()

type Member

type Member struct {
	ID string
	// contains filtered or unexported fields
}

func (*Member) Accepts

func (p *Member) Accepts(eventType EventType) bool

func (*Member) MemberPath

func (p *Member) MemberPath() string

func (*Member) Name

func (p *Member) Name() string

func (*Member) Notify

func (p *Member) Notify(event Event)

func (*Member) OnLoad

func (p *Member) OnLoad(curator *Curator)

func (*Member) OnUnload

func (p *Member) OnUnload()

func (*Member) Register

func (p *Member) Register()

func (*Member) Unregister

func (p *Member) Unregister()

type MembershipMeta

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

type Metrics

type Metrics struct {
	Registry metrics.Registry
	// contains filtered or unexported fields
}

func (*Metrics) Accepts

func (p *Metrics) Accepts(eventType EventType) bool

func (*Metrics) Name

func (p *Metrics) Name() string

func (*Metrics) Notify

func (p *Metrics) Notify(event Event)

func (*Metrics) OnLoad

func (p *Metrics) OnLoad(curator *Curator)

func (*Metrics) OnUnload

func (p *Metrics) OnUnload()

type Work

type Work struct {
	Znode
	Children *ChildCache
}

func NewWork

func NewWork(client *Client, path string) *Work

func (Work) Id

func (w Work) Id() string

func (Work) Spew

func (w Work) Spew() string

type WorkCollector

type WorkCollector struct {
	ID string
	// contains filtered or unexported fields
}

func (*WorkCollector) Accepts

func (p *WorkCollector) Accepts(eventType EventType) bool

func (*WorkCollector) Name

func (p *WorkCollector) Name() string

func (*WorkCollector) Notify

func (p *WorkCollector) Notify(event Event)

func (*WorkCollector) OnLoad

func (p *WorkCollector) OnLoad(curator *Curator)

func (*WorkCollector) OnUnload

func (p *WorkCollector) OnUnload()

func (*WorkCollector) StopWatching

func (p *WorkCollector) StopWatching()

func (*WorkCollector) WatchForWork

func (p *WorkCollector) WatchForWork()

func (*WorkCollector) Work

func (p *WorkCollector) Work() (work map[string]*Znode)

type WorkLeader

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

func (*WorkLeader) Accepts

func (p *WorkLeader) Accepts(eventType EventType) bool

func (*WorkLeader) AddWork

func (p *WorkLeader) AddWork(node *Znode) (err error)

AddWork adds work to the master list, and is independent of leadership status. It is a convenience method that simply writes znodes to the appropriate path in zk.

func (*WorkLeader) IsLeader

func (p *WorkLeader) IsLeader() bool

func (*WorkLeader) Name

func (p *WorkLeader) Name() string

func (*WorkLeader) Notify

func (p *WorkLeader) Notify(event Event)

func (*WorkLeader) OnLoad

func (p *WorkLeader) OnLoad(curator *Curator)

func (*WorkLeader) OnUnload

func (p *WorkLeader) OnUnload()

func (*WorkLeader) RemoveWork

func (p *WorkLeader) RemoveWork(node *Znode) (err error)

RemoveWork removes work from the master list, and is independent of leadership status. It is a convenience method that simply removes znodes from the appropriate path in zk.

type WorkSupervisor

type WorkSupervisor struct {
	Logger       *log.Logger
	LogComponent string
	// contains filtered or unexported fields
}

func NewWorkSupervisor

func NewWorkSupervisor(client *Client, workPath string) *WorkSupervisor

func (*WorkSupervisor) AddWork

func (s *WorkSupervisor) AddWork(node *Znode) (err error)

func (*WorkSupervisor) AddWorker

func (s *WorkSupervisor) AddWorker(node *Znode) (err error)

func (*WorkSupervisor) AssignWork

func (s *WorkSupervisor) AssignWork(work *Znode) error

func (*WorkSupervisor) GetWork

func (s *WorkSupervisor) GetWork() *Work

func (*WorkSupervisor) GetWorkers

func (s *WorkSupervisor) GetWorkers() *WorkerList

func (*WorkSupervisor) Load

func (s *WorkSupervisor) Load() (err error)

func (*WorkSupervisor) RemoveWork

func (s *WorkSupervisor) RemoveWork(node *Znode) (err error)

func (*WorkSupervisor) RemoveWorker

func (s *WorkSupervisor) RemoveWorker(node *Znode) (err error)

type WorkSupervisorType

type WorkSupervisorType interface {
	AddWorker(worker *Worker) error
	RemoveWorker(worker *Worker) error
	AddWork(node *Znode) error
	RemoveWork(node *Znode) error
	Load() error
}

type Worker

type Worker struct {
	Znode
	Children *ChildCache
}

func NewWorker

func NewWorker(client *Client, path string) *Worker

func (Worker) Id

func (w Worker) Id() string

func (*Worker) ShiftWork

func (w *Worker) ShiftWork(amount int) []Znode

func (Worker) Spew

func (w Worker) Spew() string

func (*Worker) UnshiftWork

func (w *Worker) UnshiftWork(nodes []Znode)

type WorkerList

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

func NewWorkerList

func NewWorkerList() *WorkerList

func (*WorkerList) Add

func (l *WorkerList) Add(worker *Worker) (added bool)

func (*WorkerList) At

func (l *WorkerList) At(index int) (w *Worker)

func (*WorkerList) Find

func (l *WorkerList) Find(f func(int, *Worker) bool) (index int, w *Worker)

func (*WorkerList) FindById

func (l *WorkerList) FindById(id string) (index int, w *Worker)

func (*WorkerList) IndexOf

func (l *WorkerList) IndexOf(worker *Worker) (index *int)

func (*WorkerList) Remove

func (l *WorkerList) Remove(worker *Worker) (removed bool)

func (*WorkerList) Size

func (l *WorkerList) Size() int

func (WorkerList) Spew

func (w WorkerList) Spew() string

func (*WorkerList) ToSlice

func (l *WorkerList) ToSlice() []Worker

Jump to

Keyboard shortcuts

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