-
Notifications
You must be signed in to change notification settings - Fork 2
/
processor.go
34 lines (27 loc) · 1.02 KB
/
processor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package kstreams
import (
"context"
"github.com/twmb/franz-go/pkg/kgo"
)
// Processor is a low-level interface. The implementation can retain the
// ProcessorContext passed into Init and use it to access state stores and
// forward data to downstream nodes. This is fairly low-level and allows for a
// lot of flexibility, but may be inconvenient to use for more specialized use
// cases. More high-level interfaces can be built on top of this, i.e. a
// Processor that receives input, and forwards it to only one downstream node.
type Processor[Kin any, Vin any, Kout any, Vout any] interface {
Init(ProcessorContext[Kout, Vout]) error
Close() error
Process(ctx context.Context, k Kin, v Vin) error
}
type Input[Kin any, Vin any] struct {
}
type Record[K, V any] struct {
Key K
Value V
X kgo.Record
}
type Output[Kout any, Vout any] struct {
}
// ProcessorBuilder creates an actual processor for a specific TopicPartition.
type ProcessorBuilder[Kin any, Vin any, Kout any, Vout any] func() Processor[Kin, Vin, Kout, Vout]