Documentation
¶
Index ¶
- type QueuedMessage
- type Service
- func (s *Service) Clear(ctx context.Context, workspaceID, sessionID string) error
- func (s *Service) ClearWorkspace(ctx context.Context, workspaceID string) error
- func (s *Service) Dequeue(ctx context.Context, workspaceID, sessionID string) (*QueuedMessage, error)
- func (s *Service) Enqueue(ctx context.Context, workspaceID, sessionID, text string) (string, error)
- func (s *Service) Len(ctx context.Context, workspaceID, sessionID string) (int64, error)
- func (s *Service) PeekAll(ctx context.Context, workspaceID, sessionID string) ([]QueuedMessage, error)
- func (s *Service) PeekAllWorkspace(ctx context.Context, workspaceID string) ([]QueuedMessage, error)
- func (s *Service) Remove(ctx context.Context, workspaceID, sessionID, messageID string) error
- func (s *Service) Requeue(ctx context.Context, workspaceID, sessionID string, msg QueuedMessage) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type QueuedMessage ¶
type QueuedMessage struct {
ID string `json:"id"`
Text string `json:"text"`
SessionID string `json:"session_id"`
WorkspaceID string `json:"workspace_id"`
EnqueuedAt time.Time `json:"enqueued_at"`
RetryCount int `json:"retry_count"`
}
QueuedMessage represents a message held in the Redis-backed queue.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides a Redis-backed FIFO message queue per workspace+session.
func NewWithClient ¶
NewWithClient creates a queue Service backed by the given Redis client. The client is borrowed — its lifecycle is managed by the caller.
func (*Service) ClearWorkspace ¶
func (*Service) PeekAllWorkspace ¶
func (s *Service) PeekAllWorkspace(ctx context.Context, workspaceID string) ([]QueuedMessage, error)
PeekAllWorkspace returns all queued messages across every session for the given workspace. It scans Redis for all queue keys belonging to the workspace and peeks each one. The order of messages across sessions is undefined.
Click to show internal directories.
Click to hide internal directories.