aboutsummaryrefslogtreecommitdiff
path: root/core/record.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/record.go')
-rw-r--r--core/record.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/core/record.go b/core/record.go
new file mode 100644
index 0000000..e18e58d
--- /dev/null
+++ b/core/record.go
@@ -0,0 +1,40 @@
1package core
2
3type RecordType byte
4
5const (
6 RecordData RecordType = iota
7 RecordWatermark
8 RecordBarrier
9)
10
11type StreamRecord[T any] struct {
12 Value T
13 Key string // for keyBy stateful processing
14 Timestamp int64 // epoch ms time
15 BarrierID uint64 // ID checkpoint barrier
16 Type RecordType
17}
18
19func NewDataRecord[T any](key string, val T, timestamp int64) StreamRecord[T] {
20 return StreamRecord[T]{
21 Value: val,
22 Key: key,
23 Timestamp: timestamp,
24 Type: RecordData,
25 }
26}
27
28func NewWatermarkRecord[T any](timestamp int64) StreamRecord[T] {
29 return StreamRecord[T]{
30 Type: RecordWatermark,
31 Timestamp: timestamp,
32 }
33}
34
35func NewBarrierRecord[T any](barrierID uint64) StreamRecord[T] {
36 return StreamRecord[T]{
37 Type: RecordBarrier,
38 BarrierID: barrierID,
39 }
40}