28 lines
410 B
Go
28 lines
410 B
Go
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
|
|
}
|