From 96c07bab1086510a55a004e9a1b90c30bc723a5c Mon Sep 17 00:00:00 2001 From: sangtran Date: Sat, 29 Aug 2026 01:08:28 +0700 Subject: feat: init base draft support window --- transport/channel.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 transport/channel.go (limited to 'transport/channel.go') 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 @@ +package transport + +import ( + "context" + + "flux/core" +) + +type Receiver[T any] interface { + // Receive returns the next record, or ok=false once the stream is done or + // ctx is cancelled. + Receive(ctx context.Context) (core.StreamRecord[T], bool) + Close() error +} + +// Emitter mirrors core.Emitter plus Close. It is declared separately because +// core cannot import transport without an import cycle. +type Emitter[T any] interface { + // Emit blocks until the record is handed off, or returns ctx.Err() if ctx + // is cancelled first. + Emit(ctx context.Context, record core.StreamRecord[T]) error + Close() error +} -- cgit v1.3.1