Skip to content

Commit

Permalink
Add some more doc comments to pullerGroup methods
Browse files Browse the repository at this point in the history
  • Loading branch information
barrettj12 committed Aug 17, 2023
1 parent 8863487 commit c0584ce
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internals/overlord/logstate/puller.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ func newPullerGroup(targetName string) *pullerGroup {
return pg
}

// Add adds a new puller to the group. This puller will read from the given
// buffer, and send parsed logs on the provided channel.
func (pg *pullerGroup) Add(serviceName string, buffer *servicelog.RingBuffer, entryCh chan<- servicelog.Entry) {
pg.mu.Lock()
defer pg.mu.Unlock()
Expand Down Expand Up @@ -119,12 +121,15 @@ func (pg *pullerGroup) Services() []string {
return svcs
}

// Remove removes the puller for the named service.
func (pg *pullerGroup) Remove(serviceName string) {
pg.mu.Lock()
defer pg.mu.Unlock()
pg.remove(serviceName)
}

// remove removes the puller for the named service.
// This method is not concurrency-safe - please lock pg.mu before calling.
func (pg *pullerGroup) remove(serviceName string) {
puller, pullerExists := pg.pullers[serviceName]
if !pullerExists {
Expand All @@ -140,6 +145,7 @@ func (pg *pullerGroup) remove(serviceName string) {
}
}

// KillAll kills all pullers in this group.
func (pg *pullerGroup) KillAll() {
pg.mu.RLock()
defer pg.mu.RUnlock()
Expand Down

0 comments on commit c0584ce

Please sign in to comment.