Documentation
¶
Index ¶
Constants ¶
const ( ErrorBackendBroken = "semantic_backend_broken" ErrorRunConflict = "semantic_run_conflict" ErrorProjection = "semantic_projection_failed" ErrorEmbedding = "semantic_embedding_failed" ErrorEmbeddingCircuit = "semantic_embedding_circuit_open" ErrorFlush = "semantic_flush_failed" ErrorCompaction = "semantic_compaction_failed" ErrorVerify = "semantic_verify_failed" ErrorNativeRoot = "semantic_native_root_failed" ErrorReadiness = "semantic_readiness_not_ready" ErrorCancelled = "semantic_refresh_cancelled" )
const ( DefaultProjectionBatch = 100 DefaultEmbeddingBatch = 16 )
const ProgressInterval = 5 * time.Second
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Debt ¶
type Debt struct {
DirtyParents int `json:"dirty_parents"`
PendingEmbeddings int `json:"pending_embeddings"`
DueRetries int `json:"due_retries"`
ScheduledRetries int `json:"scheduled_retries"`
BlockedEmbeddings int `json:"blocked_embeddings"`
FailedEmbeddings int `json:"failed_embeddings"`
Indexed int `json:"indexed"`
L0Ready int `json:"l0_ready"`
Tombstones int `json:"tombstones"`
Segments int `json:"segments"`
}
type NativeLifecycle ¶
type NativeLifecycle interface {
semanticbuild.SegmentPayloadBuilder
semanticbuild.StreamingSegmentPayloadBuilder
VerifyRoot(context.Context, RootExpectation) error
}
type PipelineOptions ¶
type PipelineStore ¶
type PipelineStore interface {
semanticbuild.ChunkStore
semanticbuild.EmbedStore
semanticbuild.FlushStore
semanticbuild.CompactionStore
semanticbuild.VerifyStore
ProjectionWorkRevision(context.Context) (int64, error)
RetrievalPurgeEpoch(context.Context) (int64, error)
RetrievalDatabaseID(context.Context) (string, error)
RetrievalEmbeddingProfile(context.Context, string) (store.RetrievalEmbeddingProfileRow, error)
RetrievalDanglingGenerationRecovery(context.Context, string) (*store.RetrievalDanglingGenerationRecovery, error)
ReactivateRetrievalDanglingGeneration(context.Context, store.RetrievalDanglingGenerationRecovery) error
SemanticReadinessSnapshotAt(context.Context, embedding.Profile, int, time.Time) (semanticreadiness.Snapshot, error)
}
type Progress ¶
type Progress struct {
RunID, ProfileID, Checkpoint, Readiness string
Stage store.SemanticRefreshStage
Counters store.SemanticRefreshCounters
Debt Debt
At time.Time
}
type ProgressCallback ¶
type ProgressEmitter ¶
type ProgressEmitter struct {
// contains filtered or unexported fields
}
ProgressEmitter serializes visible callbacks and coalesces durable heartbeat writes for one running refresh run. Callers must pass only rows returned by a completed ledger update to Publish.
func StartProgressEmitter ¶
func StartProgressEmitter( ctx context.Context, ledger ProgressLedger, run store.SemanticRefreshRun, debt Debt, callback ProgressCallback, ) (*ProgressEmitter, error)
StartProgressEmitter durably emits the initial running snapshot before it starts the five-second heartbeat loop.
func (*ProgressEmitter) Context ¶
func (e *ProgressEmitter) Context() context.Context
Context returns the derived work context cancelled by a progress ledger or callback failure.
func (*ProgressEmitter) Publish ¶
func (e *ProgressEmitter) Publish(run store.SemanticRefreshRun, debt Debt) error
Publish queues a checkpoint row only after the caller has durably persisted it. Heartbeats after this call reuse that exact snapshot. A Publish invoked while a callback is active is accepted asynchronously so callback-to-Publish reentrancy can unwind before the queued callback is dispatched.
func (*ProgressEmitter) Stop ¶
func (e *ProgressEmitter) Stop() error
Stop prevents new ticks and checkpoint events and cancels derived work. Outside an active callback it joins the dispatcher before returning. A Stop observed while a callback is active requests stop and returns without joining so callback-to-Stop reentrancy cannot self-join; a later Stop is idempotent and joins after that callback unwinds.
type ProgressLedger ¶
type RefreshError ¶
type RefreshError struct {
Code string `json:"code"`
Stage store.SemanticRefreshStage `json:"stage,omitempty"`
RunID string `json:"run_id,omitempty"`
Checkpoint string `json:"checkpoint,omitempty"`
Readiness string `json:"readiness,omitempty"`
Debt Debt `json:"remaining_debt"`
Message string `json:"message"`
// contains filtered or unexported fields
}
func NewError ¶
func NewError( code string, run store.SemanticRefreshRun, readiness string, debt Debt, cause error, ) *RefreshError
func (*RefreshError) Error ¶
func (e *RefreshError) Error() string
func (*RefreshError) MarshalJSON ¶
func (e *RefreshError) MarshalJSON() ([]byte, error)
func (*RefreshError) Unwrap ¶
func (e *RefreshError) Unwrap() error
type Request ¶
type Request struct {
ProfileID string
PurgeEpoch, ProjectionWatermark int64
Capability semanticindex.Capability
Progress ProgressCallback
Now func() time.Time
NewRunIDFunc func() (string, error)
}
type Result ¶
type Result struct {
Outcome Outcome `json:"outcome"`
SkipReason string `json:"skip_reason,omitempty"`
Capability semanticindex.Capability `json:"capability"`
Run *store.SemanticRefreshRun `json:"run,omitempty"`
Debt Debt `json:"remaining_debt"`
}
type RootExpectation ¶
type RunLedger ¶
type RunLedger interface {
StartOrResumeSemanticRefreshRun(
context.Context,
store.StartSemanticRefreshRunInput,
) (store.SemanticRefreshRun, bool, error)
UpdateSemanticRefreshRun(
context.Context,
store.SemanticRefreshRunUpdate,
) (store.SemanticRefreshRun, error)
TouchSemanticRefreshRunProgress(context.Context, string, time.Time) error
}
type StageExecutor ¶
type StageExecutor interface {
Execute(context.Context, store.SemanticRefreshRun) (StageOutcome, error)
}
func NewLockedPipeline ¶
func NewLockedPipeline(executor StageExecutor, scope *semanticlock.Scope) (StageExecutor, error)
NewLockedPipeline wraps one semantic stage executor so each Execute call owns one exclusive maintenance lease. Publication stages also own generation exclusively, in the required maintenance-before-generation order.
func NewPipeline ¶
func NewPipeline(st PipelineStore, options PipelineOptions) (StageExecutor, error)