Skip to content

Commit

Permalink
[chore] Deprecate unnecessary fileconsumer API (open-telemetry#23281)
Browse files Browse the repository at this point in the history
* [chore] Deprecate unnecessary fileconsumer API

* Add deprecation version and tentative removal version
  • Loading branch information
djaglowski authored Jun 13, 2023
1 parent 6ac5285 commit 375da69
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/stanza/fileconsumer/finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 8 additions & 1 deletion pkg/stanza/fileconsumer/fingerprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions pkg/stanza/fileconsumer/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions pkg/stanza/fileconsumer/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 375da69

Please sign in to comment.