blob: c7bec77501174937c5150d6aa93e462e1550784f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package line
import (
"bytes"
)
// Processor defines an interface for processing lines read from files.
// This interface replaces the channel-based approach for better performance.
type Processor interface {
// ProcessLine handles a single line read from a file.
// The line buffer ownership is transferred to the processor.
// Returns error if processing should stop.
ProcessLine(line *bytes.Buffer, lineNum uint64, sourceID string) error
// Flush ensures any buffered data is written out.
// Called when file reading completes or on periodic intervals.
Flush() error
// Close cleans up any resources used by the processor.
// Called when processing is complete.
Close() error
}
|