Expand description
Single-part and multipart upload implementation.
§Protocol
- Acquire a scoped resource lock via
LockRegistry. tokio::fs::metadata(source_path)→total_bytes.- If
total_bytes < 5 MB: single-partput_objectpath. - Else: multipart path:
a.
create_multipart_upload→ upload_id. b. Record in redbmultipart_activetable. c. Computepart_size = max(8 MB, total_bytes / 9999)(cap at 10 000 parts). d. Stream parts concurrently viatokio::Semaphore(default 4 in-flight). e.complete_multipart_upload→ remove frommultipart_active→ emitobjects:updated. - On cancel:
abort_multipart_upload, remove from table, emitCanceled. - On error: same cleanup.
- Release lock with appropriate
ReleaseReason.
§OCP contract
The lock registry, transfer registry, and progress throttle are reused from task 31 (download). No new infrastructure is introduced.
Structs§
- Objects
Updated 🔒Payload - Payload for the
objects:updatedevent.
Constants§
- MAX_
PARTS 🔒 - S3 maximum part count.
- MIN_
PART_ 🔒SIZE - Minimum multipart part size (8 MB).
- SINGLE_
PART_ 🔒THRESHOLD - Files smaller than this use single-part
put_object.
Functions§
- abort_
multipart 🔒 - cleanup_
on_ 🔒error - compute_
part_ size - Compute the multipart part size for a given total file size.
- multipart_
upload 🔒 - now_ms 🔒
- now_
secs 🔒 - single_
part_ 🔒upload - upload_
object - Upload
source_pathtobucket/key.