Documentation
¶
Index ¶
- Constants
- func Backoff(attempt int) time.Duration
- func ContentHashHex(data []byte) string
- func IsRetryable(err error) bool
- type Job
- func (j *Job) AddError(err string)
- func (j *Job) AddFacts(valid, stored int)
- func (j *Job) FileData() []byte
- func (j *Job) IncrChunksProcessed()
- func (j *Job) SetFileData(data []byte)
- func (j *Job) SetStatus(status JobStatus, phase string)
- func (j *Job) SetTotalChunks(n int)
- func (j *Job) Snapshot() JobSnapshot
- type JobSnapshot
- type JobStatus
- type JobStore
- type Orchestrator
- type Progress
- type Worker
Constants ¶
const MaxRetries = 3
Variables ¶
This section is empty.
Functions ¶
func ContentHashHex ¶
ContentHashHex computes SHA-256 of content and returns hex string.
func IsRetryable ¶
IsRetryable checks if an error is worth retrying.
Types ¶
type Job ¶
type Job struct {
ID string `json:"job_id"`
DocID string `json:"doc_id"`
UserID string `json:"user_id"`
Status JobStatus `json:"status"`
Phase string `json:"phase"`
Filename string `json:"filename"`
Title string `json:"title"`
Progress Progress `json:"progress"`
ContentHash string `json:"content_hash,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// contains filtered or unexported fields
}
Job tracks the state of a single document ingestion.
func (*Job) IncrChunksProcessed ¶
func (j *Job) IncrChunksProcessed()
IncrChunksProcessed atomically increments chunks processed.
func (*Job) SetFileData ¶
SetFileData sets the raw file bytes for processing.
func (*Job) SetTotalChunks ¶
SetTotalChunks records total chunk count.
func (*Job) Snapshot ¶
func (j *Job) Snapshot() JobSnapshot
Snapshot returns a JSON-safe copy of the job state.
type JobSnapshot ¶
type JobSnapshot struct {
ID string `json:"job_id"`
DocID string `json:"doc_id"`
UserID string `json:"user_id"`
Status JobStatus `json:"status"`
Phase string `json:"phase"`
Filename string `json:"filename"`
Title string `json:"title"`
Progress Progress `json:"progress"`
}
JobSnapshot is a read-only, JSON-safe copy of job state.
type JobStatus ¶
type JobStatus string
JobStatus represents the state of an ingestion job.
const ( StatusQueued JobStatus = "queued" StatusParsing JobStatus = "parsing" StatusChunking JobStatus = "chunking" StatusExtracting JobStatus = "extracting" StatusStoring JobStatus = "storing" StatusCompleted JobStatus = "completed" StatusFailed JobStatus = "failed" StatusPartial JobStatus = "partial" StatusDupSkipped JobStatus = "duplicate_skipped" )
type JobStore ¶
type JobStore struct {
// contains filtered or unexported fields
}
JobStore is a thread-safe in-memory job registry with TTL eviction.
func NewJobStore ¶
type Orchestrator ¶
type Orchestrator struct {
// contains filtered or unexported fields
}
Orchestrator manages the document ingestion pipeline.
func NewOrchestrator ¶
func NewOrchestrator(cfg config.Config, claude *extract.ClaudeClient, ps *pathstore.Client, log *slog.Logger) *Orchestrator
NewOrchestrator creates and starts the pipeline.
func (*Orchestrator) GetJob ¶
func (o *Orchestrator) GetJob(id string) *Job
GetJob returns a job by ID.
func (*Orchestrator) PathstoreClient ¶
func (o *Orchestrator) PathstoreClient() *pathstore.Client
PathstoreClient returns the pathstore client for direct use by API handlers.
func (*Orchestrator) QueueDepth ¶
func (o *Orchestrator) QueueDepth() int
QueueDepth returns current queue depth.
func (*Orchestrator) Start ¶
func (o *Orchestrator) Start(ctx context.Context)
Start launches worker goroutines.
func (*Orchestrator) Submit ¶
func (o *Orchestrator) Submit(job *Job) error
Submit queues a new job for processing.
type Progress ¶
type Progress struct {
TotalChunks int `json:"total_chunks"`
ChunksProcessed int `json:"chunks_processed"`
FactsValid int `json:"facts_valid"`
FactsStored int `json:"facts_stored"`
Errors []string `json:"errors"`
}
Progress tracks processing progress.