Skip to main content

AdminService

Struct AdminService 

Source
pub struct AdminService { /* private fields */ }
Expand description

Service providing administrative operations (integrity checks, exports, restores, purges).

Implementations§

Source§

impl AdminService

Source

pub fn new(path: impl AsRef<Path>, schema_manager: Arc<SchemaManager>) -> Self

Create a new admin service for the database at the given path.

Source

pub fn new_with_rebuild( path: impl AsRef<Path>, schema_manager: Arc<SchemaManager>, rebuild_sender: SyncSender<RebuildRequest>, ) -> Self

Create a new admin service wired to the background rebuild actor.

Source

pub fn set_fts_profile( &self, kind: &str, tokenizer_str: &str, ) -> Result<FtsProfile, EngineError>

Persist or update the FTS tokenizer profile for a node kind.

tokenizer_str may be a preset name (see [TOKENIZER_PRESETS]) or a raw FTS5 tokenizer string. The resolved string is validated before being written to projection_profiles.

§Errors

Returns EngineError if the tokenizer string contains disallowed characters, or if the database write fails.

Source

pub fn get_fts_profile( &self, kind: &str, ) -> Result<Option<FtsProfile>, EngineError>

Retrieve the FTS tokenizer profile for a node kind.

Returns None if no profile has been set for kind.

§Errors

Returns EngineError if the database query fails.

Source

pub fn get_vec_profile(&self) -> Result<Option<VecProfile>, EngineError>

Retrieve the global vector embedding profile.

Returns None if no vector profile has been persisted yet.

§Errors

Returns EngineError if the database query fails.

Source

pub fn set_vec_profile( &self, config_json: &str, ) -> Result<VecProfile, EngineError>

Persist or update the global vector profile from a JSON config string.

config_json must be valid JSON with at least a model_identity field and dimensions. The JSON is stored verbatim in the projection_profiles table under kind='*', facet='vec'.

§Errors

Returns EngineError if the database write fails.

Source

pub fn preview_projection_impact( &self, kind: &str, facet: &str, ) -> Result<ProjectionImpact, EngineError>

Estimate the cost of rebuilding a projection.

For facet "fts": counts active nodes of kind. For facet "vec": counts all chunks.

§Errors

Returns EngineError for unknown facets or database errors.

Source

pub fn check_integrity(&self) -> Result<IntegrityReport, EngineError>

§Errors

Returns EngineError if the database connection fails or any SQL query fails.

Source

pub fn check_semantics(&self) -> Result<SemanticReport, EngineError>

§Errors

Returns EngineError if the database connection fails or any SQL query fails.

Source

pub fn register_operational_collection( &self, request: &OperationalRegisterRequest, ) -> Result<OperationalCollectionRecord, EngineError>

§Errors

Returns EngineError if the collection metadata is invalid or the insert fails.

Source

pub fn describe_operational_collection( &self, name: &str, ) -> Result<Option<OperationalCollectionRecord>, EngineError>

§Errors

Returns EngineError if the database query fails.

Source

pub fn update_operational_collection_filters( &self, name: &str, filter_fields_json: &str, ) -> Result<OperationalCollectionRecord, EngineError>

§Errors

Returns EngineError if the collection is missing, the filter contract is invalid, or existing mutation backfill fails.

Source

pub fn update_operational_collection_validation( &self, name: &str, validation_json: &str, ) -> Result<OperationalCollectionRecord, EngineError>

§Errors

Returns EngineError if the collection is missing or the validation contract is invalid.

Source

pub fn update_operational_collection_secondary_indexes( &self, name: &str, secondary_indexes_json: &str, ) -> Result<OperationalCollectionRecord, EngineError>

§Errors

Returns EngineError if the collection is missing, the contract is invalid, or derived index rebuild fails.

Source

pub fn rebuild_operational_secondary_indexes( &self, name: &str, ) -> Result<OperationalSecondaryIndexRebuildReport, EngineError>

§Errors

Returns EngineError if the collection is missing or rebuild fails.

Source

pub fn validate_operational_collection_history( &self, name: &str, ) -> Result<OperationalHistoryValidationReport, EngineError>

§Errors

Returns EngineError if the collection is missing or its validation contract is invalid.

Source

pub fn disable_operational_collection( &self, name: &str, ) -> Result<OperationalCollectionRecord, EngineError>

§Errors

Returns EngineError if the database query fails.

Source

pub fn compact_operational_collection( &self, name: &str, dry_run: bool, ) -> Result<OperationalCompactionReport, EngineError>

§Errors

Returns EngineError if the database query fails.

Source

pub fn purge_operational_collection( &self, name: &str, before_timestamp: i64, ) -> Result<OperationalPurgeReport, EngineError>

§Errors

Returns EngineError if the database query fails.

Source

pub fn plan_operational_retention( &self, now_timestamp: i64, collection_names: Option<&[String]>, max_collections: Option<usize>, ) -> Result<OperationalRetentionPlanReport, EngineError>

§Errors

Returns EngineError if collection selection or policy parsing fails.

Source

pub fn run_operational_retention( &self, now_timestamp: i64, collection_names: Option<&[String]>, max_collections: Option<usize>, dry_run: bool, ) -> Result<OperationalRetentionRunReport, EngineError>

§Errors

Returns EngineError if collection selection, policy parsing, or execution fails.

Source

pub fn trace_operational_collection( &self, collection_name: &str, record_key: Option<&str>, ) -> Result<OperationalTraceReport, EngineError>

§Errors

Returns EngineError if the database query fails.

Source

pub fn read_operational_collection( &self, request: &OperationalReadRequest, ) -> Result<OperationalReadReport, EngineError>

§Errors

Returns EngineError if the collection contract is invalid or the filtered read fails.

Source

pub fn rebuild_operational_current( &self, collection_name: Option<&str>, ) -> Result<OperationalRepairReport, EngineError>

§Errors

Returns EngineError if the database query fails or collection validation fails.

Source

pub fn rebuild_projections( &self, target: ProjectionTarget, ) -> Result<ProjectionRepairReport, EngineError>

§Errors

Returns EngineError if the database connection fails or the projection rebuild fails.

Source

pub fn rebuild_missing_projections( &self, ) -> Result<ProjectionRepairReport, EngineError>

§Errors

Returns EngineError if the database connection fails or the projection rebuild fails.

Source

pub fn register_fts_property_schema( &self, kind: &str, property_paths: &[String], separator: Option<&str>, ) -> Result<FtsPropertySchemaRecord, EngineError>

Register (or update) an FTS property projection schema for the given node kind.

After registration, any node of this kind will have the declared JSON property paths extracted, concatenated, and indexed in the per-kind fts_props_<kind> FTS5 table.

§Errors

Returns EngineError if property_paths is empty, contains duplicates, or if the database write fails.

Source

pub fn register_fts_property_schema_with_entries( &self, kind: &str, entries: &[FtsPropertyPathSpec], separator: Option<&str>, exclude_paths: &[String], mode: RebuildMode, ) -> Result<FtsPropertySchemaRecord, EngineError>

Register (or update) an FTS property projection schema with per-path modes and optional exclude paths.

Under RebuildMode::Eager (the legacy mode), the full rebuild runs inside the registration transaction — same behavior as before Pack 7.

Under RebuildMode::Async (the 0.4.1 default), the schema row is persisted in a short IMMEDIATE transaction, a rebuild-state row is upserted, and the actual rebuild is handed off to the background RebuildActor. The register call returns in <100ms even for large kinds.

§Errors

Returns EngineError if the paths are invalid, the JSON serialization fails, or the (schema-persist / rebuild) transaction fails.

Source

pub fn get_property_fts_rebuild_state( &self, kind: &str, ) -> Result<Option<RebuildStateRow>, EngineError>

Return the rebuild state row for a kind, if one exists.

§Errors

Returns EngineError if the database query fails.

Source

pub fn count_staging_rows(&self, kind: &str) -> Result<i64, EngineError>

Return the count of rows in fts_property_rebuild_staging for a kind. Used by tests to verify the staging table was populated.

§Errors

Returns EngineError if the database query fails.

Source

pub fn staging_row_exists( &self, kind: &str, node_logical_id: &str, ) -> Result<bool, EngineError>

Return whether a specific node is present in fts_property_rebuild_staging. Used by tests to verify the double-write path.

§Errors

Returns EngineError if the database query fails.

Source

pub fn describe_fts_property_schema( &self, kind: &str, ) -> Result<Option<FtsPropertySchemaRecord>, EngineError>

Return the FTS property schema for a single node kind, if registered.

§Errors

Returns EngineError if the database query fails.

Source

pub fn list_fts_property_schemas( &self, ) -> Result<Vec<FtsPropertySchemaRecord>, EngineError>

Return all registered FTS property schemas.

§Errors

Returns EngineError if the database query fails.

Source

pub fn remove_fts_property_schema(&self, kind: &str) -> Result<(), EngineError>

Remove the FTS property schema for a node kind.

This does not delete existing FTS rows for this kind; call rebuild_projections(Fts) to clean up stale rows.

§Errors

Returns EngineError if the kind is not registered or the delete fails.

Source

pub fn restore_vector_profiles( &self, ) -> Result<ProjectionRepairReport, EngineError>

Recreate enabled vector profiles from persisted vector_profiles metadata.

§Errors

Returns EngineError if the database connection fails, reading metadata fails, or sqlite-vec support is unavailable while enabled profiles are present.

Source

pub fn regenerate_vector_embeddings( &self, embedder: &dyn QueryEmbedder, config: &VectorRegenerationConfig, ) -> Result<VectorRegenerationReport, EngineError>

Rebuild vector embeddings using an application-supplied regeneration contract and generator command.

The config is persisted in vector_embedding_contracts so the metadata required for recovery survives future repair runs.

Vector identity is stamped from QueryEmbedder::identity — the caller supplies the embedder and cannot override its identity. This makes drift between the read-path and write-path identity stories structurally impossible.

§Errors

Returns EngineError if the database connection fails, the config is invalid, the embedder fails, or the regenerated embeddings are malformed.

Source

pub fn trace_source(&self, source_ref: &str) -> Result<TraceReport, EngineError>

§Errors

Returns EngineError if the database connection fails or any SQL query fails.

Source

pub fn restore_logical_id( &self, logical_id: &str, ) -> Result<LogicalRestoreReport, EngineError>

§Errors

Returns EngineError if the database connection fails, the transaction cannot be started, or lifecycle restoration prerequisites are missing.

Source

pub fn purge_logical_id( &self, logical_id: &str, ) -> Result<LogicalPurgeReport, EngineError>

§Errors

Returns EngineError if the database connection fails, the transaction cannot be started, or the purge mutation fails.

Source

pub fn purge_provenance_events( &self, before_timestamp: i64, options: &ProvenancePurgeOptions, ) -> Result<ProvenancePurgeReport, EngineError>

Purge provenance events older than before_timestamp.

By default, excise and purge_logical_id event types are preserved so that data-deletion audit trails survive. Pass an explicit preserve_event_types list to override this default.

§Errors

Returns EngineError if the database connection fails, the transaction cannot be started, or any SQL statement fails.

Source

pub fn excise_source( &self, source_ref: &str, ) -> Result<TraceReport, EngineError>

§Errors

Returns EngineError if the database connection fails, the transaction cannot be started, or any SQL statement fails.

Source

pub fn safe_export( &self, destination_path: impl AsRef<Path>, options: SafeExportOptions, ) -> Result<SafeExportManifest, EngineError>

§Errors

Returns EngineError if the WAL checkpoint fails, the SQLite backup fails, the SHA-256 digest cannot be computed, or the manifest file cannot be written.

Trait Implementations§

Source§

impl Debug for AdminService

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V