blob: 1db6ea869f470d9ecf55ae9eb152d6f546941309 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package transport
import (
"context"
"goflink/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
}
|