repofile module contains lower-level data structures representing files stored in a rustic repository. These types are serialized to JSON (or binary for pack headers) and saved to the backend.
Overview
Repository files are the persistent representation of repository metadata and configuration. All types in this module implementSerialize and Deserialize, and are typically stored encrypted in the backend.
Core File Types
ConfigFile
The repository configuration file describes all repository-wide settings. Location:config in the repository root
Key Fields:
version: Repository version (1 or 2 supported)id: Unique repository identifierchunker_polynomial: Polynomial used for Rabin chunkingchunk_size: Average chunk size for content-defined chunkingcompression: Compression level (v2 only)treepack_size,datapack_size: Pack size parameters
KeyFile
Key files store repository access credentials using scrypt key derivation. Location:/keys/<ID> in the repository
Key Fields:
hostname,username: Creation metadatacreated: Key creation timestampkdf: Key derivation function (“scrypt”)n,r,p: scrypt parametersdata: Encrypted master keysalt: Random salt for scrypt
SnapshotFile
Snapshot metadata representing a backup at a point in time. Location:/snapshots/<ID> in the repository
Key Fields:
time: Snapshot timestamptree: Root tree blob IDpaths: List of backed-up pathshostname: Source hostnametags: Snapshot tags for filteringparent: Parent snapshot ID (for incremental backups)summary: Backup statistics
IndexFile
Index files map blob IDs to their location within pack files. Location:/index/<ID> in the repository
Key Fields:
packs: List of indexed packspacks_to_delete: Packs marked for deletion- Each pack contains:
id: Pack file IDblobs: List of blob locationstime: Pack creation/deletion timesize: Total pack size
PackFile
Pack files are binary containers storing multiple blobs. Structure:- Blob data (concatenated)
- Pack header (encrypted)
- Header length (4 bytes)
PackHeader: Decoded header with blob locationsHeaderEntry: Individual blob entry (compressed or uncompressed)
Serialization Format
All repository files (except pack headers) are serialized as JSON:- Type byte (0=Data, 1=Tree, 2=CompData, 3=CompTree)
- Length (u32 little-endian)
- Optional uncompressed length (u32)
- Blob ID (32 bytes)
When to Use These Types
You’ll interact with these types when:- Initializing repositories: Create
ConfigFile - Managing credentials: Generate/read
KeyFile - Accessing snapshots: List and filter
SnapshotFile - Rebuilding index: Reconstruct
IndexFile - Low-level operations: Read
PackFileheaders
Related Types
StringList: Sorted set of strings (tags, paths)PathList: List of file system pathsDeleteOption: Snapshot deletion policiesSnapshotSummary: Backup statistics
See Also
- Repository - High-level repository operations
- Blob Types - Blob storage and retrieval
- Index - Index management