pub async fn replicate_object<F, Fut>(
rule: ReplicationRule,
source_bucket: String,
source_key: String,
body: Bytes,
metadata: Option<HashMap<String, String>>,
do_put: F,
manager: Arc<ReplicationManager>,
)Expand description
Replicate one source-bucket object to the rule’s destination bucket.
The caller supplies a do_put callback that performs the actual
destination-bucket PUT (so unit tests can drive the dispatcher
without needing a full backend). The callback receives:
(destination_bucket, key, body, metadata) and returns a
Result<(), String> whose Err triggers the retry / failure path.
Behaviour:
- Stamps the destination metadata with
x-amz-replication-status: REPLICAso a HEAD on the replica is distinguishable. - On callback success, records
(source_bucket, source_key) → Completedin the manager. - On callback failure, retries up to [
RETRY_ATTEMPTS] times with exponential backoff (50ms / 100ms / 200ms). After the budget is exhausted, recordsFailed, bumpsdropped_total, and emits the matching Prometheus counter.