async Types

This document shows Go type definitions from the codebase.

Generated types:

ErrorCode {#errorcode}

Source: pulse/async/error.go:13

type ErrorCode string

const (
	ErrorCodeAi_error ErrorCode = "ai_error"
	ErrorCodeDatabase_error ErrorCode = "database_error"
	ErrorCodeFile_not_found ErrorCode = "file_not_found"
	ErrorCodeNetwork_error ErrorCode = "network_error"
	ErrorCodeParse_error ErrorCode = "parse_error"
	ErrorCodeTimeout ErrorCode = "timeout"
	ErrorCodeUnknown ErrorCode = "unknown"
	ErrorCodeValidation_error ErrorCode = "validation_error"
)

ErrorContext {#errorcontext}

Source: pulse/async/error.go:27

type ErrorContext struct {
	Stage string `json:"stage"`
	Code ErrorCode `json:"code"`
	Message string `json:"message"`
	Retryable bool `json:"retryable"`
	Recoverable bool `json:"recoverable"`
}

Job {#job}

Source: pulse/async/job.go:67

type Job struct {
	ID string `json:"id"`
	HandlerName string `json:"handler_name"`
	Payload json.RawMessage `json:"payload,omitempty"`
	Source string `json:"source"`
	Status JobStatus `json:"status"`
	Progress Progress `json:"progress,omitempty"`
	CostEstimate float64 `json:"cost_estimate,omitempty"`
	CostActual float64 `json:"cost_actual,omitempty"`
	PulseState *PulseState `json:"pulse_state,omitempty"`
	Error string `json:"error,omitempty"`
	ParentJobID string `json:"parent_job_id,omitempty"`
	RetryCount int `json:"retry_count,omitempty"`
	CreatedAt time.Time `json:"created_at"`
	StartedAt *time.Time `json:"started_at,omitempty"`
	CompletedAt *time.Time `json:"completed_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at"`
}

JobStatus {#jobstatus}

Source: pulse/async/job.go:13

type JobStatus string

const (
	JobStatusCancelled JobStatus = "cancelled"
	JobStatusCompleted JobStatus = "completed"
	JobStatusFailed JobStatus = "failed"
	JobStatusPaused JobStatus = "paused"
	JobStatusQueued JobStatus = "queued"
	JobStatusRunning JobStatus = "running"
)

Progress {#progress}

Source: pulse/async/job.go:47

type Progress struct {
	Current int `json:"current,omitempty"`
	Total int `json:"total,omitempty"`
}

PulseState {#pulsestate}

Source: pulse/async/job.go:36

type PulseState struct {
	CallsThisMinute int `json:"calls_this_minute,omitempty"`
	CallsRemaining int `json:"calls_remaining,omitempty"`
	SpendToday float64 `json:"spend_today,omitempty"`
	SpendThisMonth float64 `json:"spend_this_month,omitempty"`
	BudgetRemaining float64 `json:"budget_remaining,omitempty"`
	IsPaused bool `json:"is_paused,omitempty"`
	PauseReason string `json:"pause_reason,omitempty"`
}

QueueStats {#queuestats}

Source: pulse/async/queue.go:330

type QueueStats struct {
	Queued int `json:"queued"`
	Running int `json:"running"`
	Paused int `json:"paused"`
	Completed int `json:"completed"`
	Failed int `json:"failed"`
	Total int `json:"total"`
}

SystemMetrics {#systemmetrics}

Source: pulse/async/system_metrics.go:8

type SystemMetrics struct {
	WorkersActive int `json:"workers_active"`
	WorkersTotal int `json:"workers_total"`
	MemoryUsedGB float64 `json:"memory_used_gb"`
	MemoryTotalGB float64 `json:"memory_total_gb"`
	MemoryPercent float64 `json:"memory_percent"`
	JobsQueued int `json:"jobs_queued"`
	JobsRunning int `json:"jobs_running"`
}

WorkerPoolConfig {#workerpoolconfig}

Source: pulse/async/worker.go:88

type WorkerPoolConfig struct {
	Workers int `json:"workers"`
	PollInterval time.Duration `json:"poll_interval"`
	PauseOnBudget bool `json:"pause_on_budget"`
	GracefulStartPhase time.Duration `json:"graceful_start_phase"`
}