pub async fn check_read_only_patch<B, O>(
backend: &B,
caller: &B::CallerCtx,
account_id: &Id,
id: &Id,
patch: &mut Map<String, Value>,
) -> Result<bool, Value>Expand description
Check a /set update patch of the stored object id against the
server-set and immutable properties of O, and report a no-op.
RFC 8620 §5.3: “Any server-set properties MAY be included in the patch
if their value is identical to the current server value (before
applying the patches to the object). Otherwise, the update MUST be
rejected with an “invalidProperties” SetError.“ The stored object is
fetched only when the patch names such a property or is empty; then
strip_read_only_patch rejects a changed value and drops the
identical ones, leaving only the client changes for the handler’s own
checks.
Returns Ok(true) when nothing is left to apply, for a literal {} or
a patch of identical server-set values: the update succeeds as a no-op,
with no write, updated mapping id to null, and the state unchanged.
A missing object leaves nothing to compare, so a read-only key is
rejected as invalidProperties, and an empty patch is notFound.
§Errors
The notUpdated value: notFound for an empty patch of a missing
object, the invalidProperties SetError, or serverFail when the fetch
fails.