feat: game lobby service
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package ports
|
||||
|
||||
import "context"
|
||||
|
||||
// StreamOffsetStore persists the last successfully processed Redis
|
||||
// Stream entry id per stream. Workers call Load on startup to resume
|
||||
// from the persisted offset and Save after every successful message
|
||||
// handling so the next iteration advances past the just-processed
|
||||
// entry. Lobby uses one logical store with the per-stream key encoded
|
||||
// inside the implementation.
|
||||
type StreamOffsetStore interface {
|
||||
// Load returns the last processed entry id for stream when one is
|
||||
// stored. The boolean return reports whether a value was present;
|
||||
// implementations must not return an error for a missing key.
|
||||
Load(ctx context.Context, stream string) (entryID string, found bool, err error)
|
||||
|
||||
// Save stores entryID as the new last processed offset for stream.
|
||||
// Implementations overwrite any previous value unconditionally.
|
||||
Save(ctx context.Context, stream, entryID string) error
|
||||
}
|
||||
Reference in New Issue
Block a user