aboutsummaryrefslogtreecommitdiff
path: root/core/record.go
diff options
context:
space:
mode:
authorsangtran <tranquangsang12.7@gmail.com>2026-08-29 01:08:28 +0700
committersangtran <tranquangsang12.7@gmail.com>2026-08-29 01:08:28 +0700
commit96c07bab1086510a55a004e9a1b90c30bc723a5c (patch)
tree7abbc615c51667e111fdef7b2ef69a9fc663f2ca /core/record.go
signatureVerified sangtran <tranquangsang12.7@gmail.com> Key: 8DD79823D235E1BB ultimate trust
downloadflux-96c07bab1086510a55a004e9a1b90c30bc723a5c.tar.gz
flux-96c07bab1086510a55a004e9a1b90c30bc723a5c.zip
Verified feat: init base draft support window
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}