pub(crate) async fn mirror_central_kv_once(
sync_cfg: &CentralKvSyncConfig,
local_store: &Store,
local_key: &str,
) -> Result<(), Box<dyn Error + Send + Sync>>Expand description
Copies the configured central KV entry into local KV during startup.
The remote payload is deserialized before writing locally so invalid central
configuration does not replace the local copy. The local key is written only when
its value differs from the central one. The central bucket is created if it does not
exist (through ensure_kv_bucket).
§Arguments
sync_cfg- Central server, credentials, bucket and key.local_store- Local KV bucket to write into.local_key- Local key to write.
§Errors
Returns an error if connecting to the central server or opening its bucket fails, if
the central key does not exist, if its value is not a valid NestedConfig, or if
reading or writing the local key fails.