Skip to main content

Module diff

Module diff 

Source
Expand description

Diff preview / confirmation framework.

§Overview

High-impact property edits (storage class change in v1; future: lifecycle, ACL, metadata bulk-edit) go through a two-phase flow:

  1. Create: caller invokes diff_preview_create with a description of the proposed change → backend persists a DiffRecord in the DiffStore and returns a DiffId.

  2. Confirm or Cancel:

    • Confirm: the mutating command (e.g. object_set_storage_class) calls DiffStore::consume with the id. Consume succeeds only once and only for records in the Pending state.
    • Cancel: diff_preview_cancel sets the status to Cancelled. Any subsequent consume call returns None.

§OCP

  • DiffPayload is open for new kinds (metadata bulk-edit, ACL change). Adding a new kind is one new variant here + one new parsing branch in diff_cmd.rs + one new rendering branch in the frontend modal.
  • DiffStore::consume is the single safety gate. Every mutating command that uses the diff framework must call consume — it is the authoritative check for cancelled/expired/double-confirm rejection.

Structs§

DiffId
Opaque diff identifier — a UUID v4 string.
DiffObjectRef
A reference to a single S3 object used in diff payloads.
DiffRecord
A persisted diff entry in the DiffStore.
DiffStore
In-memory store for pending diff records.
DiffStoreHandle
Arc-wrapped DiffStore managed by Tauri.

Enums§

DiffPayload
Describes what change a diff is proposing.
DiffStatus
Lifecycle status of a diff record.

Constants§

DEFAULT_DIFF_TTL_SECS
Default TTL for diff records: 5 minutes.