diff options
| author | sangtran <tranquangsang12.7@gmail.com> | 2026-08-29 01:08:28 +0700 |
|---|---|---|
| committer | sangtran <tranquangsang12.7@gmail.com> | 2026-08-29 01:08:28 +0700 |
| commit | 96c07bab1086510a55a004e9a1b90c30bc723a5c (patch) | |
| tree | 7abbc615c51667e111fdef7b2ef69a9fc663f2ca /core/record.go | |
| signature | Verified sangtran <tranquangsang12.7@gmail.com> Key: 8DD79823D235E1BB ultimate trust | |
| download | flux-96c07bab1086510a55a004e9a1b90c30bc723a5c.tar.gz flux-96c07bab1086510a55a004e9a1b90c30bc723a5c.zip | |
Verified feat: init base draft support window
Diffstat (limited to 'core/record.go')
| -rw-r--r-- | core/record.go | 40 |
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 @@ | |||
| 1 | package core | ||
| 2 | |||
| 3 | type RecordType byte | ||
| 4 | |||
| 5 | const ( | ||
| 6 | RecordData RecordType = iota | ||
| 7 | RecordWatermark | ||
| 8 | RecordBarrier | ||
| 9 | ) | ||
| 10 | |||
| 11 | type 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 | |||
| 19 | func 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 | |||
| 28 | func NewWatermarkRecord[T any](timestamp int64) StreamRecord[T] { | ||
| 29 | return StreamRecord[T]{ | ||
| 30 | Type: RecordWatermark, | ||
| 31 | Timestamp: timestamp, | ||
| 32 | } | ||
| 33 | } | ||
| 34 | |||
| 35 | func NewBarrierRecord[T any](barrierID uint64) StreamRecord[T] { | ||
| 36 | return StreamRecord[T]{ | ||
| 37 | Type: RecordBarrier, | ||
| 38 | BarrierID: barrierID, | ||
| 39 | } | ||
| 40 | } | ||
