Documentation
¶
Index ¶
- type ActivityStats
- type BacklogStats
- type CountBucket
- type DeleteItemsResult
- type DeleteSourcesResult
- type MigrationEvent
- type MigrationPhase
- type MigrationReporter
- type OpenOptions
- type PipelineStageRow
- type PipelineStats
- type RebuildFTSStats
- type ResetSourceEnrichmentOptions
- type ResetSourceEnrichmentStats
- type SourceActivityEvent
- type SourceActivityFeed
- type SourceActivityFilter
- type SourceActivityTrendPoint
- type SourceCountFilter
- type SourceFailureHotspot
- type Store
- func (s *Store) Activity(ctx context.Context, now time.Time, window time.Duration) (ActivityStats, error)
- func (s *Store) Backlog(ctx context.Context, promptVersion string, toolName string, toolVersion string) (BacklogStats, error)
- func (s *Store) Close() error
- func (s *Store) CountExactUserTag(ctx context.Context, tag string, sourceTypes []string) (int, error)
- func (s *Store) CountItemTextMatches(ctx context.Context, query string, sourceTypes []string) (int, error)
- func (s *Store) CountItems(ctx context.Context, sourceType string, groupBy string) ([]CountBucket, error)
- func (s *Store) CountSourceTextMatches(ctx context.Context, query string, sourceTypes []string) (int, error)
- func (s *Store) CountSources(ctx context.Context, filter SourceCountFilter, groupBy string) ([]CountBucket, error)
- func (s *Store) DeleteItemsBySourceType(ctx context.Context, sourceType string) (DeleteItemsResult, error)
- func (s *Store) DeleteOrphanSources(ctx context.Context, sourceType string) (DeleteSourcesResult, error)
- func (s *Store) GetItem(ctx context.Context, lookup string) (model.Item, error)
- func (s *Store) GetItemByID(ctx context.Context, id int64) (model.Item, error)
- func (s *Store) GetItemEnrichment(ctx context.Context, itemID int64, role string) (model.ItemEnrichment, error)
- func (s *Store) GetMediaAsset(ctx context.Context, assetID int64) (model.MediaAsset, error)
- func (s *Store) GetPreferredLocalSourceExtract(ctx context.Context, sourceID int64) (model.ExtractResult, bool, error)
- func (s *Store) GetSource(ctx context.Context, lookup string) (model.SourceDocument, error)
- func (s *Store) GetSourceByID(ctx context.Context, sourceID int64) (model.SourceDocument, error)
- func (s *Store) GetSourceEvidence(ctx context.Context, lookup string) (model.SourceDocument, error)
- func (s *Store) GetSourceExtractedText(ctx context.Context, lookup string) (string, error)
- func (s *Store) GetSourcesByIDs(ctx context.Context, sourceIDs []int64) ([]model.SourceDocument, error)
- func (s *Store) HasFTS() bool
- func (s *Store) InvalidateItemOCR(ctx context.Context, itemID int64) error
- func (s *Store) InvalidateItemSummary(ctx context.Context, itemID int64) error
- func (s *Store) ListAllEntityItems(ctx context.Context, limit int) ([]model.Item, error)
- func (s *Store) ListAllEntitySources(ctx context.Context, limit int) ([]model.SourceDocument, error)
- func (s *Store) ListAllItems(ctx context.Context, limit int) ([]model.Item, error)
- func (s *Store) ListAllSources(ctx context.Context, limit int) ([]model.SourceDocument, error)
- func (s *Store) ListBacklinksForSource(ctx context.Context, sourceID int64) ([]model.SourceBacklink, error)
- func (s *Store) ListCategorizedItems(ctx context.Context) ([]model.Item, error)
- func (s *Store) ListCategorizedSources(ctx context.Context) ([]model.SourceDocument, error)
- func (s *Store) ListCategorizedSourcesWithoutEvidence(ctx context.Context) ([]model.SourceDocument, error)
- func (s *Store) ListItemChildLinks(ctx context.Context, parentItemID int64, linkKind string) ([]int64, error)
- func (s *Store) ListItemMediaRefs(ctx context.Context, itemID int64) ([]model.ItemMediaRef, error)
- func (s *Store) ListItemSourceKeysByMediaLocalPath(ctx context.Context, localPath string) ([]string, error)
- func (s *Store) ListItemsForCategorize(ctx context.Context, limit int, force bool) ([]model.Item, error)
- func (s *Store) ListItemsForLinkDiscovery(ctx context.Context, limit int, force bool) ([]model.Item, error)
- func (s *Store) ListItemsForXHydration(ctx context.Context, limit int, force bool) ([]model.Item, error)
- func (s *Store) ListItemsForXMediaSummary(ctx context.Context, limit int, force bool) ([]model.Item, error)
- func (s *Store) ListItemsForXMediaTranscription(ctx context.Context, limit int, force bool) ([]model.Item, error)
- func (s *Store) ListItemsForXPhotoOCR(ctx context.Context, limit int, force bool) ([]model.Item, error)
- func (s *Store) ListItemsForXPhotoOCRAudit(ctx context.Context, limit int, includePruned bool) ([]model.Item, error)
- func (s *Store) ListItemsForXQuoteHydration(ctx context.Context, limit int, force bool) ([]model.Item, error)
- func (s *Store) ListMediaAssetsByLocalPath(ctx context.Context, localPath string) ([]model.MediaAsset, error)
- func (s *Store) ListMediaAssetsForArchive(ctx context.Context, limit int, force bool) ([]model.MediaAsset, error)
- func (s *Store) ListMediaAssetsForDownload(ctx context.Context, limit int, force bool) ([]model.MediaAsset, error)
- func (s *Store) ListMediaAssetsForPrune(ctx context.Context, limit int) ([]model.MediaAsset, error)
- func (s *Store) ListSourcesForCategorize(ctx context.Context, limit int, force bool) ([]model.SourceDocument, error)
- func (s *Store) ListSourcesForEnrichment(ctx context.Context, limit int, force bool, summarize bool, ...) ([]model.SourceDocument, error)
- func (s *Store) ListSourcesForItem(ctx context.Context, itemID int64) ([]model.ItemSourceRef, error)
- func (s *Store) MarkItemLinkDiscovery(ctx context.Context, itemID int64, at time.Time) error
- func (s *Store) MarkMediaLocalPrunedByPath(ctx context.Context, localPath string, prunedAt time.Time) (int64, error)
- func (s *Store) Pipeline(ctx context.Context, promptVersion string, toolName string, toolVersion string) (PipelineStats, error)
- func (s *Store) PurgeItemIndexedContent(ctx context.Context, sourceKey string, rawJSON string) (bool, error)
- func (s *Store) RebuildFTS(ctx context.Context) (RebuildFTSStats, error)
- func (s *Store) ReplaceItemChildLinks(ctx context.Context, parentItemID int64, linkKind string, childItemIDs []int64) (bool, error)
- func (s *Store) ResetSourceEnrichment(ctx context.Context, opts ResetSourceEnrichmentOptions) (ResetSourceEnrichmentStats, error)
- func (s *Store) SaveItemOCR(ctx context.Context, itemID int64, result model.OCRResult, inputHash string) (bool, error)
- func (s *Store) SaveItemSummary(ctx context.Context, itemID int64, summary model.SummaryResult, ...) (bool, error)
- func (s *Store) SaveItemUserTags(ctx context.Context, itemID int64, tags string) error
- func (s *Store) SaveMediaArchive(ctx context.Context, assetID int64, result model.MediaArchiveResult) (bool, error)
- func (s *Store) SaveMediaDownload(ctx context.Context, assetID int64, result model.MediaDownloadResult) (bool, error)
- func (s *Store) SaveSourceExtraction(ctx context.Context, sourceID int64, result model.ExtractResult, ...) (bool, error)
- func (s *Store) SaveSourceSummary(ctx context.Context, sourceID int64, result model.SummaryResult) (bool, error)
- func (s *Store) SaveSourceUserTags(ctx context.Context, sourceID int64, tags string) error
- func (s *Store) SaveXHydration(ctx context.Context, itemID int64, hydration model.XHydration) (bool, error)
- func (s *Store) SaveXMediaTranscriptionState(ctx context.Context, itemID int64, status string, errorText string, ...) error
- func (s *Store) Search(ctx context.Context, query string, limit int) ([]model.SearchResult, error)
- func (s *Store) SearchExactUserTag(ctx context.Context, tag string, limit int) ([]model.SearchResult, error)
- func (s *Store) SearchSources(ctx context.Context, query string, limit int) ([]model.SearchResult, error)
- func (s *Store) SearchUserTags(ctx context.Context, tagQuery string, limit int) ([]model.SearchResult, error)
- func (s *Store) SourceActivityFeed(ctx context.Context, limit int) (SourceActivityFeed, error)
- func (s *Store) SourceActivityFeedFiltered(ctx context.Context, filter SourceActivityFilter) (SourceActivityFeed, error)
- func (s *Store) UpsertItem(ctx context.Context, item model.Item) (model.UpsertResult, error)
- func (s *Store) UpsertSource(ctx context.Context, candidate model.SourceCandidate) (model.SourceUpsertResult, error)
- func (s *Store) UpsertSourceLink(ctx context.Context, itemID int64, candidate model.SourceCandidate) (model.SourceLinkUpsertResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivityStats ¶
type ActivityStats struct {
Now time.Time `json:"now"`
Window string `json:"window"`
LatestItemUpdatedAt time.Time `json:"latest_item_updated_at"`
LatestSourceUpdatedAt time.Time `json:"latest_source_updated_at"`
LatestSourceSummaryAt time.Time `json:"latest_source_summary_at"`
ItemsUpdatedInWindow int `json:"items_updated_in_window"`
SourcesUpdatedInWindow int `json:"sources_updated_in_window"`
SourcesSummarizedInWindow int `json:"sources_summarized_in_window"`
}
type BacklogStats ¶
type BacklogStats struct {
XHydrationPending int `json:"x_hydration_pending"`
LinkDiscoveryPending int `json:"link_discovery_pending"`
SourceExtractionPending int `json:"source_extraction_pending"`
SourceSummaryPending int `json:"source_summary_pending"`
SourceExtractionPendingByType []CountBucket `json:"source_extraction_pending_by_type"`
SourceSummaryPendingByType []CountBucket `json:"source_summary_pending_by_type"`
Drained bool `json:"drained"`
}
type CountBucket ¶
type DeleteItemsResult ¶
type DeleteSourcesResult ¶
type MigrationEvent ¶
type MigrationEvent struct {
Phase MigrationPhase
Version int
LatestVersion int
Name string
Err error
}
MigrationEvent describes one schema migration lifecycle event.
type MigrationPhase ¶
type MigrationPhase string
MigrationPhase identifies the lifecycle state for a migration event.
const ( // MigrationStarted is emitted before a missing migration starts running. MigrationStarted MigrationPhase = "started" // MigrationApplied is emitted after a missing migration has been applied and recorded. MigrationApplied MigrationPhase = "applied" // MigrationFailed is emitted when a missing migration or its metadata write fails. MigrationFailed MigrationPhase = "failed" )
type MigrationReporter ¶
type MigrationReporter func(MigrationEvent)
MigrationReporter receives migration lifecycle events during writable startup.
type OpenOptions ¶
type OpenOptions struct {
MigrationReporter MigrationReporter
}
OpenOptions configures writable store startup behavior.
type PipelineStageRow ¶
type PipelineStats ¶
type PipelineStats struct {
SummaryPromptVersion string `json:"summary_prompt_version"`
SummaryTool string `json:"summary_tool"`
SummaryToolVersion string `json:"summary_tool_version"`
Hydration []PipelineStageRow `json:"hydration"`
Extraction []PipelineStageRow `json:"extraction"`
Summary []PipelineStageRow `json:"summary"`
Transcription []PipelineStageRow `json:"transcription"`
OCR []PipelineStageRow `json:"ocr"`
}
type RebuildFTSStats ¶
type SourceActivityEvent ¶
type SourceActivityEvent struct {
SourceID int64 `json:"source_id"`
SourceKey string `json:"source_key"`
SourceType string `json:"source_type"`
Domain string `json:"domain"`
FailureKind string `json:"failure_kind,omitempty"`
CanonicalURL string `json:"canonical_url"`
Title string `json:"title"`
NotePath string `json:"note_path"`
EventKind string `json:"event_kind"`
Status string `json:"status"`
Message string `json:"message,omitempty"`
EventAt time.Time `json:"event_at"`
}
type SourceActivityFeed ¶
type SourceActivityFeed struct {
Window string `json:"window"`
RecentSuccesses []SourceActivityEvent `json:"recent_successes"`
RecentFailures []SourceActivityEvent `json:"recent_failures"`
FailureHotspots []SourceFailureHotspot `json:"failure_hotspots"`
FailureKinds []CountBucket `json:"failure_kinds"`
FailureStatuses []CountBucket `json:"failure_statuses"`
FailureDomains []CountBucket `json:"failure_domains"`
FailureTable []SourceActivityEvent `json:"failure_table"`
FailureTableTotal int `json:"failure_table_total"`
FailureTableOffset int `json:"failure_table_offset"`
FailureTableLimit int `json:"failure_table_limit"`
FailureTableSort string `json:"failure_table_sort"`
TrendBucket string `json:"trend_bucket"`
Trend []SourceActivityTrendPoint `json:"trend"`
}
type SourceActivityFilter ¶
type SourceCountFilter ¶
type SourceFailureHotspot ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func OpenReadOnly ¶
OpenReadOnly opens an existing store for read-only consumers such as MCP. It intentionally skips schema creation/migrations so startup cannot block behind a long-running writer before the MCP initialize response is sent.
func OpenWithOptions ¶
func OpenWithOptions(path string, opts OpenOptions) (*Store, error)
func (*Store) CountExactUserTag ¶
func (*Store) CountItemTextMatches ¶
func (*Store) CountItems ¶
func (*Store) CountSourceTextMatches ¶
func (*Store) CountSources ¶
func (s *Store) CountSources(ctx context.Context, filter SourceCountFilter, groupBy string) ([]CountBucket, error)
func (*Store) DeleteItemsBySourceType ¶
func (*Store) DeleteOrphanSources ¶
func (*Store) GetItemByID ¶
func (*Store) GetItemEnrichment ¶
func (*Store) GetMediaAsset ¶
func (*Store) GetPreferredLocalSourceExtract ¶
func (*Store) GetSourceByID ¶
func (*Store) GetSourceEvidence ¶
func (*Store) GetSourceExtractedText ¶
func (*Store) GetSourcesByIDs ¶
func (*Store) InvalidateItemOCR ¶
func (*Store) InvalidateItemSummary ¶
func (*Store) ListAllEntityItems ¶
func (*Store) ListAllEntitySources ¶
func (*Store) ListAllItems ¶
func (*Store) ListAllSources ¶
func (*Store) ListBacklinksForSource ¶
func (*Store) ListCategorizedItems ¶
ListCategorizedItems returns all items that have a non-empty user_tags field.
func (*Store) ListCategorizedSources ¶
ListCategorizedSources returns all sources that have a non-empty user_tags field.
func (*Store) ListCategorizedSourcesWithoutEvidence ¶
func (s *Store) ListCategorizedSourcesWithoutEvidence(ctx context.Context) ([]model.SourceDocument, error)
ListCategorizedSourcesWithoutEvidence returns tagged sources that lack extracted or summarized evidence.
func (*Store) ListItemChildLinks ¶
func (*Store) ListItemMediaRefs ¶
func (*Store) ListItemSourceKeysByMediaLocalPath ¶
func (*Store) ListItemsForCategorize ¶
func (s *Store) ListItemsForCategorize(ctx context.Context, limit int, force bool) ([]model.Item, error)
ListItemsForCategorize returns items ordered newest-first. When force is false only items with an empty user_tags field are returned.
func (*Store) ListItemsForLinkDiscovery ¶
func (*Store) ListItemsForXHydration ¶
func (*Store) ListItemsForXMediaSummary ¶
func (*Store) ListItemsForXMediaTranscription ¶
func (*Store) ListItemsForXPhotoOCR ¶
func (*Store) ListItemsForXPhotoOCRAudit ¶
func (*Store) ListItemsForXQuoteHydration ¶
func (*Store) ListMediaAssetsByLocalPath ¶
func (*Store) ListMediaAssetsForArchive ¶
func (*Store) ListMediaAssetsForDownload ¶
func (*Store) ListMediaAssetsForPrune ¶
func (*Store) ListSourcesForCategorize ¶
func (s *Store) ListSourcesForCategorize(ctx context.Context, limit int, force bool) ([]model.SourceDocument, error)
ListSourcesForCategorize returns sources with extracted or summarized evidence ordered newest-first. When force is false only evidence-bearing sources with an empty user_tags field are returned.
func (*Store) ListSourcesForEnrichment ¶
func (*Store) ListSourcesForItem ¶
func (*Store) MarkItemLinkDiscovery ¶
func (*Store) MarkMediaLocalPrunedByPath ¶
func (*Store) PurgeItemIndexedContent ¶
func (*Store) RebuildFTS ¶
func (s *Store) RebuildFTS(ctx context.Context) (RebuildFTSStats, error)
func (*Store) ReplaceItemChildLinks ¶
func (*Store) ResetSourceEnrichment ¶
func (s *Store) ResetSourceEnrichment(ctx context.Context, opts ResetSourceEnrichmentOptions) (ResetSourceEnrichmentStats, error)
func (*Store) SaveItemOCR ¶
func (*Store) SaveItemSummary ¶
func (*Store) SaveItemUserTags ¶
func (*Store) SaveMediaArchive ¶
func (*Store) SaveMediaDownload ¶
func (*Store) SaveSourceExtraction ¶
func (*Store) SaveSourceSummary ¶
func (*Store) SaveSourceUserTags ¶
func (*Store) SaveXHydration ¶
func (*Store) SaveXMediaTranscriptionState ¶
func (*Store) SearchExactUserTag ¶
func (*Store) SearchSources ¶
func (*Store) SearchUserTags ¶
func (*Store) SourceActivityFeed ¶
func (*Store) SourceActivityFeedFiltered ¶
func (s *Store) SourceActivityFeedFiltered(ctx context.Context, filter SourceActivityFilter) (SourceActivityFeed, error)
func (*Store) UpsertItem ¶
func (*Store) UpsertSource ¶
func (s *Store) UpsertSource(ctx context.Context, candidate model.SourceCandidate) (model.SourceUpsertResult, error)
func (*Store) UpsertSourceLink ¶
func (s *Store) UpsertSourceLink(ctx context.Context, itemID int64, candidate model.SourceCandidate) (model.SourceLinkUpsertResult, error)
Source Files
¶
- categorize.go
- cleanup.go
- item_enrich_queries.go
- item_enrichment.go
- item_enrichment_backfill.go
- item_enrichment_fields.go
- item_enrichment_schema.go
- item_enrichment_sql.go
- item_fts.go
- item_link_metadata.go
- item_links.go
- item_ocr.go
- item_purge.go
- item_read.go
- item_scan.go
- item_summary.go
- item_write.go
- media.go
- media_archive_candidates.go
- media_archive_lookup.go
- media_archive_write.go
- media_download.go
- media_refs.go
- media_schema.go
- media_x_hydration.go
- media_x_hydration_decode.go
- media_x_hydration_raw.go
- migrations.go
- open.go
- predicates.go
- retry.go
- schema.go
- schema_init.go
- search.go
- search_counts.go
- search_helpers.go
- search_tags.go
- source_activity.go
- source_activity_queries.go
- source_activity_scan.go
- source_activity_sql.go
- source_activity_trend.go
- source_enrichment_candidates.go
- source_evidence.go
- source_extraction.go
- source_failure.go
- source_links.go
- source_local_extract.go
- source_lookup.go
- source_predicates.go
- source_read.go
- source_relations.go
- source_repair.go
- source_repair_filters.go
- source_repair_x_article.go
- source_scan.go
- source_schema.go
- source_search.go
- source_summary.go
- source_tags.go
- source_x_article.go
- source_x_article_canonical.go
- stats_activity.go
- stats_backlog.go
- stats_counts.go
- stats_helpers.go
- stats_pipeline.go
- stats_pipeline_helpers.go
- stats_pipeline_items.go
- stats_pipeline_kinds.go
- stats_pipeline_x_items.go
- stats_types.go
- time_helpers.go
- x_hydration_candidates.go
- x_hydration_invalidate.go
- x_hydration_links.go
- x_hydration_save.go
- x_media_transcription.go