spt-snapshot
Point-in-time snapshots and backup for SPT vector databases
Overview
spt-snapshot provides backup and restore capabilities for SPT vector collections. It captures point-in-time snapshots with compression (flate2/gzip), SHA-256 checksums for integrity verification, and pluggable storage backends. The async API (via tokio) supports both local filesystem storage and extensible remote backends.
Key Features
- Point-in-time snapshots -- capture full collection state with metadata and timestamps
- Compression -- gzip compression via flate2 for compact snapshot storage
- Integrity verification -- SHA-256 checksums on all snapshot data
- Pluggable storage --
SnapshotStoragetrait with built-inLocalStoragebackend - Async API -- tokio-based async snapshot creation and restore
Dependencies
Key internal dependencies:
spt-core-- vector collection access for snapshottingflate2-- gzip compressionsha2-- SHA-256 integrity checksumstokio-- async filesystem and I/O operationsuuid-- unique snapshot identifierschrono-- snapshot timestamps
Usage
rust
use spt_snapshot::{SnapshotManager, LocalStorage};
let storage = LocalStorage::new("/backups");
let manager = SnapshotManager::new(storage);
// let snapshot = manager.create_snapshot(&collection).await?;
// manager.restore_snapshot(&snapshot_id, &mut collection).await?;API Reference
Core Types
| Type | Description |
|---|---|
SnapshotManager | Orchestrates snapshot creation and restore operations |
Snapshot | A complete point-in-time snapshot |
SnapshotMetadata | Timestamp, UUID, and collection info for a snapshot |
SnapshotData | The vector records contained in a snapshot |
VectorRecord | A single vector entry within snapshot data |
SnapshotStorage | Trait for pluggable storage backends |
LocalStorage | Filesystem-based snapshot storage implementation |
SnapshotError | Error type for snapshot operations |