Architecture
Objects
Objects are files discovered on your devices and drives, but can also be virtual, existing only within Spacedrive.
All metadata associated with files in Spacedrive is linked to the Object for that file.
If two or more files are discovered that are identical, they are linked to the same Object in Spacedrive.
Some Objects are purely virtual, meaning they have no Path and are likely only used in a Space.
Content Addressable Storage (CAS) IDs
A CAS ID is a unique identifier generated from a file's content using the blake3 hashing algorithm. The ID generation is optimized for different file sizes:
- For small files (~100KB): The entire file content is hashed
- For large files: A sampling approach is used:
- First 8KB (header)
- Last 8KB (footer)
- 4 samples of 10KB each taken at regular intervals throughout the file
CAS IDs are used to:
- Link identical files to the same Object (deduplication)
- Track file changes
- Generate and cache thumbnails
Hash Validation
Spacedrive uses a full checksum to validate file integrity. This is used for file sync, overwrite protection, and other sensitive operations.
Types of object
Name | Description | Code |
---|---|---|
Unknown | A file that can not be identified by the indexer | 0 |
Document | A known filetype, but without specific support | 1 |
Folder | A virtual filesystem directory | 2 |
Text File | A file that contains human-readable text | 3 |
Package | A folder that opens an application | 4 |
Image | An image file | 5 |
Audio | An audio file | 6 |
Video | A video file | 7 |
Archive | A compressed archive of data | 8 |
Executable | An executable program or application | 9 |
Alias | A link to another Object | 10 |
Encrypted Bytes | Raw bytes with self contained metadata | 11 |
Link | A link to a web page, application or Space | 12 |
Web Page Archive | A snapshot of a webpage, with HTML, JS, images and screenshot | 13 |
Widget | A widget is a mini app that can be placed in a Space at various sizes, associated Widget struct required | 14 |
Album | Albums can only have one level of children, and are associated with the Album struct | 15 |
Collection | Its like a folder, but appears like a stack of files, designed for burst photos/associated groups of files | 16 |
Database | A database file | 17 |
Mesh | A 3D mesh object | 18 |
Textured Mesh | A 3D mesh object with textures | 19 |
Entity | A rigged character | 20 |