quarkshologridledger/tongo-core/internal/domain/port/cache.go

28 lines
941 B
Go

package port
import (
"context"
"github.com/costap/quarkshologridledger/tongo-core/internal/domain/entity"
)
// CachePort defines the interface for the cache layer (Valkey/Redis).
type CachePort interface {
// PushMatchState writes the full match telemetry to the cache.
PushMatchState(ctx context.Context, match *entity.Match) error
// PushEvent appends an event to the match's event log.
PushEvent(ctx context.Context, matchID string, event entity.MatchEvent) error
// UpdateActiveIndex updates the set of currently active match IDs.
UpdateActiveIndex(ctx context.Context, matchIDs []string) error
// UpdateQuadrantIndex updates the set of active matches for a specific quadrant.
UpdateQuadrantIndex(ctx context.Context, quadrantID string, matchIDs []string) error
// Ping checks that the cache connection is alive.
Ping(ctx context.Context) error
// Close gracefully shuts down the cache connection.
Close() error
}