Skip to content

Commit

Permalink
fix: pass by reference
Browse files Browse the repository at this point in the history
  • Loading branch information
VihasMakwana committed Aug 22, 2024
1 parent 8ca5b93 commit 0ccc8a5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/stanza/fileconsumer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (c Config) Build(set component.TelemetrySettings, emit emit.Callback, opts
}

set.Logger = set.Logger.With(zap.String("component", "fileconsumer"))
readerFactory := reader.Factory{
readerFactory := &reader.Factory{
TelemetrySettings: set,
FromBeginning: startAtBeginning,
FingerprintSize: int(c.FingerprintSize),
Expand Down
3 changes: 2 additions & 1 deletion pkg/stanza/fileconsumer/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Manager struct {
wg sync.WaitGroup
cancel context.CancelFunc

readerFactory reader.Factory
readerFactory *reader.Factory
fileMatcher *matcher.Matcher
tracker tracker.Tracker
archive archive.Archive
Expand Down Expand Up @@ -203,6 +203,7 @@ func (m *Manager) makeFingerprint(path string) (*fingerprint.Fingerprint, *os.Fi
// discarding any that have a duplicate fingerprint to other files that have already
// been read this polling interval
func (m *Manager) makeReaders(ctx context.Context, paths []string) {
m.unmatchedFiles = make([]*archive.ArchiveFileRecord, 0)
for _, path := range paths {
fp, file := m.makeFingerprint(path)
if fp == nil {
Expand Down
5 changes: 3 additions & 2 deletions pkg/stanza/fileconsumer/internal/archive/archive_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ import (
)

type defaultArchive struct {
readerFactory reader.Factory
readerFactory *reader.Factory
}

func NewDefaultArchive(readerFactory reader.Factory) Archive {
func NewDefaultArchive(readerFactory *reader.Factory) Archive {
return &defaultArchive{readerFactory: readerFactory}
}

func (a *defaultArchive) SetStorageClient(_ operator.Persister) {
}

func (a *defaultArchive) Match(unmatchedFiles []*ArchiveFileRecord) ([]*reader.Reader, error) {
// to be called once per poll
readers := make([]*reader.Reader, 0)
var combinedError error
for _, record := range unmatchedFiles {
Expand Down

0 comments on commit 0ccc8a5

Please sign in to comment.