Documentation ¶
Index ¶
Constants ¶
View Source
const ( // StateRunning is the main functioning state of the watcher. It will keep tailing head segments, consuming closed // ones, and checking for new ones. StateRunning = iota // StateDraining is an intermediary state between running and stopping. The watcher will attempt to consume all the data // found in the WAL, omitting errors and assuming all segments found are "closed", that is, no longer being written. StateDraining // StateStopping means the Watcher is being stopped. It should drop all segment read activity, and exit promptly. StateStopping )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WatcherState ¶
type WatcherState struct {
// contains filtered or unexported fields
}
WatcherState is a holder for the state the Watcher is in. It provides handy methods for checking it it's stopping, getting the current state, or blocking until it has stopped.
func NewWatcherState ¶
func NewWatcherState(l log.Logger) *WatcherState
func (*WatcherState) IsDraining ¶
func (s *WatcherState) IsDraining() bool
IsDraining evaluates to true if the current state is StateDraining.
func (*WatcherState) IsStopping ¶
func (s *WatcherState) IsStopping() bool
IsStopping evaluates to true if the current state is StateStopping.
func (*WatcherState) Transition ¶
func (s *WatcherState) Transition(next int)
Transition changes the state of WatcherState to next, reacting accordingly.
func (*WatcherState) WaitForStopping ¶
func (s *WatcherState) WaitForStopping() <-chan struct{}
WaitForStopping returns a channel in which the called can read, effectively waiting until the state changes to stopping.
Click to show internal directories.
Click to hide internal directories.