summaryrefslogtreecommitdiff
path: root/internal/io/line/processor.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/io/line/processor.go')
-rw-r--r--internal/io/line/processor.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/io/line/processor.go b/internal/io/line/processor.go
new file mode 100644
index 0000000..c7bec77
--- /dev/null
+++ b/internal/io/line/processor.go
@@ -0,0 +1,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
+} \ No newline at end of file