infrastructure

package
v0.231.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const RedisQueueKeyPrefix = "infer:queue:"

RedisQueueKeyPrefix namespaces the queue lists. External producers feed a running infer by pushing a JSON queuedRecord to infer:queue:<name> (RPUSH).

Variables

This section is empty.

Functions

func NewPostgresMessageQueue

func NewPostgresMessageQueue(pgConn storage.PostgresConfig, name string, interval time.Duration, wake func()) (convdomain.MessageQueue, error)

NewPostgresMessageQueue dials the storage.postgres connection, applies the schema migrations and returns the durable queue adapter. Startup fails fast with an error naming the backend when PostgreSQL is unreachable.

func NewRedisMessageQueue

func NewRedisMessageQueue(conn storage.RedisConfig, name string, interval time.Duration, wake func()) (convdomain.MessageQueue, error)

NewRedisMessageQueue dials the storage.redis connection and returns the Redis-backed queue adapter. Startup fails fast with an error naming the backend when Redis is unreachable.

func NewSQLiteMessageQueue

func NewSQLiteMessageQueue(sqliteConn storage.SQLiteConfig, name string, interval time.Duration, wake func()) (convdomain.MessageQueue, error)

NewSQLiteMessageQueue opens the storage.sqlite database, applies the schema migrations and returns the durable queue adapter. Startup fails fast with an error naming the backend when the database file is unusable.

Types

type MessageQueueService

type MessageQueueService struct {
	// contains filtered or unexported fields
}

MessageQueueService manages the in-memory message queue: the process-local default backend where nothing can fail and nothing survives a restart.

func NewMessageQueueService

func NewMessageQueueService() *MessageQueueService

NewMessageQueueService creates a new message queue service

func (*MessageQueueService) BackendName

func (mq *MessageQueueService) BackendName() string

BackendName names the active backend for the status bar indicator

func (*MessageQueueService) Clear

Clear removes all messages from the queue

func (*MessageQueueService) Dequeue

Dequeue removes and returns the next message from the queue Returns nil if the queue is empty

func (*MessageQueueService) Drain

Drain removes and returns every queued message, oldest first

func (*MessageQueueService) Enqueue

func (mq *MessageQueueService) Enqueue(_ context.Context, message sdk.Message, source convdomain.QueuedMessageSource, requestID string) error

Enqueue adds a message to the queue with its origin source and request ID

func (*MessageQueueService) GetAll

GetAll returns all messages in the queue without removing them

func (*MessageQueueService) IsEmpty

func (mq *MessageQueueService) IsEmpty() bool

IsEmpty returns true if the queue has no messages

func (*MessageQueueService) Size

func (mq *MessageQueueService) Size() int

Size returns the number of messages in the queue

func (*MessageQueueService) Unreachable

func (mq *MessageQueueService) Unreachable() bool

Unreachable reports whether the backend failed its latest operation; the memory queue never fails

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL