Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager implements lease.Claimer, lease.Checker, and worker.Worker.
func NewManager ¶
func NewManager(config ManagerConfig) (*Manager, error)
NewManager returns a new *Manager configured as supplied. The caller takes responsibility for killing, and handling errors from, the returned Worker.
func (*Manager) WaitUntilExpired ¶
WaitUntilExpired is part of the lease.Claimer interface.
type ManagerConfig ¶
type ManagerConfig struct {
// Secretary is responsible for validating lease names and holder names.
Secretary Secretary
// Client is responsible for recording, retrieving, and expiring leases.
Client lease.Client
// Clock is reponsible for reporting the passage of time.
Clock clock.Clock
// MaxSleep is the longest time the Manager should sleep before
// refreshing its client's leases and checking for expiries.
MaxSleep time.Duration
}
ManagerConfig contains the resources and information required to create a Manager.
func (ManagerConfig) Validate ¶
func (config ManagerConfig) Validate() error
Validate returns an error if the configuration contains invalid information or missing resources.
type Secretary ¶
type Secretary interface {
// CheckLease returns an error if the supplied lease name is not valid.
CheckLease(name string) error
// CheckHolder returns an error if the supplied holder name is not valid.
CheckHolder(name string) error
// CheckDuration returns an error if the supplied duration is not valid.
CheckDuration(duration time.Duration) error
}
Secretary is reponsible for validating the sanity of lease and holder names before bothering the manager with them.
Click to show internal directories.
Click to hide internal directories.