File Lifecycle
Every file in Tusky moves through a storage pipeline — from fast hot cache to durable decentralized storage on the Walrus network.
The pipeline
Section titled “The pipeline”1. Upload → hot
Section titled “1. Upload → hot”When you upload a file, it goes to the hot cache (S3-compatible object storage). It’s immediately available for download at full speed.
2. Walrus sync → synced
Section titled “2. Walrus sync → synced”A background worker picks up the file and publishes it to the Walrus decentralized storage network. This typically takes seconds to a few minutes. Once confirmed, the status changes to synced.
The file now exists in two places: hot cache (fast) and Walrus (durable). Two identifiers are stored:
walrusBlobId— content-addressed hash for retrievalwalrusBlobObjectId— Sui object ID for epoch renewals
3. Hot eviction → cold
Section titled “3. Hot eviction → cold”After the hot retention period expires, the hot eviction worker removes the file from the hot cache. The file is now cold — stored only on Walrus.
4. Rehydration → back to hot
Section titled “4. Rehydration → back to hot”When a cold file is needed, Tusky fetches it from Walrus back to the hot cache:
// Trigger rehydrationawait tusky.files.rehydrate(file.id);
// Wait for it to be availableconst rehydrated = await tusky.files.waitForStatus(file.id, ['hot', 'synced']);# Trigger rehydrationrequests.post( f"https://api.opentusk.ai/api/files/{file_id}/rehydrate", headers=headers,)
# Poll until hotimport timewhile True: resp = requests.get(f"https://api.opentusk.ai/api/files/{file_id}", headers=headers) if resp.json()["status"] in ("hot", "synced"): break time.sleep(2)Walrus epochs
Section titled “Walrus epochs”Walrus stores data for a set number of epochs (each ~24 hours). Tusky automatically renews epoch leases before they expire to prevent data loss.
The walrusRenew background worker:
- Scans for files approaching epoch expiry
- Calls
extendBlob()via the Walrus SDK using thewalrusBlobObjectId - Pays WAL tokens to extend the storage lease
Error handling
Section titled “Error handling”If Walrus sync fails after retries, the file status is set to error. The file remains in the hot cache and is safe — it just hasn’t been durably stored on Walrus yet.
Monitor errors via webhooks (file.error event) or by listing files filtered by status.
Summary
Section titled “Summary”| Status | Hot cache | Walrus | Available |
|---|---|---|---|
uploading | Pending | No | No |
hot | Yes | No | Yes (fast) |
synced | Yes | Yes | Yes (fast) |
cold | No | Yes | After rehydration |
error | Yes | Failed | Yes (fast) |