-
Notifications
You must be signed in to change notification settings - Fork 25
GET
Nilay Nath Sharan edited this page Sep 19, 2025
·
2 revisions
flowchart TD
Start([sietch get file destination]) --> ParseArgs[Parse Arguments & Flags force and skip-decryption]
ParseArgs --> FindVault{Find Vault Root}
FindVault -->|Not Found| VaultError[β Error: Not in vault]
FindVault -->|Found| LoadConfig[Load Vault Configuration]
LoadConfig --> FindManifest[π Search for File Manifest]
FindManifest --> CreateManager[Create Vault Manager]
CreateManager --> GetManifests[Get All File Manifests]
GetManifests --> SearchLoop[Search with Multiple Strategies: Exact path, FilePath, Basename, Full path basename]
SearchLoop --> ManifestFound{Manifest Found?}
ManifestFound -->|No| NotFoundError[β Error: File not found - Show suggestions]
ManifestFound -->|Yes| CheckOutput{Output File Exists?}
CheckOutput -->|Yes & !Force| ExistsError[β Error: File exists - Use force to overwrite]
CheckOutput -->|No or Force| CreateDestDir[Create Destination Directory]
CreateDestDir --> CreateOutputFile[Create Output File]
CreateOutputFile --> GetPassphrase[Get Passphrase if Needed]
GetPassphrase --> StartReassembly[π§ Start Chunk Reassembly]
StartReassembly --> ChunkLoop{More Chunks to Process?}
ChunkLoop -->|No| ShowResults[Show Success Message with file size and tags]
ChunkLoop -->|Yes| GetChunkHash[Get Chunk Hash - Use encrypted hash if available]
GetChunkHash --> BuildChunkPath[Build Chunk File Path in .sietch/chunks/]
BuildChunkPath --> ChunkExists{Chunk File Exists?}
ChunkExists -->|No| ChunkError[β Error: Chunk not found]
ChunkExists -->|Yes| ReadChunkData[Read Chunk Data from Disk]
ReadChunkData --> CheckDecryption{Skip Decryption?}
CheckDecryption -->|No & Encrypted| DecryptChunk[π Decrypt Chunk with AES/GPG and passphrase]
CheckDecryption -->|Yes or Not Encrypted| CheckCompression{Chunk Compressed?}
DecryptChunk --> CheckCompression
CheckCompression -->|Yes| DecompressChunk[π¦ Decompress Chunk with gzip/zstd]
CheckCompression -->|No| WriteToOutput[Write Chunk to Output File]
DecompressChunk --> WriteToOutput
WriteToOutput --> ChunkLoop
ShowResults --> Success[β
GET Complete - File retrieved successfully]
classDef startEnd fill:#e1f5fe,stroke:#01579b,stroke-width:3px
classDef process fill:#f3e5f5,stroke:#4a148c
classDef decision fill:#fff3e0,stroke:#e65100
classDef error fill:#ffebee,stroke:#c62828
classDef success fill:#e8f5e8,stroke:#2e7d32
classDef subprocess fill:#f1f8e9,stroke:#558b2f
class Start,Success startEnd
class VaultError,NotFoundError,ExistsError,ChunkError error
class FindVault,ManifestFound,CheckOutput,ChunkLoop,ChunkExists,CheckDecryption,CheckCompression decision
class FindManifest,StartReassembly subprocess
- Input: File reference in vault manifests
- Process: Find β Read chunks β Decrypt β Decompress β Reassemble
- Output: Reconstructed file on filesystem
- Recovery: Can skip decryption for data recovery scenarios