Lifecycle and tiering: cheap because bytes are immutable
Storage classes trade per-GB cost for retrieval latency, a retrieval fee, and a minimum-duration lock-in, and lifecycle rules slide objects down the ladder automatically — cheap to build precisely because objects are immutable and the index is the source of truth for location and class.
Reaping orphaned parts was one declarative lifecycle action — and the same lifecycle machinery drives the bigger cost lever: sliding objects to cheaper storage as they cool.
Scene 10
Lifecycle and tiering: cheap because bytes are immutable
- Watch
- Try it
- Predict
- Capture
The object starts on Standard — the hot rung: ms reads, highest per-GB cost, no minimum-duration commitment. A lifecycle rule says "transition after 30 days." Watch the day counter: when it fires, a background worker rewrites the bytes one rung colder and the index pointer follows. The key never changes; no client sees the move — but the retrieval-latency readout climbs.
Highlighted lines are the ones running in the diagram right now.
# runs continuously over each bucket/prefixfor obj in index.scan(prefix):age = now() - obj.createdAtif age >= rule.transitionAfterDays:transition(obj, rule.toClass) # slide one rung colderif age >= rule.expireAfterDays:expire(obj) # delete current version# orphaned multipart parts never showed up in LISTfor mpu in index.incompleteUploads(prefix):if mpu.age >= rule.reapIncompleteMpuAfterDays:abortUpload(mpu) # parts leave billing meter
def transition(obj, toClass):# immutable bytes => no in-place edit to coordinatenewLoc = dataPlane.rewrite(obj.fragments, toClass.medium,)# index is the source of truth for location + classindex.update(obj.key, {location: newLoc,storageClass: toClass,}) # key unchanged; no client sees the movedataPlane.free(obj.oldLocation)
def onDelete(obj):stored = now() - obj.classEnteredAtminDays = obj.storageClass.minDurationDays# cold classes bill the floor even if you delete earlybilledDays = max(stored, minDays)charge(obj, billedDays)
Where this sits in Build an S3-style distributed object store
Scene 10 of 12, in the Make it real act — Strong consistency, multipart upload, lifecycle & tiering.. Storage classes trade retrieval latency for cost; a lifecycle rule slides an object down the ladder as a pointer move.
Up next. We've now built every piece — keyspace, immutability, erasure coding, placement, the two planes, repair, consistency, multipart, lifecycle — so the last move is to assemble them for a real workload and defend the durability number.
All 12 scenes in Build an S3-style distributed object store · Every curriculum