Skip to main content

mirror_remote_kv_entry_to_local

Function mirror_remote_kv_entry_to_local 

Source
pub(crate) async fn mirror_remote_kv_entry_to_local(
    remote_store: &Store,
    remote_bucket: &str,
    remote_key: &str,
    local_store: &Store,
    local_key: &str,
) -> Result<bool, LJMError>
Expand description

Copies one remote KV configuration entry into the local KV bucket if needed.

The remote value is parsed before it is written locally so an invalid central configuration cannot replace the last known local configuration. The write is skipped when the local bytes already equal the remote bytes, so an unchanged value does not add a KV revision.

§Arguments

  • remote_store - Central KV bucket.
  • remote_bucket - Central bucket name, used only in the log line.
  • remote_key - Central key to read.
  • local_store - Local KV bucket.
  • local_key - Local key to write.

§Returns

true if the local entry was written, false if it already matched.

§Errors

Returns an error if the remote key is missing or cannot be read, the remote value does not parse, the local key cannot be read, or the local write fails.