Skip to main content

Module objects_cmd

Module objects_cmd 

Source
Expand description

Tauri commands for object listing and mutations.

§Commands

§Validation gate (AC-8 / round-1 finding #9)

All commands refuse to serve any data when profile.validated_at is None. The cache itself also enforces this, but the command boundary check is defence-in-depth: a future refactor of the cache must not silently lift the gate.

§Caching

Only first-page requests (no continuation_token) are cached, because the token is derived from the previous page and is therefore not stable across sessions. Subsequent pages bypass the cache and always hit S3.

The flat variant uses a separate cache key — the prefix is suffixed with "__FLAT__" — so hierarchical and flat listings for the same prefix do not collide in the cache.

§Mutation → cache invalidation → event

Every mutating command follows this sequence after a successful S3 call:

  1. Invalidate the affected CacheKey::Objects prefix(es).
  2. Emit objects:updated { profileId, bucket, prefix } for each affected prefix so the frontend’s TanStack Query adapter invalidates its local cache.

Structs§

DeleteKey
One key (with optional version ID) in a batch delete request.
ObjectRef
Reference to a single S3 object: bucket + full key.
ObjectsUpdatedPayload 🔒
Payload emitted as objects:updated after every mutation.

Functions§

cross_account_confirm
Mint a one-time confirmation token for a large cross-account copy.
emit_objects_updated 🔒
Emit objects:updated for one (profile, bucket, prefix) triple.
object_copy
Copy source to destination with automatic cross-account fallback.
object_create_folder
Create a virtual folder placeholder at bucket/prefix/.
object_delete_batch
Delete keys from bucket using the S3 batched DeleteObjects API.
object_get_bytes
Fetch the first max_bytes bytes of an S3 object as a base64-encoded string.
object_get_text
Fetch the first max_bytes bytes of an S3 object as UTF-8 text.
object_move
Move source to destination: server-side copy then delete source.
object_presign
Generate a presigned GetObject URL for bucket/key.
object_put_text
Write a UTF-8 text body to bucket/key.
object_set_metadata
Replace user-defined metadata on bucket/key.
object_set_storage_class
Change the storage class of one or more objects.
object_set_tags
Set (or clear) the tags on bucket/key.
objects_list
List objects under prefix using delimiter="/".
objects_list_flat
List all objects under prefix without a delimiter (flat key tree).