From 375da69ffc3bfd01d952783c14d2b2469a9bfc76 Mon Sep 17 00:00:00 2001 From: Daniel Jaglowski Date: Tue, 13 Jun 2023 08:23:00 -0600 Subject: [PATCH] [chore] Deprecate unnecessary fileconsumer API (#23281) * [chore] Deprecate unnecessary fileconsumer API * Add deprecation version and tentative removal version --- pkg/stanza/fileconsumer/finder.go | 2 ++ pkg/stanza/fileconsumer/fingerprint.go | 9 ++++++++- pkg/stanza/fileconsumer/reader.go | 2 ++ pkg/stanza/fileconsumer/scanner.go | 4 ++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pkg/stanza/fileconsumer/finder.go b/pkg/stanza/fileconsumer/finder.go index 910a6a9cc31e..6b6d0b3c0772 100644 --- a/pkg/stanza/fileconsumer/finder.go +++ b/pkg/stanza/fileconsumer/finder.go @@ -13,6 +13,8 @@ type Finder struct { } // FindFiles gets a list of paths given an array of glob patterns to include and exclude +// +// Deprecated: [v0.80.0] This will be made internal in a future release, tentatively v0.82.0. func (f Finder) FindFiles() []string { all := make([]string, 0, len(f.Include)) for _, include := range f.Include { diff --git a/pkg/stanza/fileconsumer/fingerprint.go b/pkg/stanza/fileconsumer/fingerprint.go index 62b5a7de2e40..dc1b3d925392 100644 --- a/pkg/stanza/fileconsumer/fingerprint.go +++ b/pkg/stanza/fileconsumer/fingerprint.go @@ -11,16 +11,23 @@ import ( "os" ) +// Deprecated: [v0.80.0] This will be made internal in a future release, tentatively v0.82.0. const DefaultFingerprintSize = 1000 // bytes -const MinFingerprintSize = 16 // bytes + +// Deprecated: [v0.80.0] This will be made internal in a future release, tentatively v0.82.0. +const MinFingerprintSize = 16 // bytes // Fingerprint is used to identify a file // A file's fingerprint is the first N bytes of the file +// +// Deprecated: [v0.80.0] This will be made internal in a future release, tentatively v0.82.0. type Fingerprint struct { FirstBytes []byte } // NewFingerprint creates a new fingerprint from an open file +// +// Deprecated: [v0.80.0] This will be made internal in a future release, tentatively v0.82.0. func NewFingerprint(file *os.File, size int) (*Fingerprint, error) { buf := make([]byte, size) diff --git a/pkg/stanza/fileconsumer/reader.go b/pkg/stanza/fileconsumer/reader.go index e34399916ea0..e4e18ecbb868 100644 --- a/pkg/stanza/fileconsumer/reader.go +++ b/pkg/stanza/fileconsumer/reader.go @@ -23,6 +23,8 @@ type readerConfig struct { } // Reader manages a single file +// +// Deprecated: [v0.80.0] This will be made internal in a future release, tentatively v0.82.0. type Reader struct { *zap.SugaredLogger `json:"-"` // json tag excludes embedded fields from storage *readerConfig diff --git a/pkg/stanza/fileconsumer/scanner.go b/pkg/stanza/fileconsumer/scanner.go index e39eadcb64a5..410c868080a1 100644 --- a/pkg/stanza/fileconsumer/scanner.go +++ b/pkg/stanza/fileconsumer/scanner.go @@ -14,12 +14,16 @@ import ( const defaultBufSize = 16 * 1024 // PositionalScanner is a scanner that maintains position +// +// Deprecated: [v0.80.0] This will be made internal in a future release, tentatively v0.82.0. type PositionalScanner struct { pos int64 *bufio.Scanner } // NewPositionalScanner creates a new positional scanner +// +// Deprecated: [v0.80.0] This will be made internal in a future release, tentatively v0.82.0. func NewPositionalScanner(r io.Reader, maxLogSize int, startOffset int64, splitFunc bufio.SplitFunc) *PositionalScanner { ps := &PositionalScanner{ pos: startOffset,