Documentation
¶
Index ¶
- Variables
- type Config
- type Option
- type Relay
- func (r *Relay) EnableDashboard(addr string)
- func (r *Relay) Enqueue(topic string, payload interface{}) (string, error)
- func (r *Relay) Register(topic string, fn registry.HandlerFunc, payloadType interface{}) error
- func (r *Relay) Schedule(executeAt time.Time, topic string, payload interface{}) (string, error)
- func (r *Relay) Shutdown(ctx context.Context) error
- func (r *Relay) Start() error
- type RelayError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Core errors ErrHandlerNotFound = errors.New("handler not found for topic") ErrTaskNotFound = errors.New("task not found") ErrTaskAlreadyExists = errors.New("task already exists") ErrTaskAlreadyComplete = errors.New("task already completed") // Storage errors ErrStorageFull = errors.New("storage is full") ErrStorageTimeout = errors.New("storage operation timeout") ErrConnectionFailed = errors.New("connection to storage failed") // Worker errors ErrWorkerPoolFull = errors.New("worker pool is full") ErrWorkerTimeout = errors.New("worker execution timeout") // Queue errors ErrQueueFull = errors.New("queue is full") ErrQueueEmpty = errors.New("queue is empty") // Validation errors ErrInvalidTopic = errors.New("invalid topic name") ErrInvalidPayload = errors.New("invalid payload") ErrInvalidScheduleTime = errors.New("invalid schedule time") // Configuration errors ErrInvalidConfig = errors.New("invalid configuration") ErrInvalidStorageType = errors.New("invalid storage type") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Worker configuration
WorkerCount int `json:"worker_count"`
WorkerBatchSize int `json:"worker_batch_size"`
// Retry configuration
MaxRetries int `json:"max_retries"`
RetryBackoff time.Duration `json:"retry_backoff"`
RetryMaxDelay time.Duration `json:"retry_max_delay"`
// Storage configuration
StorageType string `json:"storage_type"`
StorageDSN string `json:"storage_dsn"`
// Dashboard configuration
DashboardAddr string `json:"dashboard_addr"`
DashboardAuth bool `json:"dashboard_auth"`
DashboardUser string `json:"dashboard_user"`
DashboardPass string `json:"dashboard_pass"`
// Task configuration
TaskRetention time.Duration `json:"task_retention"`
FailedRetention time.Duration `json:"failed_retention"`
VisibilityTimeout time.Duration `json:"visibility_timeout"`
// Performance
BatchSize int `json:"batch_size"`
RingBufferSize int `json:"ring_buffer_size"`
MemoryLimit int64 `json:"memory_limit"`
}
func DefaultConfig ¶
func DefaultConfig() *Config
type Option ¶
type Option func(*Config)
func WithDashboard ¶
func WithMaxRetries ¶
func WithStorage ¶
func WithWorkerCount ¶
type Relay ¶
type Relay struct {
// contains filtered or unexported fields
}
func (*Relay) EnableDashboard ¶
EnableDashboard enables the dashboard on the specified address
func (*Relay) Register ¶
func (r *Relay) Register(topic string, fn registry.HandlerFunc, payloadType interface{}) error
Register registers a handler for a topic
type RelayError ¶
func (*RelayError) Error ¶
func (e *RelayError) Error() string
func (*RelayError) Unwrap ¶
func (e *RelayError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.