Skip to content

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 -- SnapshotStorage trait with built-in LocalStorage backend
  • Async API -- tokio-based async snapshot creation and restore

Dependencies

Key internal dependencies:

  • spt-core -- vector collection access for snapshotting
  • flate2 -- gzip compression
  • sha2 -- SHA-256 integrity checksums
  • tokio -- async filesystem and I/O operations
  • uuid -- unique snapshot identifiers
  • chrono -- 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

TypeDescription
SnapshotManagerOrchestrates snapshot creation and restore operations
SnapshotA complete point-in-time snapshot
SnapshotMetadataTimestamp, UUID, and collection info for a snapshot
SnapshotDataThe vector records contained in a snapshot
VectorRecordA single vector entry within snapshot data
SnapshotStorageTrait for pluggable storage backends
LocalStorageFilesystem-based snapshot storage implementation
SnapshotErrorError type for snapshot operations

Released under the MIT License.