Documentation ¶
Index ¶
- type MockAddRemove
- type MockSourceManager
- func (sm *MockSourceManager) AddService(service *service.Service)
- func (sm *MockSourceManager) AddSource(source *sources.LogSource)
- func (sm *MockSourceManager) GetSources() []*sources.LogSource
- func (sm *MockSourceManager) RemoveService(service *service.Service)
- func (sm *MockSourceManager) RemoveSource(source *sources.LogSource)
- type Scheduler
- type Schedulers
- type SourceManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockAddRemove ¶
type MockAddRemove struct { // Added is true if this source was added; otherwise it was removed Add bool // Source is the source that was added or removed, or nil. Source *sources.LogSource // Service is the service that was added or removed, or nil. Service *service.Service }
MockAddRemove is an event observed by MockSourceManager
type MockSourceManager ¶
type MockSourceManager struct { // Events are the events that occurred in the spy Events []MockAddRemove // Sources are the sources returned by GetSources Sources []*sources.LogSource }
MockSourceManager is a "spy" that records the AddSource and RemoveSource calls that it receives.
This is a useful tool in testing schedulers. Its zero value is a valid beginning state.
func (*MockSourceManager) AddService ¶
func (sm *MockSourceManager) AddService(service *service.Service)
AddService implements SourceManager#AddService.
func (*MockSourceManager) AddSource ¶
func (sm *MockSourceManager) AddSource(source *sources.LogSource)
AddSource implements SourceManager#AddSource.
func (*MockSourceManager) GetSources ¶
func (sm *MockSourceManager) GetSources() []*sources.LogSource
GetSources implements SourceManager#GetSources.
func (*MockSourceManager) RemoveService ¶
func (sm *MockSourceManager) RemoveService(service *service.Service)
RemoveService implements SourceManager#RemoveService.
func (*MockSourceManager) RemoveSource ¶
func (sm *MockSourceManager) RemoveSource(source *sources.LogSource)
RemoveSource implements SourceManager#RemoveSource.
type Scheduler ¶
type Scheduler interface { // Start the scheduler, managing sources and services via the given manager. Start(sourceMgr SourceManager) // Stop the scheduler, and wait until shutdown is complete. It is not // necessary to remove sources or services here, but any background // goroutines or other resources should be freed. Stop() }
Scheduler implementations manage logs-agent sources.
Schedulers are started when the logs-agent starts, and stopped when it stops.
type Schedulers ¶
type Schedulers struct {
// contains filtered or unexported fields
}
Schedulers manages a collection of schedulers.
func NewSchedulers ¶
func NewSchedulers(sources *sources.LogSources, services *service.Services) *Schedulers
NewSchedulers creates a new, empty Schedulers instance
func (*Schedulers) AddScheduler ¶
func (ss *Schedulers) AddScheduler(scheduler Scheduler)
AddScheduler adds a scheduler to the collection. If called after Start(), then the scheduler will be started immediately.
func (*Schedulers) GetSources ¶
func (ss *Schedulers) GetSources() []*sources.LogSource
GetSources returns all the log source from the source manager.
func (*Schedulers) Start ¶
func (ss *Schedulers) Start()
Start starts all schedulers in the collection.
func (*Schedulers) Stop ¶
func (ss *Schedulers) Stop()
Stop all schedulers and wait until they are complete.
type SourceManager ¶
type SourceManager interface { // AddSource adds a new source to the logs agent. The new source is // distributed to all active launchers, which may create appropriate // tailers and begin forwarding messages. AddSource(source *sources.LogSource) // RemoveSource removes an existing source from the logs agent. The // source is recognized by pointer equality. RemoveSource(source *sources.LogSource) // GetSources returns all the sources currently held. The result is copied and // will not be modified after it is returned, and represents a "snapshot" of the // state when the function was called. GetSources() []*sources.LogSource // AddService adds a new service to the logs agent. AddService(service *service.Service) // RemoveService removes a service added with AddService. The source // is recognized by pointer equality. RemoveService(service *service.Service) }
SourceManager is the interface by which schedulers add and remove sources from the agent.
(services are also included here, temporarily)