pub struct ReplicationManager {
pub dropped_total: AtomicU64,
/* private fields */
}Expand description
In-memory manager of per-bucket replication configurations + per- (bucket, key) replication statuses.
Fields§
§dropped_total: AtomicU64Bumped each time the dispatcher exhausts its retry budget on a destination PUT. Exposed publicly so the metrics layer can poll without taking the configuration lock.
Implementations§
Source§impl ReplicationManager
impl ReplicationManager
Sourcepub fn put(&self, bucket: &str, config: ReplicationConfig)
pub fn put(&self, bucket: &str, config: ReplicationConfig)
put_bucket_replication handler entry. The bucket’s existing
configuration is fully replaced (S3 spec — PutBucketReplication
is upsert-style at the bucket scope, not per-rule patch).
Sourcepub fn get(&self, bucket: &str) -> Option<ReplicationConfig>
pub fn get(&self, bucket: &str) -> Option<ReplicationConfig>
get_bucket_replication handler entry. Returns None when
nothing is registered (AWS S3 returns
ReplicationConfigurationNotFoundError in that case; the
service-layer handler maps None accordingly).
Sourcepub fn to_json(&self) -> Result<String, Error>
pub fn to_json(&self) -> Result<String, Error>
Serialise the entire manager state (configurations + per-key statuses) to JSON.
Sourcepub fn from_json(s: &str) -> Result<Self, Error>
pub fn from_json(s: &str) -> Result<Self, Error>
Restore a manager from a previously-emitted snapshot. The
dropped_total counter is reset to 0 — historical drops are
runtime metrics, not configuration.
Sourcepub fn match_rule(
&self,
bucket: &str,
key: &str,
object_tags: &[(String, String)],
) -> Option<ReplicationRule>
pub fn match_rule( &self, bucket: &str, key: &str, object_tags: &[(String, String)], ) -> Option<ReplicationRule>
Match an object against the bucket’s rules and return the
highest-priority enabled rule whose filter matches. Returns
None when no rule matches (or no configuration is registered
for the bucket). Ties on priority are broken by declaration
order — the first such rule wins.
Sourcepub fn record_status(&self, bucket: &str, key: &str, status: ReplicationStatus)
pub fn record_status(&self, bucket: &str, key: &str, status: ReplicationStatus)
Stamp the per-(bucket, key) replication status. Replaces any
previous entry — a Failed follows Pending, etc.
Sourcepub fn lookup_status(
&self,
bucket: &str,
key: &str,
) -> Option<ReplicationStatus>
pub fn lookup_status( &self, bucket: &str, key: &str, ) -> Option<ReplicationStatus>
Look up the recorded replication status for (bucket, key).
Returns None when no PUT to this key has triggered
replication (= the object is not under any replication rule, or
it predates the rule’s creation).