Documentation
¶
Overview ¶
Package store implements the SQLite-backed virtual tree.
Index ¶
- Constants
- Variables
- func DefaultSQLiteDriver() docsqlite.Driver
- func NormalizeName(name string) (string, error)
- func NormalizeSearchMIMEType(value string) (string, error)
- func NormalizeSearchTimeBounds(modifiedSince, modifiedBefore string) (string, string, error)
- func NormalizeTagName(name string) (string, error)
- func ValidateAuditEvidence(evidence AuditEvidence) error
- func ValidateAuditHistoryCursor(raw string, nodeID int64) error
- func ValidateAuditPathState(path, state string) error
- func ValidateAuditScopeHistoryCursor(raw, scopeID string) error
- func ValidatePlacementPlan(plan PlacementPlan) error
- func ValidateSecondaryBlobStoreName(name string) error
- func ValidateStorageRecoveryPlan(plan StorageRecoveryPlan) error
- func ValidateVersionPruneSelector(selector VersionPruneSelector) error
- type AuditAttachmentChange
- type AuditAttachmentIdentity
- type AuditAttachmentState
- type AuditEnrollmentPlan
- type AuditEnrollmentPreview
- type AuditEvent
- type AuditEventPage
- type AuditEvidence
- type AuditEvidenceCheck
- type AuditEvidenceProblem
- type AuditMembershipStatus
- type AuditPathState
- type AuditScopeEventPage
- type AuditScopeEvidence
- type AuditScopeStatus
- type AuditStatus
- type AuditVerification
- type BatchMoveRequest
- type BatchMoveResult
- type BlobInfo
- type BlobLocation
- type BlobPhysical
- type BlobStore
- type BlobStoreEvacuationFinalization
- type BlobStoreStats
- type ContentReference
- type ContentVersion
- type ContentVersionView
- type ContentWriteReceipt
- type DirectoryPageView
- type ExtractionCandidate
- type ExtractionResult
- type GCCandidate
- type GCCandidateScanPage
- type IngestRun
- type LooseBacklog
- type MetadataSnapshot
- func (s *MetadataSnapshot) Close() error
- func (s *MetadataSnapshot) Export(ctx context.Context, w io.Writer) error
- func (s *MetadataSnapshot) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (s *MetadataSnapshot) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
- type Node
- type NodeProvenancePage
- type NodeView
- type PackCatalog
- func (c *PackCatalog) AdoptPack(ctx context.Context, record packstore.PackRecord, ...) error
- func (c *PackCatalog) ClearPackMetadata(ctx context.Context) error
- func (c *PackCatalog) CommitRepack(ctx context.Context, sourceIDs []string, records []packstore.PackRecord, ...) error
- func (c *PackCatalog) DeleteEmptyPackRecord(ctx context.Context, packID string) (bool, error)
- func (c *PackCatalog) DeleteIndexEntry(ctx context.Context, hash packstore.Hash) error
- func (c *PackCatalog) DeletePackRecord(ctx context.Context, packID string) error
- func (c *PackCatalog) HasPackRecord(ctx context.Context, packID string) (bool, error)
- func (c *PackCatalog) ListIndexed(ctx context.Context) ([]packstore.IndexEntry, error)
- func (c *PackCatalog) ListLivePackEntries(ctx context.Context, packID string) ([]packstore.IndexEntry, error)
- func (c *PackCatalog) ListPackEntries(ctx context.Context, packID string) ([]packstore.IndexEntry, error)
- func (c *PackCatalog) ListPackRecords(ctx context.Context) ([]packstore.PackRecord, error)
- func (c *PackCatalog) ListPackUsage(ctx context.Context) ([]packstore.PackUsage, error)
- func (c *PackCatalog) ListReferences(ctx context.Context) (packstore.ReferenceInventory, error)
- func (c *PackCatalog) ListUnpacked(ctx context.Context) ([]packstore.Candidate, error)
- func (c *PackCatalog) PrimaryOwnership() packstore.Ownership
- func (c *PackCatalog) PrimaryStoreID() packstore.StoreID
- func (c *PackCatalog) PruneUnreferenced(ctx context.Context) (int64, error)
- func (c *PackCatalog) RecordPack(ctx context.Context, record packstore.PackRecord, ...) error
- func (c *PackCatalog) Resolve(ctx context.Context, hash packstore.Hash) (packstore.Location, error)
- func (c *PackCatalog) ResolveLocations(ctx context.Context, hash packstore.Hash) (packstore.Resolution, error)
- type PackRestoreCatalog
- type PackedLocation
- type PhysicalContent
- type PlacementCommit
- type PlacementHash
- type PlacementPlan
- type PlacementRequest
- type ProvenanceFact
- type RepackCandidate
- type RepackScanPage
- type SearchHit
- type SearchOptions
- type StorageOperation
- type StorageOperationCleanup
- type StorageOperationCreate
- type StorageOperationState
- type StorageOperationStoreReference
- type StorageRecoveryPlan
- type Store
- func (s *Store) AddRestoredBlobLocation(ctx context.Context, hash string, destination packstore.ReadLocation) error
- func (s *Store) AdvanceStorageOperation(ctx context.Context, id, cursor string, ...) error
- func (s *Store) AllBlobHashes(ctx context.Context) ([]string, error)
- func (s *Store) AllBlobs(ctx context.Context) ([]BlobInfo, error)
- func (s *Store) AssignTag(ctx context.Context, tagID string, nodeID, ifRev int64) (TagAssignmentChange, error)
- func (s *Store) AssignTagPath(ctx context.Context, tagID, path string) (TagAssignmentChange, error)
- func (s *Store) AuditHistory(ctx context.Context, nodeID int64, limit int, cursor string) (AuditEventPage, error)
- func (s *Store) AuditHistoryPath(ctx context.Context, path string, limit int, cursor string) (AuditEventPage, error)
- func (s *Store) AuditScopeHistory(ctx context.Context, scopeID string, limit int, cursor string) (AuditScopeEventPage, error)
- func (s *Store) AuditStatus(ctx context.Context, nodeID *int64) (AuditStatus, error)
- func (s *Store) AuditStatusPath(ctx context.Context, path string) (AuditStatus, error)
- func (s *Store) BatchMove(ctx context.Context, requests []BatchMoveRequest) ([]BatchMoveResult, error)
- func (s *Store) BeginBlobStoreEvacuation(ctx context.Context, selector string) error
- func (s *Store) BeginEmbeddedIngest(ctx context.Context, sourceKind, sourceDesc string) (IngestRun, error)
- func (s *Store) BeginIngest(ctx context.Context, sourceKind, sourceDesc string) (IngestRun, error)
- func (s *Store) BeginMetadataSnapshot(ctx context.Context) (*MetadataSnapshot, error)
- func (s *Store) BeginStorageRecoveryPublication(ctx context.Context, operationID string, plan StorageRecoveryPlan) error
- func (s *Store) BeginWalk(ctx context.Context, rootPath string, pageSize int, includeTrashed bool) (_ *Walker, retErr error)
- func (s *Store) BlobHashesPage(ctx context.Context, after string, limit int) ([]string, bool, error)
- func (s *Store) BlobHashesPageFrom(ctx context.Context, after *string, limit int) ([]string, bool, error)
- func (s *Store) BlobInfo(ctx context.Context, hash string) (BlobInfo, error)
- func (s *Store) BlobStoreBySelector(ctx context.Context, selector string) (BlobStore, error)
- func (s *Store) BlobStoreInventory(ctx context.Context) (map[string]BlobStoreStats, error)
- func (s *Store) BlobStoreUnreadableObjects(ctx context.Context, online map[string]bool) (map[string]int64, error)
- func (s *Store) BlobStores(ctx context.Context) ([]BlobStore, error)
- func (s *Store) BlobsPage(ctx context.Context, after string, limit int) ([]BlobInfo, bool, error)
- func (s *Store) CheckContentReplacementTarget(ctx context.Context, nodeID, ifRev int64) error
- func (s *Store) Checkpoint(ctx context.Context) error
- func (s *Store) Children(ctx context.Context, dirID int64) ([]Node, error)
- func (s *Store) ChildrenPage(ctx context.Context, dirID int64, limit, offset int) ([]Node, int, error)
- func (s *Store) ClaimStorageOperation(ctx context.Context, id string) (StorageOperation, error)
- func (s *Store) Close() error
- func (s *Store) CommitPlacement(ctx context.Context, operationID string, request PlacementRequest, ...) (PlacementCommit, error)
- func (s *Store) CommitStorageRecovery(ctx context.Context, operationID string, plan StorageRecoveryPlan, ...) error
- func (s *Store) CompleteStorageOperationCleanup(ctx context.Context, operationID string, item StorageOperationCleanup) error
- func (s *Store) ConfirmContentWithReceipt(ctx context.Context, nodeID, ifRev int64, blobHash string, size int64, ...) (ContentWriteReceipt, error)
- func (s *Store) ConfirmIngestedContentWithReceipt(ctx context.Context, nodeID, ifRev int64, blobHash string, size int64, ...) (ContentWriteReceipt, error)
- func (s *Store) ContentReferencesByHash(ctx context.Context, hash string, limit, offset int) ([]ContentReference, int, error)
- func (s *Store) ContentVersionByID(ctx context.Context, id string) (ContentVersion, error)
- func (s *Store) ContentVersionViewByID(ctx context.Context, nodeID int64, versionID string) (ContentVersionView, error)
- func (s *Store) ContentVersions(ctx context.Context, nodeID int64, limit, offset int) ([]ContentVersion, int, error)
- func (s *Store) CreateFile(ctx context.Context, parentID int64, name, blobHash string, size int64, ...) (Node, error)
- func (s *Store) CreateFileWithReceipt(ctx context.Context, parentID int64, name, blobHash string, size int64, ...) (ContentWriteReceipt, error)
- func (s *Store) CreateStorageOperation(ctx context.Context, input StorageOperationCreate) (StorageOperation, error)
- func (s *Store) CreateTag(ctx context.Context, name string) (Tag, error)
- func (s *Store) DeadPackUsagePage(ctx context.Context, limit int) ([]packstore.PackUsage, bool, error)
- func (s *Store) DeferStorageOperation(ctx context.Context, id string, failure error) error
- func (s *Store) DeferTextExtraction(ctx context.Context, blobHash string, notBefore time.Time) error
- func (s *Store) DeleteBlobRows(ctx context.Context, hashes []string) error
- func (s *Store) DeleteTag(ctx context.Context, id string, ifRev int64) (Tag, error)
- func (s *Store) DeleteUnreferencedPackMappings(ctx context.Context, hashes []string) (int64, error)
- func (s *Store) DetachBlobStore(ctx context.Context, selector string) error
- func (s *Store) DirectoryChildrenPage(ctx context.Context, dirID int64, limit, offset int) (DirectoryPageView, error)
- func (s *Store) EnableInitialAudit(ctx context.Context, plan *AuditEnrollmentPlan) (AuditStatus, error)
- func (s *Store) EnsureBlobTx(tx *sql.Tx, hash string, size int64, physical ...BlobPhysical) error
- func (s *Store) EnsureDir(ctx context.Context, parentID int64, name string) (Node, error)
- func (s *Store) ExportMetadata(ctx context.Context, w io.Writer) error
- func (s *Store) FinalizeBlobStoreEvacuation(ctx context.Context, operationID, sourceID, destinationID string) (BlobStoreEvacuationFinalization, error)
- func (s *Store) FinishStorageOperation(ctx context.Context, id string, state StorageOperationState, ...) error
- func (s *Store) HasBlob(ctx context.Context, hash string) (bool, error)
- func (s *Store) HasPrimaryLooseAuthority(ctx context.Context, hash string) (bool, error)
- func (s *Store) ImportMetadata(ctx context.Context, r io.Reader) error
- func (s *Store) Info(ctx context.Context) (VaultInfo, error)
- func (s *Store) IngestFile(ctx context.Context, run IngestRun, parentID int64, name, blobHash string, ...) (Node, bool, error)
- func (s *Store) IngestFileExact(ctx context.Context, run IngestRun, parentID int64, name, blobHash string, ...) (Node, error)
- func (s *Store) IngestFileExactWithReceipt(ctx context.Context, run IngestRun, parentID int64, name, blobHash string, ...) (ContentWriteReceipt, error)
- func (s *Store) LiveTaggedNodes(ctx context.Context, tagID string, limit, offset int) ([]TaggedNode, int, int, error)
- func (s *Store) LooseBacklog(ctx context.Context) (LooseBacklog, error)
- func (s *Store) Mkdir(ctx context.Context, parentID int64, name string) (Node, error)
- func (s *Store) MkdirAll(ctx context.Context, path string) (Node, error)
- func (s *Store) MkdirPath(ctx context.Context, path string) (Node, string, error)
- func (s *Store) MkdirWithPath(ctx context.Context, parentID int64, name string) (Node, string, error)
- func (s *Store) Move(ctx context.Context, id, newParentID int64, newName string, ifRev int64) (Node, string, error)
- func (s *Store) MovePath(ctx context.Context, srcPath, destPath string) (Node, string, error)
- func (s *Store) MovePathRevision(ctx context.Context, srcPath, destPath string, ifRev int64) (Node, string, error)
- func (s *Store) MoveToPath(ctx context.Context, id, ifRev int64, destPath string) (Node, string, error)
- func (s *Store) NodeByID(ctx context.Context, id int64) (Node, error)
- func (s *Store) NodeByPath(ctx context.Context, path string) (Node, error)
- func (s *Store) NodeProvenance(ctx context.Context, nodeID int64, limit, offset int) (NodeProvenancePage, error)
- func (s *Store) NodeTags(ctx context.Context, nodeID int64, limit, offset int) ([]Tag, int, error)
- func (s *Store) NodeViewByID(ctx context.Context, id int64) (NodeView, error)
- func (s *Store) NodeViewByPath(ctx context.Context, path string) (NodeView, error)
- func (s *Store) PackedBlobStoredByte(ctx context.Context, hash string) (int64, bool, error)
- func (s *Store) PackedBlobStoredBytes(ctx context.Context) (map[string]int64, error)
- func (s *Store) Path(ctx context.Context, id int64) (string, error)
- func (s *Store) PendingTextExtractions(ctx context.Context, limit int) ([]ExtractionCandidate, error)
- func (s *Store) PhysicalContent(ctx context.Context, hash string) (PhysicalContent, error)
- func (s *Store) PlanPlacement(ctx context.Context, request PlacementRequest) (PlacementPlan, error)
- func (s *Store) PlanStorageRecovery(ctx context.Context, kind, hash, storeSelector string) (StorageRecoveryPlan, error)
- func (s *Store) PrepareSecondaryBlobStore(name, kind, binding string) (BlobStore, error)
- func (s *Store) PrepareStorageOperationCleanup(ctx context.Context, operationID string, item StorageOperationCleanup) (bool, error)
- func (s *Store) PreviewInitialAudit(ctx context.Context, targetNodeID int64, origin string, agentLabel *string) (*AuditEnrollmentPlan, error)
- func (s *Store) PreviewInitialAuditPath(ctx context.Context, path, origin string, agentLabel *string) (*AuditEnrollmentPlan, error)
- func (s *Store) PrimaryBlobStore(ctx context.Context) (BlobStore, error)
- func (s *Store) PrimaryBlobStoreID() string
- func (s *Store) PruneContentVersions(ctx context.Context, nodeID, ifRev int64, selector VersionPruneSelector, ...) (VersionPruneResult, error)
- func (s *Store) PruneExpiredStorageOperations(ctx context.Context, now time.Time) (int64, error)
- func (s *Store) RecordExtraction(ctx context.Context, result ExtractionResult) error
- func (s *Store) RegisterBlobStore(ctx context.Context, candidate BlobStore) error
- func (s *Store) RenameTag(ctx context.Context, id string, ifRev int64, name string) (Tag, error)
- func (s *Store) RepairBlobAuthority(ctx context.Context, hash string, size int64, physical BlobPhysical) (int64, error)
- func (s *Store) ReplaceContent(ctx context.Context, nodeID, ifRev int64, blobHash string, size int64, ...) (Node, ContentVersion, error)
- func (s *Store) ReplaceContentWithReceipt(ctx context.Context, nodeID, ifRev int64, blobHash string, size int64, ...) (ContentWriteReceipt, error)
- func (s *Store) RequestStorageOperationCancel(ctx context.Context, id string) error
- func (s *Store) ResolveBlobLocations(ctx context.Context, hash packstore.Hash) (packstore.Resolution, error)
- func (s *Store) Restore(ctx context.Context, id, ifRev int64) (Node, string, error)
- func (s *Store) ResumableStorageOperations(ctx context.Context) ([]StorageOperation, error)
- func (s *Store) RetireRestoredPrimary(ctx context.Context, hash string, allowAuditedRemoteOnly bool) (retired bool, err error)
- func (s *Store) RevertContent(ctx context.Context, nodeID, ifRev int64, sourceVersionID string) (Node, ContentVersion, ContentVersion, error)
- func (s *Store) RootID() int64
- func (s *Store) SQLiteDriver() docsqlite.Driver
- func (s *Store) SearchPage(ctx context.Context, query string, limit int) ([]SearchHit, bool, error)
- func (s *Store) SearchPageWithOptions(ctx context.Context, query string, limit int, opts SearchOptions) ([]SearchHit, bool, error)
- func (s *Store) SeedTextExtractionQueue(ctx context.Context, extractor string, version int64) error
- func (s *Store) SparseRepackPage(ctx context.Context, after string, limit int, now time.Time, ...) ([]RepackCandidate, bool, error)
- func (s *Store) SparseRepackScanPage(ctx context.Context, afterHash string, afterPackID string, limit int, ...) (RepackScanPage, error)
- func (s *Store) StorageOperation(ctx context.Context, id string) (StorageOperation, error)
- func (s *Store) StorageOperationCleanups(ctx context.Context, operationID string) ([]StorageOperationCleanup, error)
- func (s *Store) StorageOperations(ctx context.Context, limit int) ([]StorageOperation, error)
- func (s *Store) SyncWatchedContent(ctx context.Context, watchName, sourceRef, blobHash string, size int64, ...) (Node, ContentVersion, bool, error)
- func (s *Store) TagByID(ctx context.Context, id string) (Tag, error)
- func (s *Store) TagByName(ctx context.Context, name string) (Tag, error)
- func (s *Store) TaggedNodes(ctx context.Context, tagID string, limit, offset int) ([]TaggedNode, int, error)
- func (s *Store) Tags(ctx context.Context, limit, offset int) ([]Tag, int, error)
- func (s *Store) Trash(ctx context.Context, id, ifRev int64) (Node, string, error)
- func (s *Store) TrashEmpty(ctx context.Context, olderThan time.Duration, run bool) (TrashEmptyResult, error)
- func (s *Store) TrashEmptyBounded(ctx context.Context, olderThan time.Duration, maxRoots int, run bool) (TrashEmptyResult, error)
- func (s *Store) TrashPath(ctx context.Context, path string) (Node, string, error)
- func (s *Store) TrashPathRevision(ctx context.Context, path string, ifRev int64) (Node, string, error)
- func (s *Store) TrashedRoots(ctx context.Context) ([]Node, error)
- func (s *Store) TrashedRootsPage(ctx context.Context, limit, offset int) ([]Node, int, error)
- func (s *Store) UnassignTag(ctx context.Context, tagID string, nodeID, ifRev int64) (TagAssignmentChange, error)
- func (s *Store) UnassignTagPath(ctx context.Context, tagID, path string) (TagAssignmentChange, error)
- func (s *Store) UnreachableBlobs(ctx context.Context) ([]BlobInfo, error)
- func (s *Store) UnreachableBlobsPageFrom(ctx context.Context, after *string, limit int) (GCCandidateScanPage, error)
- func (s *Store) UnreferencedPackMappingsPage(ctx context.Context, after *string, limit int) (StringScanPage, error)
- func (s *Store) UnregisterBlobStore(ctx context.Context, selector string) error
- func (s *Store) ValidateMetadata(ctx context.Context) (err error)
- func (s *Store) VaultID() string
- func (s *Store) VerifyAudit(ctx context.Context, expected *AuditEvidence) (result AuditVerification, err error)
- type StringScanPage
- type Tag
- type TagAssignmentChange
- type TaggedNode
- type TrashEmptyResult
- type VaultInfo
- type VersionPruneResult
- type VersionPruneSelector
- type WalkEntry
- type WalkStats
- type Walker
Constants ¶
const ( ExtractionOK = "ok" ExtractionFailed = "failed" )
const ( SearchMatchName = "name" SearchMatchContent = "content" )
const ( // MaxWalkPageSize bounds every store-level snapshot page. MaxWalkPageSize = 5000 // MaxWalkDepth bounds the indexed frontier expansion required by one walk. MaxWalkDepth = 256 // MaxWalkPathBytes bounds each path materialized in a walk page. At the // maximum page size, paths consume at most about 80 MiB before node data. MaxWalkPathBytes = 16 << 10 )
const MaxAuditEvidenceScopes = 1000
MaxAuditEvidenceScopes bounds caller-supplied prefix work independently of the HTTP body limit. Enrollment enforces the same limit so every valid vault can produce a terminal evidence bundle.
const MaxBatchMoves = 1000
MaxBatchMoves bounds one atomic reorganization and its response.
const MaxProvenancePageSize = 1000
const MaxVersionPruneIDs = 1000
MaxVersionPruneIDs bounds explicit point selections. Larger history cleanup should use an age, count, or all-prior selector instead of holding a write transaction for an unbounded request body.
const UnconditionalRev int64 = -1
UnconditionalRev is the only ifRev value that skips the revision precondition on Move, Trash, and Restore. Every other value — including other negatives, which can never match a real revision — must satisfy the check, so an accidentally propagated bad revision fails stale instead of silently mutating.
Variables ¶
var ( // ErrNotFound is returned when a node, path, or blob does not exist. ErrNotFound = errors.New("not found") // ErrExists is returned when a live sibling with the same name exists. ErrExists = errors.New("name already exists") // ErrNotDir is returned when a directory operation targets a file. ErrNotDir = errors.New("not a directory") // ErrNotFile is returned when a file operation targets a directory. ErrNotFile = errors.New("not a file") // ErrCycle is returned when a move would place a node under its own descendant. ErrCycle = errors.New("move would create a cycle") // ErrInvalidName is returned for empty, ".", "..", or names containing '/' or NUL. ErrInvalidName = errors.New("invalid name") // ErrInvalidTag is returned for an empty, non-UTF-8, or control-containing tag name. ErrInvalidTag = errors.New("invalid tag name") // ErrNotTrashed is returned when restoring a node that is not a trash root. ErrNotTrashed = errors.New("node is not trashed") // ErrIsRoot is returned when an operation targets the root node. ErrIsRoot = errors.New("operation not allowed on root") // ErrStaleRevision means a mutation's expected revision no longer // matches the node (lost-update guard for If-Match). ErrStaleRevision = errors.New("revision mismatch") // ErrVersionNodeMismatch means a requested source version belongs to a // different stable file node. ErrVersionNodeMismatch = errors.New("content version belongs to another node") // ErrVersionAlreadyCurrent means a revert selected the node's current head, // which is not a historical transition. ErrVersionAlreadyCurrent = errors.New("content version is already current") // ErrProvenanceMismatch means an immutable retry named source evidence // that is not an active fact on the existing document. ErrProvenanceMismatch = errors.New("provenance does not match existing content") // ErrInvalidVersionPrune means a history-pruning selector is absent, // contradictory, or otherwise unsafe to execute. ErrInvalidVersionPrune = errors.New("invalid version-prune selector") // ErrInvalidBatchMove means a batch is empty, oversized, repeats a source, // or does not identify each source in exactly one supported way. ErrInvalidBatchMove = errors.New("invalid batch move") // ErrAuditMutationUnsupported means an audited vault cannot perform a // logical mutation until that mutation records its audit transition. ErrAuditMutationUnsupported = errors.New("mutation is not supported for an audited vault") // ErrAuditAlreadyEnabled means a plan reviewed against dormant authority // cannot run because another operation enabled audit first. ErrAuditAlreadyEnabled = errors.New("audit is already enabled for this vault") // ErrAuditScopeOverlap means an additional scope would share at least one // sticky member with an existing scope. Disjoint scopes are supported first; // overlapping and nested scopes remain fail-closed. ErrAuditScopeOverlap = errors.New("audit scope overlaps existing permanent protection") // ErrAuditScopeLimit means permanent enrollment has reached the maximum // number of scope terminals one evidence bundle can represent. ErrAuditScopeLimit = errors.New("audit scope limit reached") // ErrAuditPreviewStale means enrollment no longer matches the exact // metadata state reviewed by the caller. ErrAuditPreviewStale = errors.New("audit enrollment preview is stale") // ErrAuditNotEnrolled means a node exists but has no sticky audit membership. ErrAuditNotEnrolled = errors.New("node is not enrolled in an audit scope") // ErrInvalidAuditCursor means an audit-history cursor is malformed or belongs // to a different stable node or scope. ErrInvalidAuditCursor = errors.New("invalid audit history cursor") // ErrBlobStorePrimary means an operation would detach, drain, or remove the // fixed built-in primary. ErrBlobStorePrimary = errors.New("operation not allowed on primary blob store") // ErrBlobStoreNotEmpty means a store still carries physical authority. ErrBlobStoreNotEmpty = errors.New("blob store still contains authoritative locations") // ErrBlobStoreState means the requested lifecycle transition is invalid. ErrBlobStoreState = errors.New("invalid blob-store lifecycle transition") // ErrStorageOperationTerminal means a completed, failed, or cancelled // operation can no longer accept cancellation or progress. ErrStorageOperationTerminal = errors.New("storage operation is already terminal") )
var ErrPhysicalAuthorityMissing = packstore.ErrPhysicalAuthorityMissing
ErrPhysicalAuthorityMissing means logical blob membership exists but no indexed loose representation or pack mapping currently authorizes reads.
var ErrStorageOperationCancelled = errors.New("storage operation cancellation was requested")
Functions ¶
func DefaultSQLiteDriver ¶
DefaultSQLiteDriver returns the build's standalone-compatible adapter: CGO builds use mattn/go-sqlite3 and no-CGO builds use modernc.org/sqlite.
func NormalizeName ¶
NormalizeName NFC-normalizes name and validates it for use as a node name. Names are stored as given (post-NFC) and compared case-sensitively.
func NormalizeSearchMIMEType ¶ added in v0.11.0
NormalizeSearchMIMEType accepts one parameter-free media type and returns its canonical base spelling. Stored parameters do not participate in search filtering because they describe representation details, not the format.
func NormalizeSearchTimeBounds ¶ added in v0.11.0
NormalizeSearchTimeBounds accepts optional absolute RFC3339 timestamps and returns canonical UTC bounds. The half-open interval makes adjacent searches compose without duplicate boundary results.
func NormalizeTagName ¶
NormalizeTagName validates and NFC-normalizes a user-facing tag name. Names are compared case-sensitively and may contain spaces or '/'.
func ValidateAuditEvidence ¶
func ValidateAuditEvidence(evidence AuditEvidence) error
ValidateAuditEvidence rejects evidence that cannot represent a terminal allocation lineage plus a stable, sorted set of scope terminals.
func ValidateAuditHistoryCursor ¶
ValidateAuditHistoryCursor checks that an opaque cursor belongs to nodeID.
func ValidateAuditPathState ¶
ValidateAuditPathState checks the canonical coordinate domain used by an audit path event. It deliberately does not use host-filesystem path rules.
func ValidateAuditScopeHistoryCursor ¶ added in v0.10.1
ValidateAuditScopeHistoryCursor checks that an opaque cursor belongs to scopeID.
func ValidatePlacementPlan ¶ added in v0.12.0
func ValidatePlacementPlan(plan PlacementPlan) error
func ValidateSecondaryBlobStoreName ¶ added in v0.12.0
ValidateSecondaryBlobStoreName rejects names that cannot coexist with the fixed built-in primary. Callers use it before touching an external namespace.
func ValidateStorageRecoveryPlan ¶ added in v0.12.0
func ValidateStorageRecoveryPlan(plan StorageRecoveryPlan) error
func ValidateVersionPruneSelector ¶
func ValidateVersionPruneSelector(selector VersionPruneSelector) error
ValidateVersionPruneSelector applies the authoritative store-level selector rules. HTTP and CLI adapters translate their inputs into this type and reuse the same validation before opening a transaction.
Types ¶
type AuditAttachmentChange ¶
type AuditAttachmentChange struct {
Kind string
Identity AuditAttachmentIdentity
Before *AuditAttachmentState
After *AuditAttachmentState
}
AuditAttachmentChange makes tag and provenance events self-explanatory.
type AuditAttachmentIdentity ¶
AuditAttachmentIdentity identifies one tag or provenance record without relying on its mutable display fields.
type AuditAttachmentState ¶
type AuditAttachmentState struct {
TagID string
NodeID int64
TagName string
ProvenanceID string
IngestID string
OriginalPath *string
OriginalMTime *string
Supersedes *string
}
AuditAttachmentState is the typed before/after state of one attached record. The enclosing change Kind determines which fields are present.
type AuditEnrollmentPlan ¶
type AuditEnrollmentPlan struct {
// contains filtered or unexported fields
}
AuditEnrollmentPlan carries the server-private, non-derivable inputs behind a preview. Its fields are intentionally opaque outside this package: callers may present the summary, but only Store can execute the exact plan.
func (*AuditEnrollmentPlan) Preview ¶
func (plan *AuditEnrollmentPlan) Preview() AuditEnrollmentPreview
Preview returns a copy of the plan's public retention inventory.
type AuditEnrollmentPreview ¶
type AuditEnrollmentPreview struct {
InitialAuthority bool
VaultID string
ScopeID string
OperationID string
TargetNodeID int64
TargetPath string
BaselineDigest string
MemberCount int
FileCount int
DirectoryCount int
VersionCount int
LogicalVersionBytes int64
UniqueBlobs int
UniqueBlobBytes int64
UnresolvedTrashOrigins int
VaultTopologyNodes int
VaultAttachmentRecords int
AuthorityJSONBytes int64
}
AuditEnrollmentPreview is the exact retention boundary a caller reviews before permanently enabling one audit scope in a vault.
type AuditEvent ¶
type AuditEvent struct {
ID string
OperationID string
OperationSequence int64
Ordinal int64
NodeID int64
Kind string
ScopeID string
RecordedAt string
Origin string
AgentLabel *string
PriorNodeRevision int64
ResultingNodeRevision int64
PriorCurrentVersionID *string
ResultingCurrentVersionID *string
SourceVersionID *string
TargetNodeID *int64
BaselineDigest *string
Attachment *AuditAttachmentChange
OldPath *AuditPathState
NewPath *AuditPathState
}
AuditEvent is one canonical node event projected for human and agent readers.
type AuditEventPage ¶
type AuditEventPage struct {
Node Node
Path string
Items []AuditEvent
Total int
Limit int
Cursor string
NextCursor string
}
AuditEventPage is a stable newest-first page for one audited node.
type AuditEvidence ¶
type AuditEvidence struct {
Enabled bool
VaultID string
LineageID string
OperationSequenceHighWater int64
AllocationEntryCount int64
AllocationHead string
Scopes []AuditScopeEvidence
}
AuditEvidence is the stable authority bundle produced after replay.
type AuditEvidenceCheck ¶
type AuditEvidenceCheck struct {
Extends bool
Problems []AuditEvidenceProblem
}
AuditEvidenceCheck is the exact-prefix proof for externally recorded audit evidence. Extends is true exactly when Problems is empty.
type AuditEvidenceProblem ¶
AuditEvidenceProblem explains why current authority does not extend one externally recorded evidence bundle.
type AuditMembershipStatus ¶
type AuditMembershipStatus struct {
NodeID int64
Path string
Trashed bool
Protected bool
ScopeIDs []string
BaselineDigests []string
}
AuditMembershipStatus explains whether one inspected node is protected and which permanent scope/baseline bindings provide that protection.
type AuditPathState ¶
AuditPathState preserves both the canonical coordinate and its domain.
type AuditScopeEventPage ¶ added in v0.10.1
type AuditScopeEventPage struct {
Scope AuditScopeStatus
Items []AuditEvent
Total int
Limit int
Cursor string
NextCursor string
}
AuditScopeEventPage is a stable newest-first page across one audit scope.
type AuditScopeEvidence ¶
AuditScopeEvidence is one verified scope-chain terminal.
type AuditScopeStatus ¶
type AuditScopeStatus struct {
ID string
TargetNodeID int64
TargetPath string
TargetTrashed bool
EnableOperationID string
BaselineDigest string
MemberCount int
EntryCount int64
ChainHead string
}
AuditScopeStatus is one permanent scope and its current chain evidence.
type AuditStatus ¶
type AuditStatus struct {
Enabled bool
EnabledScopeID string
VaultID string
LineageID string
OperationSequenceHighWater int64
AllocationEntryCount int64
AllocationHead string
Scopes []AuditScopeStatus
Membership *AuditMembershipStatus
}
AuditStatus is the vault-wide audit authority plus optional node membership.
type AuditVerification ¶
type AuditVerification struct {
Evidence AuditEvidence
EvidenceCheck *AuditEvidenceCheck
ProtectedBlobs []BlobInfo
ProtectedBytes int64 // unique raw bytes across ProtectedBlobs
}
AuditVerification is one independently replayed audit snapshot plus the unique blobs whose bytes permanent history requires.
type BatchMoveRequest ¶ added in v0.10.1
type BatchMoveRequest struct {
SourcePath string
NodeID int64
IfRevision int64
DestinationPath string
}
BatchMoveRequest identifies a live source either by SourcePath or by the stable NodeID plus IfRevision, and gives its absolute final destination.
type BatchMoveResult ¶ added in v0.10.1
BatchMoveResult is the transactionally captured receipt for one request.
type BlobLocation ¶ added in v0.12.0
type BlobLocation struct {
Hash string
StoreID string
Generation string
Kind string
Encoding string
LogicalSize int64
StoredSize int64
PackEligible bool
Pack *PackedLocation
}
BlobLocation is one catalog-authorized physical representation.
type BlobPhysical ¶ added in v0.10.0
type BlobPhysical struct {
Encoding string
StoredBytes int64
PackEligible bool
// Created proves this write published a new, fully hashed canonical loose
// representation rather than deduplicating an existing file by type and size.
Created bool
}
BlobPhysical is the loose representation published before a metadata transaction grants logical authority.
type BlobStore ¶ added in v0.12.0
type BlobStore struct {
ID string
Name string
Kind string
Role string
Lifecycle string
Binding string
OwnershipEpoch string
CreatedAt time.Time
}
BlobStore is one stable physical-store identity in the local placement catalog. Binding names refer to machine-local configuration; their resolved paths or credentials never enter SQLite.
type BlobStoreEvacuationFinalization ¶ added in v0.12.0
type BlobStoreEvacuationFinalization struct {
Retire []packstore.ObjectRef
RevokedLocations int64
Detached bool
}
BlobStoreEvacuationFinalization is the catalog result of revoking an empty source after every location has verified destination coverage. Physical retirement happens afterward through Kit's reader-safe backend.
type BlobStoreStats ¶ added in v0.12.0
type BlobStoreStats struct {
AuthoritativeObjects int64
LogicalBytes int64
StoredBytes int64
PackCount int64
DeadPackedBytes int64
SoleAuthorityObjects int64
AffectedDocuments int64
}
BlobStoreStats reports catalog-authorized physical inventory for one store.
type ContentReference ¶
type ContentReference struct {
Version ContentVersion
Node Node
Path string
IsCurrent bool
}
ContentReference joins one immutable content version to the stable node that retains it. Path is populated only for a live node; trashed nodes deliberately have no resolvable virtual path.
type ContentVersion ¶
type ContentVersion struct {
ID string
NodeID int64
BlobHash string
Size int64
MimeType string
RecordedAt string
NodeRevision int64
IntroducedOperationID string
TransitionKind string
SourceVersionID *string
}
ContentVersion is one immutable byte identity recorded for a stable file node. Initial ingest creates content_create records, verified replacement adds content_replace heads, and reversion adds content_revert heads that retain their source identity.
type ContentVersionView ¶ added in v0.12.0
type ContentVersionView struct {
Node Node
Version ContentVersion
}
ContentVersionView binds a file node and one of its retained versions to the same read snapshot.
type ContentWriteReceipt ¶ added in v0.10.0
type ContentWriteReceipt struct {
Node Node
Version ContentVersion
Physical PhysicalContent
}
ContentWriteReceipt captures content authority from the transaction that created or replaced a file. Callers need no fallible post-commit reads.
type DirectoryPageView ¶ added in v0.11.0
DirectoryPageView binds a live directory and one child page to the same read snapshot. Callers can render child paths without combining directory authority from one point in time with children from another.
type ExtractionCandidate ¶
ExtractionCandidate is one catalog-authorized text blob that has not been processed by the current extractor version.
type ExtractionResult ¶
type ExtractionResult struct {
BlobHash string
Extractor string
ExtractorVersion int64
Status string
Error string
Text string
}
ExtractionResult is one complete, versioned derived-text attempt. Text is present only for a successful, terminally verified extraction.
type GCCandidate ¶ added in v0.10.0
GCCandidate is one unreachable catalog row and its indexed loose authority.
type GCCandidateScanPage ¶ added in v0.10.0
type GCCandidateScanPage struct {
Items []GCCandidate
Examined int
HighWater string
More bool
}
GCCandidateScanPage reports bounded raw catalog progress independently of how many rows qualify as unreachable work.
type IngestRun ¶
type IngestRun struct {
// contains filtered or unexported fields
}
IngestRun identifies one logical import and carries the immutable metadata that is published with its first imported file. Holding a run grants no metadata authority by itself.
type LooseBacklog ¶ added in v0.10.0
type LooseBacklog struct {
EligibleObjects int64
EligibleBytes int64
EligibleStoredBytes int64
RawObjects int64
CompressedObjects int64
}
LooseBacklog summarizes loose content eligible for an explicit pack pass.
type MetadataSnapshot ¶
type MetadataSnapshot struct {
// contains filtered or unexported fields
}
MetadataSnapshot owns a dedicated deferred read transaction. Store's normal connections use BEGIN IMMEDIATE for mutations; using that pool here would hold the writer lock for the full backup instead of only pinning a WAL view.
func (*MetadataSnapshot) Close ¶
func (s *MetadataSnapshot) Close() error
func (*MetadataSnapshot) Export ¶
Export writes the deterministic logical metadata held by this snapshot.
func (*MetadataSnapshot) QueryContext ¶
func (*MetadataSnapshot) QueryRowContext ¶
type Node ¶
type Node struct {
ID int64
ParentID *int64
Name string
Kind string // "dir" | "file"
CurrentVersionID string
BlobHash string
Size int64
MimeType string
Revision int64
CreatedAt string
ModifiedAt string
TrashedAt *string
}
Node is a row of the virtual tree. IDs are canonical; paths are display.
type NodeProvenancePage ¶ added in v0.11.0
type NodeProvenancePage struct {
Node Node
Path string
Items []ProvenanceFact
Total int
Limit int
Offset int
}
NodeProvenancePage is one transactionally consistent document and bounded page of its newest-ingest-first provenance facts. Path is empty for trash.
type NodeView ¶ added in v0.11.0
NodeView binds one node snapshot to its live canonical path. Path is empty when the snapshot marks the node as trashed.
type PackCatalog ¶
type PackCatalog struct {
// contains filtered or unexported fields
}
PackCatalog adapts docbank's blob membership and physical metadata to Kit's application-neutral storage engine. A blobs row establishes logical membership; indexed loose state or a pack mapping separately grants read authority. Nodes, versions, and future external pins decide whether GC may remove logical membership.
func NewPackCatalog ¶
func NewPackCatalog(s *Store) *PackCatalog
NewPackCatalog constructs a packed-storage catalog over s.
func (*PackCatalog) AdoptPack ¶
func (c *PackCatalog) AdoptPack(ctx context.Context, record packstore.PackRecord, adoptions []packstore.Adoption) error
func (*PackCatalog) ClearPackMetadata ¶
func (c *PackCatalog) ClearPackMetadata(ctx context.Context) error
func (*PackCatalog) CommitRepack ¶
func (c *PackCatalog) CommitRepack(ctx context.Context, sourceIDs []string, records []packstore.PackRecord, moves []packstore.RepackMove) error
func (*PackCatalog) DeleteEmptyPackRecord ¶
func (*PackCatalog) DeleteIndexEntry ¶
func (*PackCatalog) DeletePackRecord ¶
func (c *PackCatalog) DeletePackRecord(ctx context.Context, packID string) error
func (*PackCatalog) HasPackRecord ¶
func (*PackCatalog) ListIndexed ¶
func (c *PackCatalog) ListIndexed(ctx context.Context) ([]packstore.IndexEntry, error)
func (*PackCatalog) ListLivePackEntries ¶
func (c *PackCatalog) ListLivePackEntries(ctx context.Context, packID string) ([]packstore.IndexEntry, error)
func (*PackCatalog) ListPackEntries ¶
func (c *PackCatalog) ListPackEntries(ctx context.Context, packID string) ([]packstore.IndexEntry, error)
func (*PackCatalog) ListPackRecords ¶
func (c *PackCatalog) ListPackRecords(ctx context.Context) ([]packstore.PackRecord, error)
func (*PackCatalog) ListPackUsage ¶
func (*PackCatalog) ListReferences ¶
func (c *PackCatalog) ListReferences(ctx context.Context) (packstore.ReferenceInventory, error)
func (*PackCatalog) ListUnpacked ¶
func (*PackCatalog) PrimaryOwnership ¶ added in v0.12.0
func (c *PackCatalog) PrimaryOwnership() packstore.Ownership
PrimaryOwnership is the fixed local namespace identity. Unlike secondary bindings its location is implicit in the vault, but Kit still uses the marker to fence destructive physical work.
func (*PackCatalog) PrimaryStoreID ¶ added in v0.12.0
func (c *PackCatalog) PrimaryStoreID() packstore.StoreID
PrimaryStoreID identifies the built-in filesystem backend.
func (*PackCatalog) PruneUnreferenced ¶
func (c *PackCatalog) PruneUnreferenced(ctx context.Context) (int64, error)
func (*PackCatalog) RecordPack ¶
func (c *PackCatalog) RecordPack(ctx context.Context, record packstore.PackRecord, adoptions []packstore.Adoption) error
func (*PackCatalog) ResolveLocations ¶ added in v0.12.0
func (c *PackCatalog) ResolveLocations( ctx context.Context, hash packstore.Hash, ) (packstore.Resolution, error)
ResolveLocations exposes the store-scoped physical authority used by Kit's multi-location reader. Maintenance still uses the released single-layout Catalog surface as a thin adapter over the same rows.
type PackRestoreCatalog ¶
type PackRestoreCatalog struct {
// contains filtered or unexported fields
}
PackRestoreCatalog grants packed authority in an unpublished restored database. It deliberately accepts a *sql.DB rather than a Store because Kit owns the staged database lifecycle until restore publication.
func NewPackRestoreCatalog ¶
func NewPackRestoreCatalog(db *sql.DB) *PackRestoreCatalog
NewPackRestoreCatalog constructs a restore-only packed catalog over db.
func (*PackRestoreCatalog) ReplaceRestoredPacks ¶
func (c *PackRestoreCatalog) ReplaceRestoredPacks( ctx context.Context, records []packstore.PackRecord, adoptions []packstore.Adoption, ) error
ReplaceRestoredPacks atomically discards pack metadata captured from the source vault and grants authority only to packs Kit published and verified in the restore target.
type PackedLocation ¶ added in v0.12.0
type PackedLocation struct {
PackID string
Offset int64
Stored int64
Raw int64
Flags uint8
CRC32C uint32
}
PackedLocation is the store-scoped immutable pack entry for one blob.
type PhysicalContent ¶ added in v0.10.0
type PhysicalContent struct {
Kind string
Encoding string
LogicalBytes int64
StoredBytes int64
PackEligible bool
}
PhysicalContent describes the catalog-authorized representation of one logical blob without requiring a filesystem scan.
type PlacementCommit ¶ added in v0.12.0
type PlacementCommit struct {
DestinationAuthorized bool `json:"destination_authorized"`
SourceRevoked bool `json:"source_revoked"`
ReferenceDrift bool `json:"reference_drift"`
AuditPinned bool `json:"audit_pinned"`
PackRepackRequired bool `json:"pack_repack_required"`
Retire *packstore.ObjectRef `json:"-"`
}
type PlacementHash ¶ added in v0.12.0
type PlacementHash struct {
Hash string `json:"hash"`
Size int64 `json:"size"`
SelectedReferences int64 `json:"selected_references"`
TotalReferences int64 `json:"total_references"`
Source packstore.ReadLocation `json:"source"`
Destination *packstore.ReadLocation `json:"destination,omitempty"`
AuditPinned bool `json:"audit_pinned"`
RetireSource bool `json:"retire_source"`
PackRepackRequired bool `json:"pack_repack_required"`
ScratchBytes int64 `json:"scratch_bytes,omitzero"`
}
type PlacementPlan ¶ added in v0.12.0
type PlacementPlan struct {
Version int `json:"version"`
Request PlacementRequest `json:"request"`
Digest string `json:"digest"`
Hashes []PlacementHash `json:"hashes"`
SelectedNodes int64 `json:"selected_nodes"`
SelectedVersions int64 `json:"selected_versions"`
LogicalBytes int64 `json:"logical_bytes"`
TransferBytes int64 `json:"transfer_bytes"`
ReadBackBytes int64 `json:"read_back_bytes"`
RemoteEgressBytes int64 `json:"remote_egress_bytes"`
ScratchBytes int64 `json:"scratch_bytes"`
AlreadyPresentBytes int64 `json:"already_present_bytes"`
RetirableBytes int64 `json:"retirable_bytes"`
AuditPinnedBytes int64 `json:"audit_pinned_bytes"`
PackBlockedBytes int64 `json:"pack_blocked_bytes"`
}
type PlacementRequest ¶ added in v0.12.0
type PlacementRequest struct {
TargetNodeID int64 `json:"target_node_id"`
SourceStoreID string `json:"source_store_id"`
DestinationStoreID string `json:"destination_store_id"`
RetireSource bool `json:"retire_source"`
Evacuate bool `json:"evacuate,omitzero"`
AllowAuditedRemoteOnly bool `json:"allow_audited_remote_only"`
}
type ProvenanceFact ¶ added in v0.11.0
type ProvenanceFact struct {
Identity string
NodeID int64
IngestID string
IngestStartedAt string
SourceKind string
SourceDescription string
OriginalPath string
OriginalMTime *string
Supersedes *string
Active bool
}
ProvenanceFact is one immutable statement about where a document entered Docbank. A newer fact may supersede an older fact without rewriting it.
type RepackCandidate ¶ added in v0.10.0
RepackCandidate binds one sparse pack to the lowest canonical live blob hash that provides its stable maintenance key.
type RepackScanPage ¶ added in v0.10.0
type RepackScanPage struct {
Items []RepackCandidate
More bool
}
type SearchOptions ¶ added in v0.11.0
type SearchOptions struct {
TagID string
MIMEType string
UnderNodeID int64
ModifiedSince string
ModifiedBefore string
}
SearchOptions narrows ranked search without changing its name-before-content ordering. TagID identifies one required assignment; MIMEType selects the current file version's parameter-free base media type; UnderNodeID selects descendants of one live directory. ModifiedSince is inclusive and ModifiedBefore is exclusive; both accept absolute RFC3339 timestamps.
type StorageOperation ¶ added in v0.12.0
type StorageOperation struct {
ID string
Kind string
SourceStoreID string
RequestVersion int64
RequestDigest string
RequestJSON string
PlanJSON string
State StorageOperationState
Cursor string
TotalObjects int64
CompletedObjects int64
CopiedObjects int64
CopiedBytes int64
CancelRequested bool
Error string
ReceiptJSON string
CreatedAt time.Time
UpdatedAt time.Time
FinishedAt *time.Time
RetentionUntil *time.Time
}
type StorageOperationCleanup ¶ added in v0.12.0
type StorageOperationCreate ¶ added in v0.12.0
type StorageOperationState ¶ added in v0.12.0
type StorageOperationState string
const ( StorageOperationQueued StorageOperationState = "queued" StorageOperationRunning StorageOperationState = "running" StorageOperationCompleted StorageOperationState = "completed" StorageOperationFailed StorageOperationState = "failed" StorageOperationCancelled StorageOperationState = "cancelled" )
type StorageOperationStoreReference ¶ added in v0.12.0
type StorageRecoveryPlan ¶ added in v0.12.0
type StorageRecoveryPlan struct {
Version int `json:"version"`
Kind string `json:"kind"`
Digest string `json:"digest"`
Hash string `json:"hash"`
Size int64 `json:"size"`
Sources []packstore.ReadLocation `json:"sources"`
Destination string `json:"destination"`
Prior *packstore.ReadLocation `json:"prior,omitempty"`
}
StorageRecoveryPlan binds one explicit repair or fenced-store salvage to immutable content identity and the exact physical candidates reviewed.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the single access path to the docbank database.
func Open ¶
Open opens (creating if needed) the database at path, applies the schema, and guarantees the root directory node exists. When driver is omitted, CGO builds use mattn/go-sqlite3 and no-CGO builds use modernc.org/sqlite.
func (*Store) AddRestoredBlobLocation ¶ added in v0.12.0
func (s *Store) AddRestoredBlobLocation( ctx context.Context, hash string, destination packstore.ReadLocation, ) error
AddRestoredBlobLocation grants authority to bytes independently verified during an explicit restore remap. The source primary remains authoritative until the complete mapped copy set has committed.
func (*Store) AdvanceStorageOperation ¶ added in v0.12.0
func (*Store) AllBlobHashes ¶
AllBlobHashes lists every recorded blob identity without reading ancillary metadata. Integrity verification uses this after separately validating the metadata stream, so one malformed scalar does not suppress the useful report.
func (*Store) AssignTag ¶
func (s *Store) AssignTag( ctx context.Context, tagID string, nodeID, ifRev int64, ) (TagAssignmentChange, error)
AssignTag attaches a tag to a node under an optimistic revision check. Repeating an existing assignment is an idempotent no-op only when ifRev still matches the current node revision.
func (*Store) AssignTagPath ¶
func (s *Store) AssignTagPath( ctx context.Context, tagID, path string, ) (TagAssignmentChange, error)
AssignTagPath resolves a live path and assigns a tag in the same transaction.
func (*Store) AuditHistory ¶
func (s *Store) AuditHistory( ctx context.Context, nodeID int64, limit int, cursor string, ) (AuditEventPage, error)
AuditHistory returns one bounded page for a stable node ID, including trash.
func (*Store) AuditHistoryPath ¶
func (s *Store) AuditHistoryPath( ctx context.Context, path string, limit int, cursor string, ) (AuditEventPage, error)
AuditHistoryPath resolves one live path in the same snapshot as its history.
func (*Store) AuditScopeHistory ¶ added in v0.10.1
func (s *Store) AuditScopeHistory( ctx context.Context, scopeID string, limit int, cursor string, ) (AuditScopeEventPage, error)
AuditScopeHistory returns one bounded page across a stable audit scope.
func (*Store) AuditStatus ¶
AuditStatus reports current authority and optionally the sticky membership of one stable node from one consistent database snapshot.
func (*Store) AuditStatusPath ¶
AuditStatusPath resolves one live path and its sticky membership in the same read snapshot as the vault-wide authority evidence.
func (*Store) BatchMove ¶ added in v0.10.1
func (s *Store) BatchMove(ctx context.Context, requests []BatchMoveRequest) ([]BatchMoveResult, error)
BatchMove applies the requested reorganization as one metadata transaction. Sources resolve against one pre-state. Exact destination coordinates resolve against the planned final tree, which is checked before any row changes.
func (*Store) BeginBlobStoreEvacuation ¶ added in v0.12.0
BeginBlobStoreEvacuation makes one secondary read-only for new placement destinations while keeping its current locations readable during copying.
func (*Store) BeginEmbeddedIngest ¶ added in v0.11.0
func (s *Store) BeginEmbeddedIngest( ctx context.Context, sourceKind, sourceDesc string, ) (IngestRun, error)
BeginEmbeddedIngest prepares generic provenance without interpreting any source kind as daemon-owned operational state.
func (*Store) BeginIngest ¶
BeginIngest prepares an authority-free ingest run. Its metadata is inserted atomically with the first file that actually imports, so audited vaults never contain a run whose provenance was committed in a separate transaction.
func (*Store) BeginMetadataSnapshot ¶
func (s *Store) BeginMetadataSnapshot(ctx context.Context) (*MetadataSnapshot, error)
BeginMetadataSnapshot establishes a pinned read transaction for logical backup capture. The initial read is required: BeginTx alone is lazy in SQLite and would not pin a snapshot before Kit releases the mutation gate.
func (*Store) BeginStorageRecoveryPublication ¶ added in v0.12.0
func (s *Store) BeginStorageRecoveryPublication( ctx context.Context, operationID string, plan StorageRecoveryPlan, ) error
BeginStorageRecoveryPublication rejects a stale preview and makes the operation non-cancellable before physical replacement. The runner holds the destination location lock across this transition and catalog publication.
func (*Store) BeginWalk ¶ added in v0.10.0
func (s *Store) BeginWalk( ctx context.Context, rootPath string, pageSize int, includeTrashed bool, ) (_ *Walker, retErr error)
BeginWalk pins a snapshot and seeds an incremental ordered frontier rooted at rootPath. Setup work depends on root-path depth, never subtree cardinality.
func (*Store) BlobHashesPage ¶ added in v0.10.0
func (s *Store) BlobHashesPage( ctx context.Context, after string, limit int, ) ([]string, bool, error)
BlobHashesPage is the scalar-tolerant verification inventory. It does not scan ancillary blob metadata, so a malformed size remains reportable by ValidateMetadata without suppressing content verification.
func (*Store) BlobHashesPageFrom ¶ added in v0.10.0
func (s *Store) BlobHashesPageFrom( ctx context.Context, after *string, limit int, ) ([]string, bool, error)
BlobHashesPageFrom distinguishes the beginning of an ordering from an arbitrary stored key, including the empty string.
func (*Store) BlobInfo ¶ added in v0.10.0
BlobInfo returns logical catalog membership independently of whether a loose or packed representation currently has physical read authority.
func (*Store) BlobStoreBySelector ¶ added in v0.12.0
BlobStoreBySelector resolves canonical UUIDv4 selectors exclusively as IDs; all other selectors are names.
func (*Store) BlobStoreInventory ¶ added in v0.12.0
BlobStoreInventory returns per-store authority without inspecting deployment namespaces or treating orphan files as catalog objects.
func (*Store) BlobStoreUnreadableObjects ¶ added in v0.12.0
func (s *Store) BlobStoreUnreadableObjects( ctx context.Context, online map[string]bool, ) (map[string]int64, error)
BlobStoreUnreadableObjects counts each retained object against every store that holds it when none of its catalog locations are currently online. Runtime observations stay in Go and never rewrite durable authority.
func (*Store) BlobStores ¶ added in v0.12.0
BlobStores lists physical-store authority with the fixed primary first.
func (*Store) BlobsPage ¶ added in v0.10.0
BlobsPage returns one bounded hash-keyset page of recorded blob identities.
func (*Store) CheckContentReplacementTarget ¶
CheckContentReplacementTarget performs the cheap target and revision checks before a caller streams bytes. ReplaceContent repeats them transactionally, because this preflight is an optimization rather than mutation authority.
func (*Store) Checkpoint ¶
Checkpoint truncates the WAL after all application writes have completed. Portable restore uses it before closing a freshly imported database so the main file is self-contained and no sidecar is required for publication.
func (*Store) ChildrenPage ¶
func (s *Store) ChildrenPage( ctx context.Context, dirID int64, limit, offset int, ) ([]Node, int, error)
ChildrenPage lists one bounded page of a directory's live children, dirs first and name-sorted, and returns the complete child count. Target kind, total, and page come from one statement so callers never observe a mixture across concurrent tree mutations.
func (*Store) ClaimStorageOperation ¶ added in v0.12.0
func (*Store) CommitPlacement ¶ added in v0.12.0
func (s *Store) CommitPlacement( ctx context.Context, operationID string, request PlacementRequest, planned PlacementHash, destination packstore.ReadLocation, ) (PlacementCommit, error)
CommitPlacement grants a fully verified destination receipt and, when the current reference closure still permits it, revokes one loose source in the same short catalog transaction. Network I/O belongs before this boundary.
func (*Store) CommitStorageRecovery ¶ added in v0.12.0
func (s *Store) CommitStorageRecovery( ctx context.Context, operationID string, plan StorageRecoveryPlan, receipt packstore.ReadLocation, operationReceiptJSON string, retentionUntil time.Time, ) error
CommitStorageRecovery grants the fully verified replacement generation.
func (*Store) CompleteStorageOperationCleanup ¶ added in v0.12.0
func (*Store) ConfirmContentWithReceipt ¶ added in v0.10.0
func (s *Store) ConfirmContentWithReceipt( ctx context.Context, nodeID, ifRev int64, blobHash string, size int64, mimeType string, physical ...BlobPhysical, ) (ContentWriteReceipt, error)
ConfirmContentWithReceipt confirms that a file still has the expected immutable head while reconciling a newly published physical receipt. It is the transactional completion path for an otherwise idempotent write.
func (*Store) ConfirmIngestedContentWithReceipt ¶ added in v0.11.0
func (s *Store) ConfirmIngestedContentWithReceipt( ctx context.Context, nodeID, ifRev int64, blobHash string, size int64, mimeType, sourceKind, sourceDescription, sourceReference, sourceModifiedAt string, physical ...BlobPhysical, ) (ContentWriteReceipt, error)
ConfirmIngestedContentWithReceipt is the idempotent completion path for an embedded immutable create with provenance. It succeeds only when the existing node has the same content authority and an active matching source fact, so a retry cannot silently claim evidence that was never recorded.
func (*Store) ContentReferencesByHash ¶
func (s *Store) ContentReferencesByHash( ctx context.Context, hash string, limit, offset int, ) ([]ContentReference, int, error)
ContentReferencesByHash returns one bounded, deterministic page of logical references to canonical SHA-256 content. A physical blob with no retained content version is not a match. Live current references sort first, followed by live history and then trashed references.
func (*Store) ContentVersionByID ¶
ContentVersionByID returns one version by its globally stable identity.
func (*Store) ContentVersionViewByID ¶ added in v0.12.0
func (s *Store) ContentVersionViewByID( ctx context.Context, nodeID int64, versionID string, ) (ContentVersionView, error)
ContentVersionViewByID returns one node-owned version and its node authority from a single read transaction.
func (*Store) ContentVersions ¶
func (s *Store) ContentVersions( ctx context.Context, nodeID int64, limit, offset int, ) ([]ContentVersion, int, error)
ContentVersions lists one bounded page newest-first and returns the total number of versions recorded for the node.
func (*Store) CreateFile ¶
func (s *Store) CreateFile( ctx context.Context, parentID int64, name, blobHash string, size int64, mimeType string, physical ...BlobPhysical, ) (Node, error)
CreateFile creates a file node pointing at an already-durable blob.
func (*Store) CreateFileWithReceipt ¶ added in v0.10.0
func (s *Store) CreateFileWithReceipt( ctx context.Context, parentID int64, name, blobHash string, size int64, mimeType string, physical ...BlobPhysical, ) (ContentWriteReceipt, error)
CreateFileWithReceipt creates a file node and returns its complete committed content authority.
func (*Store) CreateStorageOperation ¶ added in v0.12.0
func (s *Store) CreateStorageOperation( ctx context.Context, input StorageOperationCreate, ) (StorageOperation, error)
func (*Store) DeadPackUsagePage ¶ added in v0.10.0
func (*Store) DeferStorageOperation ¶ added in v0.12.0
DeferStorageOperation records a retryable worker failure and returns the operation to the durable queue without presenting it as actively running.
func (*Store) DeferTextExtraction ¶
func (s *Store) DeferTextExtraction( ctx context.Context, blobHash string, notBefore time.Time, ) error
DeferTextExtraction leaves a retryable item queued but moves it behind work that is ready now. The worker chooses the bounded delay in Go.
func (*Store) DeleteBlobRows ¶
DeleteBlobRows removes logical membership and derived metadata for reclaimed blobs. Callers must hold the exclusive vault lock (see UnreachableBlobs) and retire every loose location first. Packed entries remain as dead physical accounting until repack retires their immutable container.
func (*Store) DeleteTag ¶
DeleteTag removes one definition and all of its assignments, advancing each formerly assigned node's metadata revision exactly once.
func (*Store) DeleteUnreferencedPackMappings ¶ added in v0.10.0
DeleteUnreferencedPackMappings conditionally removes the named stale mappings. A blob authority restored after selection protects its mapping.
func (*Store) DetachBlobStore ¶ added in v0.12.0
DetachBlobStore removes an empty secondary from ordinary backend admission while retaining its stable catalog identity for explicit unregister.
func (*Store) DirectoryChildrenPage ¶ added in v0.11.0
func (s *Store) DirectoryChildrenPage( ctx context.Context, dirID int64, limit, offset int, ) (DirectoryPageView, error)
DirectoryChildrenPage returns a live directory's current canonical path and one ordered child page from a single read transaction.
func (*Store) EnableInitialAudit ¶
func (s *Store) EnableInitialAudit( ctx context.Context, plan *AuditEnrollmentPlan, ) (AuditStatus, error)
EnableInitialAudit commits a previously reviewed scope only when its baseline and allocation authority still exactly match current metadata.
func (*Store) EnsureBlobTx ¶
EnsureBlobTx records a blob row if missing. The blob file must already be durable on disk before the enclosing transaction commits. If a blob row already exists under hash, its recorded size must match size and it must still have catalog-authorized loose or packed bytes. Missing physical authority requires explicit verified repair; an ordinary write receipt is not sufficient to adopt potentially unverified deduplicated bytes.
func (*Store) EnsureDir ¶
EnsureDir returns the live directory named name under parentID, creating it if missing and converging on a concurrent creation. ID-based on purpose: callers that resolved a destination once (ingest) must not re-derive it from a path, which a concurrent move or trash can redirect.
func (*Store) ExportMetadata ¶
ExportMetadata writes a deterministic JSONL description of Docbank's logical state. Rebuildable FTS data and physical pack authority are omitted.
func (*Store) FinalizeBlobStoreEvacuation ¶ added in v0.12.0
func (s *Store) FinalizeBlobStoreEvacuation( ctx context.Context, operationID, sourceID, destinationID string, ) (BlobStoreEvacuationFinalization, error)
FinalizeBlobStoreEvacuation atomically proves complete destination coverage and revokes every source location. A source remains draining while durable physical cleanup is pending, then a repeated call detaches it.
func (*Store) FinishStorageOperation ¶ added in v0.12.0
func (*Store) HasPrimaryLooseAuthority ¶ added in v0.12.0
HasPrimaryLooseAuthority reports whether the built-in primary catalog still authorizes a canonical loose representation for hash. Physical scans use this narrower question so redundant files left by packing, placement, or a remote-only restore can be reclaimed without deleting logical membership.
func (*Store) ImportMetadata ¶
ImportMetadata replaces the pristine root in a newly created store with a logical JSONL snapshot. It refuses a store containing user or pack state.
func (*Store) Info ¶ added in v0.10.1
Info returns a point-in-time logical inventory without changing the vault.
func (*Store) IngestFile ¶
func (s *Store) IngestFile(ctx context.Context, run IngestRun, parentID int64, name, blobHash string, size int64, mimeType, originalPath, originalMtime string, physical ...BlobPhysical) (Node, bool, error)
IngestFile imports one already-durable blob as a node under parentID, applying the idempotency rule and recording provenance. Returns added=false when the content is already present under a candidate name.
func (*Store) IngestFileExact ¶
func (s *Store) IngestFileExact(ctx context.Context, run IngestRun, parentID int64, name, blobHash string, size int64, mimeType, originalPath, originalMtime string, physical ...BlobPhysical) (Node, error)
IngestFileExact imports one already-durable blob under exactly name. Unlike bulk migration it never suffixes or adopts an existing same-content node; a watched source needs its configured source identity to remain one-to-one.
func (*Store) IngestFileExactWithReceipt ¶ added in v0.11.0
func (s *Store) IngestFileExactWithReceipt( ctx context.Context, run IngestRun, parentID int64, name, blobHash string, size int64, mimeType, originalPath, originalMtime string, physical ...BlobPhysical, ) (ContentWriteReceipt, error)
IngestFileExactWithReceipt is the receipt-bearing form used by embedded immutable creation. File, version, provenance, ingest, and physical catalog authority commit in one metadata transaction.
func (*Store) LiveTaggedNodes ¶ added in v0.12.0
func (s *Store) LiveTaggedNodes( ctx context.Context, tagID string, limit, offset int, ) ([]TaggedNode, int, int, error)
LiveTaggedNodes lists one ID-sorted page of live nodes carrying tagID. The omitted count covers trashed assignments in the same read snapshot.
func (*Store) LooseBacklog ¶ added in v0.10.0
func (s *Store) LooseBacklog(ctx context.Context) (LooseBacklog, error)
LooseBacklog returns indexed packing work without walking blob directories.
func (*Store) MkdirPath ¶ added in v0.11.0
MkdirPath resolves the parent and creates one directory in the same transaction. This is the path-coordinate form for callers whose intent is tied to an exact virtual location rather than a previously resolved parent identity.
func (*Store) MkdirWithPath ¶ added in v0.11.0
func (s *Store) MkdirWithPath( ctx context.Context, parentID int64, name string, ) (Node, string, error)
MkdirWithPath creates a directory under a stable parent identity and returns the new node's canonical path from the same mutation transaction.
func (*Store) Move ¶
func (s *Store) Move( ctx context.Context, id, newParentID int64, newName string, ifRev int64, ) (Node, string, error)
Move renames and/or reparents a live node in one transaction. Unless ifRev is UnconditionalRev, the mutation fails with ErrStaleRevision unless ifRev matches the node's current revision. The returned canonical path is captured in the mutation transaction with the returned node.
func (*Store) MovePath ¶
MovePath resolves srcPath and destPath and moves inside one transaction, so a concurrent operation cannot relocate either path between resolution and mutation. A destPath naming an existing live directory means "move into, keep name"; otherwise its parent must exist and its basename becomes the new name. The returned canonical path is captured in the mutation transaction with the returned node.
func (*Store) MovePathRevision ¶ added in v0.10.0
func (s *Store) MovePathRevision( ctx context.Context, srcPath, destPath string, ifRev int64, ) (Node, string, error)
MovePathRevision is MovePath with an exact optional revision precondition.
func (*Store) MoveToPath ¶ added in v0.10.0
func (s *Store) MoveToPath( ctx context.Context, id, ifRev int64, destPath string, ) (Node, string, error)
MoveToPath moves the stable live node id to destPath while resolving the destination and enforcing ifRev in one transaction. Unlike MovePath, source identity is unaffected by concurrent ancestor moves.
func (*Store) NodeByPath ¶
NodeByPath walks live nodes from the root along the given /-separated path.
func (*Store) NodeProvenance ¶ added in v0.11.0
func (s *Store) NodeProvenance( ctx context.Context, nodeID int64, limit, offset int, ) (NodeProvenancePage, error)
NodeProvenance returns immutable origin facts for one file node. The node, live path, count, and page come from one read snapshot so the response cannot combine provenance with a later move or trash operation.
func (*Store) NodeViewByID ¶ added in v0.11.0
NodeViewByID returns a node and its live path from one read transaction.
func (*Store) NodeViewByPath ¶ added in v0.11.0
NodeViewByPath resolves a live path and returns its node and canonical path from one read transaction.
func (*Store) PackedBlobStoredByte ¶ added in v0.10.0
PackedBlobStoredByte reports one blob's immutable-pack payload length.
func (*Store) PackedBlobStoredBytes ¶
PackedBlobStoredBytes returns the physical stored length of every cataloged packed blob. GC uses it to distinguish bytes unlinked immediately from dead immutable-pack space that requires a later repack.
func (*Store) PendingTextExtractions ¶
func (s *Store) PendingTextExtractions( ctx context.Context, limit int, ) ([]ExtractionCandidate, error)
PendingTextExtractions returns a bounded hash-ordered batch from the derived work queue. Logical writes and one startup seed of selected versions fill the queue, so steady-state polling never scans the version catalog.
func (*Store) PhysicalContent ¶ added in v0.10.0
PhysicalContent returns the indexed representation with current catalog authority for hash.
func (*Store) PlanPlacement ¶ added in v0.12.0
func (s *Store) PlanPlacement( ctx context.Context, request PlacementRequest, ) (PlacementPlan, error)
func (*Store) PlanStorageRecovery ¶ added in v0.12.0
func (*Store) PrepareSecondaryBlobStore ¶ added in v0.12.0
PrepareSecondaryBlobStore allocates the stable identity and ownership epoch that must be published to the physical namespace before RegisterBlobStore grants catalog authority.
func (*Store) PrepareStorageOperationCleanup ¶ added in v0.12.0
func (s *Store) PrepareStorageOperationCleanup( ctx context.Context, operationID string, item StorageOperationCleanup, ) (bool, error)
PrepareStorageOperationCleanup determines whether a retired physical object is still safe to remove. If the exact object has become authoritative again, it atomically consumes the stale cleanup item and returns false.
func (*Store) PreviewInitialAudit ¶
func (s *Store) PreviewInitialAudit( ctx context.Context, targetNodeID int64, origin string, agentLabel *string, ) (*AuditEnrollmentPlan, error)
PreviewInitialAudit derives the exact next permanent scope without writing it. The first scope creates vault authority; later scopes must be disjoint.
func (*Store) PreviewInitialAuditPath ¶
func (s *Store) PreviewInitialAuditPath( ctx context.Context, path, origin string, agentLabel *string, ) (*AuditEnrollmentPlan, error)
PreviewInitialAuditPath resolves a live path and derives its exact enrollment boundary in the same database snapshot.
func (*Store) PrimaryBlobStore ¶ added in v0.12.0
PrimaryBlobStore returns the fixed local filesystem store.
func (*Store) PrimaryBlobStoreID ¶ added in v0.12.0
PrimaryBlobStoreID returns the stable catalog identity of the built-in filesystem store.
func (*Store) PruneContentVersions ¶
func (s *Store) PruneContentVersions( ctx context.Context, nodeID, ifRev int64, selector VersionPruneSelector, run bool, ) (VersionPruneResult, error)
PruneContentVersions previews or removes selected non-current history under an optimistic node revision. A run that changes history advances the node revision once. Revert-source dependencies remain retained unless AllPrior creates a new source-free checkpoint head in the same transaction.
func (*Store) PruneExpiredStorageOperations ¶ added in v0.12.0
PruneExpiredStorageOperations removes terminal operation receipts after their retention boundary while preserving every operation that still owns pending physical cleanup.
func (*Store) RecordExtraction ¶
func (s *Store) RecordExtraction(ctx context.Context, result ExtractionResult) error
RecordExtraction atomically replaces one extractor's derived result and its searchable projection. It never changes document, version, or audit state.
func (*Store) RegisterBlobStore ¶ added in v0.12.0
RegisterBlobStore records a namespace only after its ownership marker has been durably published and independently read back by the caller.
func (*Store) RenameTag ¶
RenameTag changes a tag's display name under an optimistic tag revision and advances every assigned node's metadata revision. Repeating the current name is an idempotent no-op only when ifRev still matches.
func (*Store) RepairBlobAuthority ¶ added in v0.10.0
func (s *Store) RepairBlobAuthority( ctx context.Context, hash string, size int64, physical BlobPhysical, ) (int64, error)
RepairBlobAuthority atomically makes one already-verified loose receipt the physical authority for an existing blob. Logical membership, nodes, content versions, and immutable pack bytes are preserved; only the packed mapping is retired so maintenance can reclaim its dead bytes later.
func (*Store) ReplaceContent ¶
func (s *Store) ReplaceContent( ctx context.Context, nodeID, ifRev int64, blobHash string, size int64, mimeType string, physical ...BlobPhysical, ) (Node, ContentVersion, error)
ReplaceContent installs one already-durable blob as a file's new immutable head. Unless ifRev is UnconditionalRev, the node must still be at ifRev; version creation, pointer replacement, and the node revision bump commit as one transaction.
func (*Store) ReplaceContentWithReceipt ¶ added in v0.10.0
func (s *Store) ReplaceContentWithReceipt( ctx context.Context, nodeID, ifRev int64, blobHash string, size int64, mimeType string, physical ...BlobPhysical, ) (ContentWriteReceipt, error)
ReplaceContentWithReceipt installs a new immutable head and returns its complete authority from the committing transaction.
func (*Store) RequestStorageOperationCancel ¶ added in v0.12.0
func (*Store) ResolveBlobLocations ¶ added in v0.12.0
func (s *Store) ResolveBlobLocations( ctx context.Context, hash packstore.Hash, ) (packstore.Resolution, error)
ResolveBlobLocations returns the application-authorized read candidates for hash. Task 5 exposes only the built-in primary; later placement work adds secondaries and policy ordering without changing Kit's read path.
func (*Store) Restore ¶
Restore returns a trash root to its original location (or the tree root if that location is gone), re-suffixing on conflict. Descendants trashed in earlier separate operations stay trashed. Unless ifRev is UnconditionalRev, the mutation fails with ErrStaleRevision unless ifRev matches the node's current revision. The returned canonical path is captured in the restore transaction with the returned node.
func (*Store) ResumableStorageOperations ¶ added in v0.12.0
func (s *Store) ResumableStorageOperations(ctx context.Context) ([]StorageOperation, error)
func (*Store) RetireRestoredPrimary ¶ added in v0.12.0
func (s *Store) RetireRestoredPrimary( ctx context.Context, hash string, allowAuditedRemoteOnly bool, ) (retired bool, err error)
RetireRestoredPrimary revokes temporary local catalog authority only after a verified secondary is authoritative. The physical file remains until the restored database is published and ordinary garbage collection removes it. Audited bytes remain primary-pinned unless the restore mapping explicitly acknowledges remote-only retention.
func (*Store) RevertContent ¶
func (s *Store) RevertContent( ctx context.Context, nodeID, ifRev int64, sourceVersionID string, ) (Node, ContentVersion, ContentVersion, error)
RevertContent creates a new immutable head with the exact content authority and media type of sourceVersionID. It records the source identity rather than rewinding the node or changing any historical row.
func (*Store) SQLiteDriver ¶
SQLiteDriver returns the exact adapter used by this store. Backup snapshots and embedded lifecycle helpers reuse it for every auxiliary connection.
func (*Store) SearchPage ¶
SearchPage returns live name matches in their established order, followed by content-only matches. Keeping the two ranks separate preserves the deterministic name-search contract: enabling extraction never reorders or hides a filename match that the same limit returned before.
func (*Store) SearchPageWithOptions ¶ added in v0.11.0
func (s *Store) SearchPageWithOptions( ctx context.Context, query string, limit int, opts SearchOptions, ) ([]SearchHit, bool, error)
SearchPageWithOptions returns ranked live matches that satisfy every requested filter. Filters apply equally to name and content candidates.
func (*Store) SeedTextExtractionQueue ¶
func (s *Store) SeedTextExtractionQueue( ctx context.Context, extractor string, version int64, ) error
SeedTextExtractionQueue discovers supported selected content once at daemon startup. Discovery and projection writes share one storage transaction, so a concurrent deletion cannot invalidate a selected version between those steps. Later logical writes enqueue in Go while existing vaults converge here.
func (*Store) SparseRepackPage ¶ added in v0.10.0
func (s *Store) SparseRepackPage( ctx context.Context, after string, limit int, now time.Time, minAge time.Duration, minDeadBytes int64, ) ([]RepackCandidate, bool, error)
SparseRepackPage returns eligible non-empty sparse packs ordered by their unique lowest live canonical blob hash.
func (*Store) SparseRepackScanPage ¶ added in v0.10.0
func (s *Store) SparseRepackScanPage( ctx context.Context, afterHash string, afterPackID string, limit int, now time.Time, minAge time.Duration, minDeadBytes int64, ) (RepackScanPage, error)
SparseRepackScanPage examines at most limit persisted pack summaries. Packs that do not satisfy the caller's thresholds still consume the finite scan budget, so selection work is independent of total catalog cardinality.
func (*Store) StorageOperation ¶ added in v0.12.0
func (*Store) StorageOperationCleanups ¶ added in v0.12.0
func (*Store) StorageOperations ¶ added in v0.12.0
func (*Store) SyncWatchedContent ¶
func (s *Store) SyncWatchedContent( ctx context.Context, watchName, sourceRef, blobHash string, size int64, mimeType string, physical ...BlobPhysical, ) (Node, ContentVersion, bool, error)
SyncWatchedContent resolves a watched source's stable node and compares the incoming bytes with the last bytes accepted from that source. The source cursor is deliberately independent of the node's selected version: a manual edit or revert must survive daemon restart when the source did not change.
func (*Store) TaggedNodes ¶
func (s *Store) TaggedNodes(ctx context.Context, tagID string, limit, offset int) ([]TaggedNode, int, error)
TaggedNodes lists one ID-sorted page of nodes carrying tagID.
func (*Store) Trash ¶
Trash soft-deletes a live node and its live subtree as a unit. All subtree rows share one trashed_at stamp; only the top node records its original location for restore. Unless ifRev is UnconditionalRev, the mutation fails with ErrStaleRevision unless ifRev matches the node's current revision. Returns the node as it stands after trashing, plus its pre-trash path — computed inside the same transaction, because trashing re-parents the node (making the path uncomputable afterwards) and a concurrent ancestor move could stale a path captured beforehand.
func (*Store) TrashEmpty ¶
func (s *Store) TrashEmpty(ctx context.Context, olderThan time.Duration, run bool) (TrashEmptyResult, error)
TrashEmpty reports trash roots older than the cutoff and, when run is true, hard-deletes them. A zero age selects every trash root, including any with a future timestamp caused by clock skew. Subtrees follow via ON DELETE CASCADE.
func (*Store) TrashEmptyBounded ¶ added in v0.10.0
func (s *Store) TrashEmptyBounded( ctx context.Context, olderThan time.Duration, maxRoots int, run bool, ) (TrashEmptyResult, error)
TrashEmptyBounded reports or deletes at most maxRoots eligible trash roots. More reports whether another eligible root existed beyond this batch.
func (*Store) TrashPath ¶
TrashPath resolves path and trashes the node inside one transaction, so a concurrent move cannot relocate the node or an ancestor between resolution and mutation. Returns the node that was trashed and its canonical pre-trash path (see Trash).
func (*Store) TrashPathRevision ¶ added in v0.10.0
func (s *Store) TrashPathRevision( ctx context.Context, path string, ifRev int64, ) (Node, string, error)
TrashPathRevision is TrashPath with an exact optional revision precondition.
func (*Store) TrashedRoots ¶
TrashedRoots lists restorable trash roots, newest first.
func (*Store) TrashedRootsPage ¶ added in v0.12.0
TrashedRootsPage lists one bounded newest-first page of restorable trash roots and the complete root count from the same read snapshot.
func (*Store) UnassignTag ¶
func (s *Store) UnassignTag( ctx context.Context, tagID string, nodeID, ifRev int64, ) (TagAssignmentChange, error)
UnassignTag removes a tag from a node under an optimistic revision check. Repeating an absent assignment is an idempotent no-op only when ifRev still matches the current node revision.
func (*Store) UnassignTagPath ¶
func (s *Store) UnassignTagPath( ctx context.Context, tagID, path string, ) (TagAssignmentChange, error)
UnassignTagPath resolves a live path and removes a tag in the same transaction.
func (*Store) UnreachableBlobs ¶
UnreachableBlobs lists blobs referenced by no content version. Every current file head is itself a content version, as are retained prior versions. These are the gc candidates. Callers that go on to delete blob files must serialize against concurrent writers (the daemon's maintenance gate does this): with writers running, a concurrent ingest can dedup against a candidate's file between this query and the deletion, leaving a live node pointing at a removed blob.
func (*Store) UnreachableBlobsPageFrom ¶ added in v0.10.0
func (s *Store) UnreachableBlobsPageFrom( ctx context.Context, after *string, limit int, ) (GCCandidateScanPage, error)
UnreachableBlobsPageFrom distinguishes the beginning of an ordering from an arbitrary stored key, including the empty string. It examines a bounded raw key window before filtering for unreachable work.
func (*Store) UnreferencedPackMappingsPage ¶ added in v0.10.0
func (s *Store) UnreferencedPackMappingsPage( ctx context.Context, after *string, limit int, ) (StringScanPage, error)
UnreferencedPackMappingsPage returns one canonical-hash keyset page of pack mappings whose blob authority has been revoked.
func (*Store) UnregisterBlobStore ¶ added in v0.12.0
UnregisterBlobStore removes an already detached, empty secondary identity.
func (*Store) ValidateMetadata ¶
ValidateMetadata verifies the current relational metadata and, when audit authority exists, independently replays its canonical history against the current projection. It exercises the same deterministic stream boundary as backup without publishing that stream or mutating the vault.
func (*Store) VaultID ¶
VaultID returns the stable logical identity preserved by metadata export, backup, and restore. Moving or restoring a vault does not change it.
func (*Store) VerifyAudit ¶
func (s *Store) VerifyAudit( ctx context.Context, expected *AuditEvidence, ) (result AuditVerification, err error)
VerifyAudit independently replays canonical audit history against the current projections and returns externally recordable terminal evidence. Blob bytes are verified by the daemon through physical catalog authority after this metadata snapshot succeeds.
type StringScanPage ¶ added in v0.10.0
StringScanPage reports bounded raw key progress for a filtered string inventory such as unreferenced packed mappings.
type Tag ¶
Tag is one stable organization label. Name is mutable; ID is permanent and never reused. AssignmentCount is the current number of tagged nodes.
type TagAssignmentChange ¶
TagAssignmentChange is the transactionally consistent result of assigning or unassigning one tag. Path is populated only while Node is live.
type TaggedNode ¶
TaggedNode is one node carrying a tag plus its resolvable live path. Trashed nodes have an empty path.
type TrashEmptyResult ¶
TrashEmptyResult reports one trash-empty dry run or execution.
type VaultInfo ¶ added in v0.10.1
type VaultInfo struct {
VaultID string
LiveFiles int64
LiveDirectories int64
TrashedNodes int64
ContentVersions int64
LogicalVersionBytes int64
TrackedBlobs int64
TrackedBlobBytes int64
}
VaultInfo summarizes the logical authority held by a vault. Physical loose and packed storage is reported separately by the blob store.
type VersionPruneResult ¶
type VersionPruneResult struct {
Node Node
Candidates []ContentVersion
DependencyRetained []ContentVersion
Checkpoint *ContentVersion
Cutoff string
LogicalBytes int64
UniqueBlobs int
ReleasableBlobs int
ReleasableBytes int64
LooseBlobsPendingGC int
LooseBytesPendingGC int64
PackedBlobsPendingRepack int
PackedBytesPendingRepack int64
MixedBlobsPendingMaintenance int
DeletedVersions int
CheckpointRequired bool
Changed bool
Run bool
}
VersionPruneResult is the complete dry-run inventory or execution receipt. LogicalBytes counts version references and may count a deduplicated blob more than once. ReleasableBytes counts unique blobs that become eligible for a later GC; pruning itself never reports physical bytes as reclaimed. Loose and packed maintenance counts may overlap when one blob has both location kinds across stores; MixedBlobsPendingMaintenance names that intersection.
type VersionPruneSelector ¶
type VersionPruneSelector struct {
VersionIDs []string
KeepNewest int
OlderThan time.Duration
AllPrior bool
}
VersionPruneSelector chooses historical content versions. Exactly one mode must be set. The current head is never removable; AllPrior may replace a current revert with a same-byte checkpoint so its complete source graph can be released.
type WalkEntry ¶ added in v0.10.0
WalkEntry is one node and its canonical path in a pinned tree snapshot.
type WalkStats ¶ added in v0.10.0
type WalkStats struct {
SetupNodeReads int64
Pages int64
EntriesReturned int64
LastPageRowsExamined int64
LastPageIndexedSeeks int64
}
WalkStats exposes deterministic traversal work without exposing the TEMP frontier implementation. RowsExamined counts frontier rows returned for the last page; each returned row performs at most two indexed sibling range seeks and, for a directory, one indexed first-child seek.
type Walker ¶ added in v0.10.0
type Walker struct {
// contains filtered or unexported fields
}
Walker pages through one tree snapshot held by a dedicated read transaction.
func (*Walker) Close ¶ added in v0.10.0
Close releases the snapshot transaction and its dedicated connection.
func (*Walker) Next ¶ added in v0.10.0
Next returns the next bounded page in canonical path then node-ID order. The frontier contains only the next candidate from each explored sibling iterator. Expanding one returned node performs at most two next-sibling range seeks and, for a directory, one first-child seek. Live-only seeks use the partial live_sibling_names index; include-trash seeks use nodes_parent_name_id.
Source Files
¶
- audit_baseline_projection.go
- audit_batch_move.go
- audit_content_replace.go
- audit_enrollment.go
- audit_history.go
- audit_history_validate.go
- audit_ingest.go
- audit_ingest_validate.go
- audit_initial_validate.go
- audit_metadata.go
- audit_node_create.go
- audit_node_create_validate.go
- audit_node_move.go
- audit_node_move_validate.go
- audit_node_restore.go
- audit_node_restore_validate.go
- audit_node_trash.go
- audit_node_trash_validate.go
- audit_projection.go
- audit_public.go
- audit_tag_assignment.go
- audit_tag_assignment_validate.go
- audit_tag_definition.go
- audit_tag_definition_validate.go
- audit_tag_delete.go
- audit_tag_delete_validate.go
- audit_tag_rename.go
- audit_topology_mutation.go
- audit_verify.go
- batch_move.go
- blob_locations.go
- blob_stores.go
- content_reference.go
- default_driver_cgo.go
- errors.go
- extraction.go
- gc.go
- identity.go
- info.go
- ingest.go
- metadata.go
- names.go
- node.go
- pack_catalog.go
- physical_storage.go
- placement.go
- provenance.go
- provenance_public.go
- search.go
- storage_operations.go
- storage_recovery.go
- store.go
- store_registry.go
- tag.go
- trash.go
- upgrade.go
- version.go
- version_prune.go
- walk.go
- write.go