Skip to main content

Module handlers_ops

Module handlers_ops 

Source
Expand description

Operations endpoints. Operations endpoints: maintenance, enrichment, documents, backups, database management, readiness.

Per database (mounted under /v1 and /v1/db/{db}):

  • POST /maintenance/decay, /maintenance/archive, /maintenance/consolidate, /maintenance/sweep: the rule based upkeep jobs, on demand.
  • POST /enrich: the LLM enrichment pipeline (extraction, entity linking, communities, user model).
  • POST /documents, DELETE /documents/{document_id}: load a long text as overlapping chunks, and forget it again.
  • POST /backup, GET /backups (admin): snapshot the database into a single backup file and list those snapshots.

Global:

  • GET/POST /v1/databases, DELETE /v1/databases/{name} (admin).
  • GET /v1/ready: readiness, separate from /v1/health liveness.

There is deliberately no restore endpoint: replacing the files of a live, open database is unsafe. Restore is offline: stop the server, then call mentedb::storage::backup::BackupManager::restore_backup(file, dir) with an empty target directory (the data directory root for the default database, <data>/dbs/<name> for a named one) and start the server again.

Structs§

AdminGuard
Admits only admins: a token with the admin claim, or the configured admin key in x-api-key / Authorization: Bearer. Listed before Db in a handler so a refused request never opens or creates a database.
DocumentConfig
How documents are split into chunks.
MaintenanceGuard
Admits a database maintenance call (drop, backup) on the database in the path: the admin key, an admin token, or a token with the maintenance scope naming that database.
OpsConfig
Settings for the operations endpoints.
ReadinessConfig
How /v1/ready probes its dependencies.

Functions§

backup_file_name
Check a caller chosen backup name and give the file name to write: a relative path of segments made of letters, digits, -, _ and ., separated by /, with no empty, . or .. segment and no leading /. The backup extension is appended when missing. The file lands under <backup dir>/<database>/.
chunk_text
Split text into chunks of at most chunk_chars characters. Paragraphs (separated by blank lines) are kept whole when they fit; longer ones are split on sentence boundaries, and sentences longer than a chunk on word boundaries. Each chunk after the first starts with up to overlap_chars characters from the end of the previous one, cut at a word boundary.
global_routes
Routes outside any one database (database management, readiness).
ops_config
The operations settings, read from the environment once.
routes
Routes on one database, mounted under /v1 and /v1/db/{db}.