WIP Reworking data module

This commit is contained in:
2026-02-05 22:55:48 +08:00
parent 9b9d9e2156
commit b3841f5647
10 changed files with 361 additions and 71 deletions

27
pkg/data/stream.go Normal file
View File

@@ -0,0 +1,27 @@
package data
import (
"context"
"github.com/google/uuid"
)
type StreamID uuid.UUID
type Stream interface {
ID() StreamID
Sender() Sender
Receiver() Receiver
}
type Sender interface {
Send(context.Context, Envelope) error
SendBatch(context.Context, []Envelope) error
}
type Receiver interface {
TryReceive() (Envelope, bool, error)
ReceiveNext(context.Context) (Envelope, error)
Seq() uint64
}