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 /transport/channel.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 'transport/channel.go')
| -rw-r--r-- | transport/channel.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/transport/channel.go b/transport/channel.go new file mode 100644 index 0000000..56d5f2b --- /dev/null +++ b/transport/channel.go | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | package transport | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "context" | ||
| 5 | |||
| 6 | "flux/core" | ||
| 7 | ) | ||
| 8 | |||
| 9 | type Receiver[T any] interface { | ||
| 10 | // Receive returns the next record, or ok=false once the stream is done or | ||
| 11 | // ctx is cancelled. | ||
| 12 | Receive(ctx context.Context) (core.StreamRecord[T], bool) | ||
| 13 | Close() error | ||
| 14 | } | ||
| 15 | |||
| 16 | // Emitter mirrors core.Emitter plus Close. It is declared separately because | ||
| 17 | // core cannot import transport without an import cycle. | ||
| 18 | type Emitter[T any] interface { | ||
| 19 | // Emit blocks until the record is handed off, or returns ctx.Err() if ctx | ||
| 20 | // is cancelled first. | ||
| 21 | Emit(ctx context.Context, record core.StreamRecord[T]) error | ||
| 22 | Close() error | ||
| 23 | } | ||
