Skip to main content

object_put_text

Function object_put_text 

Source
pub async fn object_put_text(
    profile_id: ProfileId,
    bucket: String,
    key: String,
    body: String,
    if_match_etag: Option<String>,
    store: State<'_, ProfileStoreHandle>,
    pool: State<'_, S3ClientPoolHandle>,
    locks: State<'_, LockRegistryHandle>,
    cache: State<'_, CacheHandle>,
    channel: AppHandle,
) -> Result<PutResult, AppError>
Expand description

Write a UTF-8 text body to bucket/key.

When if_match_etag is supplied the backend sets the If-Match header so S3 rejects the write with 412 if the object was modified since the editor loaded it. That 412 maps to AppError::Conflict { etag_expected, etag_actual: None }.

The frontend should:

  • Supply if_match_etag from the ETag returned by object_get_text for conflict-safe saves.
  • Omit if_match_etag (pass null) for “save anyway” after a conflict.

On success the backend emits objects:updated { profileId, bucket, prefix } for the parent prefix of key so the listing refreshes.

§Validation gate

Refuses to write when the profile has not been validated (AC-8).