WIP Reworking data module
This commit is contained in:
27
pkg/data/stream.go
Normal file
27
pkg/data/stream.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user