pub struct FfiWorkspace { /* private fields */ }Expand description
A Capsule workspace, callable from Swift/Kotlin: the durable library at a filesystem root plus everything an app does with it.
Workspace mutates through &mut self while uniffi objects expose only &self; the
Mutex supplies the interior mutability and serializes concurrent foreign calls.
Implementations§
Source§impl FfiWorkspace
impl FfiWorkspace
Sourcepub fn create(
root: String,
passphrase: Vec<u8>,
tier: FfiDeviceTier,
client: FfiClientBuild,
) -> Result<Arc<Self>, FfiError>
pub fn create( root: String, passphrase: Vec<u8>, tier: FfiDeviceTier, client: FfiClientBuild, ) -> Result<Arc<Self>, FfiError>
Enroll: create a brand-new library at root, guarded by passphrase at the
Argon2id cost for tier. Mints the account, the device key, and the signed device
directory, and seeds the durable album keystore.
client is the app’s own build identity: every manifest this workspace authors then
reports client_id/semver+commit rather than the bare capsule-core default.
Sourcepub fn create_with_hardware_signer(
root: String,
passphrase: Vec<u8>,
tier: FfiDeviceTier,
hardware: Arc<dyn FfiHardwareSigner>,
key_alias: String,
ml_seed: Vec<u8>,
client: FfiClientBuild,
) -> Result<Arc<Self>, FfiError>
pub fn create_with_hardware_signer( root: String, passphrase: Vec<u8>, tier: FfiDeviceTier, hardware: Arc<dyn FfiHardwareSigner>, key_alias: String, ml_seed: Vec<u8>, client: FfiClientBuild, ) -> Result<Arc<Self>, FfiError>
Enroll with a hardware-bound Ed25519 device key: as create, but
the classical half of the device signing key is produced by hardware under
key_alias over Ed25519 (a 32-byte public key, 64-byte signatures). The
post-quantum ML-DSA-65 half is the software-sealed ml_seed (32 bytes).
No shipping secure element holds Ed25519 keys, so this is the software/TPM reference
composition; phones use
create_with_p256_hardware_signer. It is the
same core call (HardwareBackedSigner::enroll) reached through this namespace’s
FfiHardwareSigner seam.
Sourcepub fn create_with_p256_hardware_signer(
root: String,
passphrase: Vec<u8>,
tier: FfiDeviceTier,
hardware: Arc<dyn FfiHardwareSigner>,
key_alias: String,
ml_seed: Vec<u8>,
client: FfiClientBuild,
) -> Result<Arc<Self>, FfiError>
pub fn create_with_p256_hardware_signer( root: String, passphrase: Vec<u8>, tier: FfiDeviceTier, hardware: Arc<dyn FfiHardwareSigner>, key_alias: String, ml_seed: Vec<u8>, client: FfiClientBuild, ) -> Result<Arc<Self>, FfiError>
Enroll with a hardware-bound device key: as create, but the
classical half of the device signing key is produced by hardware (a native Secure
Enclave / StrongBox / TPM element) under key_alias, over ECDSA-P256 — the
composition shipping secure elements actually provide, none of which do Ed25519. The
post-quantum ML-DSA-65 half is the software-sealed ml_seed (32 bytes).
The published device key carries the P-256 tag and verify_asset dispatches on it. The
library records the binding (the alias, ml_seed sealed under the account master key,
and the published key), so every later launch reopens it with
open_with_p256_hardware_signer on the same
key; plain open refuses such a library. An element that refuses
enrollment fails this call before anything is written under root.
Sourcepub fn open_with_p256_hardware_signer(
root: String,
passphrase: Vec<u8>,
tier: FfiDeviceTier,
hardware: Arc<dyn FfiHardwareSigner>,
key_alias: String,
client: FfiClientBuild,
) -> Result<Arc<Self>, FfiError>
pub fn open_with_p256_hardware_signer( root: String, passphrase: Vec<u8>, tier: FfiDeviceTier, hardware: Arc<dyn FfiHardwareSigner>, key_alias: String, client: FfiClientBuild, ) -> Result<Arc<Self>, FfiError>
Open the existing library at root as open does, re-attaching
hardware, the element that holds this device’s P-256 signing key. Required for a
library made by
create_with_p256_hardware_signer: the element
is asked for the key under the alias the library recorded, never to make a new one, and
the rebuilt key must be the one this device published. An element that lost the key or
is unavailable fails the open with FfiError::Workspace rather than letting the
library sign with another key.
The library’s record decides, not the caller: a library created with the software key
opens on it and hardware is not used. key_alias is used only when root holds a
laid-out library with no account yet, whose fresh account is then enrolled under it.
Sourcepub fn open(
root: String,
passphrase: Vec<u8>,
tier: FfiDeviceTier,
client: FfiClientBuild,
) -> Result<Arc<Self>, FfiError>
pub fn open( root: String, passphrase: Vec<u8>, tier: FfiDeviceTier, client: FfiClientBuild, ) -> Result<Arc<Self>, FfiError>
Open the existing library at root under passphrase, restoring its album keys and
authorities, every managed asset, and the add_id counter from disk. This is
what makes an app relaunch resume rather than re-enroll.
Sourcepub fn device_id(&self) -> Result<String, FfiError>
pub fn device_id(&self) -> Result<String, FfiError>
This device’s id (UUID string) — the created_by_device of every manifest it authors,
and the id to report as the session’s device_id.
Sourcepub fn default_album_id(&self) -> Result<String, FfiError>
pub fn default_album_id(&self) -> Result<String, FfiError>
The default album’s id, derived deterministically from the account master key — so every device of this account computes the same value with nothing to synchronize.
Sourcepub fn create_album(&self, name: String) -> Result<String, FfiError>
pub fn create_album(&self, name: String) -> Result<String, FfiError>
Create an album (minting AMK_v1, its write-tier and admin keys, and an attested authority, then persisting the keystore). Returns the album id.
Sourcepub fn ensure_album(
&self,
album_id: String,
name: String,
) -> Result<String, FfiError>
pub fn ensure_album( &self, album_id: String, name: String, ) -> Result<String, FfiError>
Resolve album_id to the album this workspace already holds, or create it under name.
This is the verb first-run wiring wants for the default album: it is idempotent across
relaunches, where create_album would refuse.
Sourcepub fn albums(&self) -> Result<Vec<FfiAlbum>, FfiError>
pub fn albums(&self) -> Result<Vec<FfiAlbum>, FfiError>
Every album this workspace holds key material for, in the one album order every app
shows as is: the album with the most recent visible, untrashed asset first, an empty
album by its creation time, ties by ascending id (Workspace::albums).
Sourcepub fn seal_asset(
&self,
album_id: String,
file_name: String,
bytes: Vec<u8>,
) -> Result<String, FfiError>
pub fn seal_asset( &self, album_id: String, file_name: String, bytes: Vec<u8>, ) -> Result<String, FfiError>
Seal + import: take bytes the app already holds (a PhotoKit / MediaStore export),
derive the file key, STREAM-encrypt, author and sign the create manifest, seal the
signed sidecar into its metadata blob, append the provenance chain, and self-verify
through the verify_asset chokepoint. Returns the asset id.
file_name is consulted for its extension and nothing else. One call, one core call:
the whole sealing order is capsule-core’s.
Sourcepub fn upload_blobs(
&self,
asset_id: String,
) -> Result<Vec<FfiUploadBlob>, FfiError>
pub fn upload_blobs( &self, asset_id: String, ) -> Result<Vec<FfiUploadBlob>, FfiError>
Everything needed to push one sealed asset, in ladder order: for each blob, the
POST /upload body (manifest envelope projected per the server’s invariant-15 rule)
and the bytes. Feed each straight to
FfiSession::upload.
The index tier (T0) is two blobs — the provenance record then the sealed metadata
blob — because the server publishes an asset to other devices only once it holds both
roles. Push all of them: an app that stopped after the metadata blob would upload an
asset no device, its own included, could ever see.
The original’s ciphertext is re-derived from the manifest’s recorded nonce prefix and gated on the manifest’s own content address, so what reaches the network is what the signed manifest vouches for.
Every blob comes back whole, the original included. To push without holding the
original in memory, use FfiSession::push_asset.
Building the bundle records the original’s upload source guard; once every blob is materialised nothing re-derives the original from this bundle again, so the guard is released before the blobs are returned. A later call re-verifies the plaintext against the signed content address and records it afresh.
Sourcepub fn verify_asset(
&self,
asset_id: String,
) -> Result<FfiVerifyOutcome, FfiError>
pub fn verify_asset( &self, asset_id: String, ) -> Result<FfiVerifyOutcome, FfiError>
Run the verify_asset chokepoint over a managed asset, regenerating its ciphertext
deterministically. This is the same single chokepoint sync-apply routes through — it is
exposed here so an app can re-check its own library (an integrity sweep), never as a
second verification path.
Sourcepub fn read_plaintext(&self, asset_id: String) -> Result<Vec<u8>, FfiError>
pub fn read_plaintext(&self, asset_id: String) -> Result<Vec<u8>, FfiError>
The plaintext bytes of a managed asset (what a gallery renders for a locally-held original).
Sourcepub fn asset_ids(&self) -> Result<Vec<String>, FfiError>
pub fn asset_ids(&self) -> Result<Vec<String>, FfiError>
Every managed asset id (UUID strings).
Sourcepub fn provenance_head(&self, asset_id: String) -> Result<Vec<u8>, FfiError>
pub fn provenance_head(&self, asset_id: String) -> Result<Vec<u8>, FfiError>
The asset’s head provenance record as opaque canonical CBOR — the exact bytes the
provenance blob carries, the feed serves back as manifest_cbor, and a receiving
device runs through apply_sync_entry.
The record wraps the head signed manifest with its chain position. That wrapper is not
optional: the server’s chain head is the SHA-256 of these bytes while a client’s next
prior_provenance_hash is the record’s own hash, so the bare manifest is the one
encoding under which no lifecycle op can ever chain. Canonical CBOR is deterministic, so
the manifest inside is byte-identical to its own signed bytes — nothing is re-authored
and the two signatures still verify over exactly what they covered.
Use signed_manifest when the manifest is what is wanted.
Sourcepub fn signed_manifest(&self, asset_id: String) -> Result<Vec<u8>, FfiError>
pub fn signed_manifest(&self, asset_id: String) -> Result<Vec<u8>, FfiError>
The asset’s head signed manifest as opaque canonical CBOR.
This is a serialization of an already-signed structure, not a re-authoring: the two signatures the manifest carries are covered by these bytes, which is why they travel verbatim and are never re-modeled on any wire.
Not what the sync feed carries — that is
provenance_head, the record that wraps this manifest with its
chain position. Handing these bytes to
apply_sync_entry is refused as malformed.
Sourcepub fn apply_sync_entry(
&self,
entry: FfiSyncEntry,
) -> Result<FfiSyncApplyOutcome, FfiError>
pub fn apply_sync_entry( &self, entry: FfiSyncEntry, ) -> Result<FfiSyncApplyOutcome, FfiError>
Sync-apply: verify one remote feed entry through the verify_asset chokepoint,
bind and decrypt its metadata blob, and return either the facts to upsert or a named
quarantine/hold verdict.
Never silently drops and never silently accepts: a refused entry is a
FfiSyncApplyOutcome::Quarantined the app must surface, not an error that aborts the
page. Errors are reserved for a failure of this workspace itself.
An applied record that chains onto an asset this workspace holds is adopted: appended
to the asset’s chain with the metadata it binds, written and indexed, and the facts say
so (FfiAssetFacts::adopted). A create is adopted only by
open_synced_original, which has its original.
Sourcepub fn apply_sync_entry_from_file(
&self,
entry: FfiSyncHead,
ciphertext_path: String,
) -> Result<FfiSyncApplyOutcome, FfiError>
pub fn apply_sync_entry_from_file( &self, entry: FfiSyncHead, ciphertext_path: String, ) -> Result<FfiSyncApplyOutcome, FfiError>
apply_sync_entry for an entry whose original ciphertext is
the file at ciphertext_path — the one
FfiSession::fetch_blob_to_path wrote —
read in memory bounded by one STREAM chunk whatever the original’s size.
The same chokepoint and verdicts: the file is hashed, and that digest is what the
content-integrity step checks against the manifest’s content address, so a file that is
not the committed ciphertext is quarantined as Rejected.CiphertextHashMismatch, as
apply_sync_entry quarantines those bytes. The ciphertext file is only read.
An applied record is adopted as apply_sync_entry adopts one:
a delete, trash-restore or edit of an asset this workspace holds is appended to its
chain, written under media/ and indexed, and the facts say so
(FfiAssetFacts::adopted).
A malformed album_id or local_chain_head is refused before the file is opened, so a
bad argument never costs a read of the original. The file is hashed before the workspace
is locked, so other verbs are not held up while a large original is read.
Sourcepub fn apply_held_sync_entry(
&self,
entry: FfiSyncHead,
) -> Result<FfiSyncApplyOutcome, FfiError>
pub fn apply_held_sync_entry( &self, entry: FfiSyncHead, ) -> Result<FfiSyncApplyOutcome, FfiError>
apply_sync_entry_from_file for an entry of an asset
this workspace holds, with no original fetched: the original is the one the held
chain’s head commits to, which this workspace verified when it adopted or imported it.
This is how a delete on an album page — which names no metadata blob and no blob — is
applied to an asset held here: the delete binds no metadata blob and commits to the
original the asset already has, so the same chokepoint and adoption as the apply verb
verify it against the entry’s local_chain_head, and the asset moves to this device’s
trash. A record committing to another original than the held one is quarantined as
Rejected.CiphertextHashMismatch, and one that binds a metadata blob the entry does not
carry is refused by the binding check: neither is adopted.
§Errors
FfiError::InvalidArgument for a malformed album_id or local_chain_head;
FfiError::Workspace when the record names an asset this workspace does not hold, or
the workspace itself fails. A record that does not decode is a quarantined verdict, as the
apply verb answers one.
Sourcepub fn open_synced_original(
&self,
entry: FfiSyncHead,
ciphertext_path: String,
destination_path: String,
) -> Result<FfiOpenedOriginal, FfiError>
pub fn open_synced_original( &self, entry: FfiSyncHead, ciphertext_path: String, destination_path: String, ) -> Result<FfiOpenedOriginal, FfiError>
Open a synced original from the ciphertext file at ciphertext_path to its plaintext
at destination_path, in memory bounded by a few STREAM chunks whatever its size.
The entry goes through the chokepoint as
apply_sync_entry_from_file would take it, then the
file is hashed while it is decrypted: it opens only if it is the ciphertext the manifest
commits to, every chunk authenticates, and the plaintext hashes to the signed sidecar’s
digest. The plaintext is written to a hidden staging file beside the destination and
renamed into place only once all of that holds, so destination_path is untouched by
any other verdict and never holds a partial or unverified original. An existing file there
is replaced only by a verified one.
An opened entry is then adopted: a create of an asset this workspace does not hold
makes it held, with its chain, sidecar and sealed metadata written under media/, the
opened original copied there as its own library copy, and its row and user
tags indexed; a later record of a held asset is appended as
apply_sync_entry_from_file appends one. The facts
say whether it was (FfiAssetFacts::adopted). destination_path still holds the
plaintext either way, for the caller to keep or remove.
The workspace stays locked while the original decrypts and is adopted.
§Errors
FfiError::Workspace when a file cannot be read or written, or the workspace itself
fails (an adoption whose write failed included, after the original was placed at
destination_path); FfiError::InvalidArgument for a malformed entry or a destination
with no file name. A refused entry is a verdict, never an error.
Sourcepub fn open_synced_history(
&self,
entry: FfiSyncHead,
history: Vec<Vec<u8>>,
ciphertext_path: String,
destination_path: String,
) -> Result<FfiOpenedOriginal, FfiError>
pub fn open_synced_history( &self, entry: FfiSyncHead, history: Vec<Vec<u8>>, ciphertext_path: String, destination_path: String, ) -> Result<FfiOpenedOriginal, FfiError>
open_synced_original for an asset this workspace does not
hold and first sees past its create, with history the records before the entry’s,
oldest first from the create — what
FfiSession::fetch_provenance_history
returns for the entry’s manifest_cbor.
The entry is applied against the last record of history, whatever its
local_chain_head says, and its original opened from ciphertext_path as
open_synced_original opens one. Then every record of history is verified through
the chokepoint in order from the create, the sidecar is opened from the entry’s
metadata_blob (the asset’s live one, which the server’s metadata role names: a
superseded metadata blob is collected), and the asset is adopted, held from its
create with the opened original as its library copy. The facts say whether it was
(FfiAssetFacts::adopted); a held asset’s delete, trash-restore or edit then works
on this device as on one it imported.
An entry that names no metadata blob or original — a delete on an album page, the
surface a writer member’s device reads — is opened the same way once they are fetched:
synced_history_sources names both from the entry
and history, the fetched metadata blob goes in the entry’s metadata_blob, and the
fetched original is ciphertext_path. Left empty, the metadata_blob binds to nothing
and the entry is refused.
A history that does not verify, or a live metadata blob that does not bind, is
FfiOpenedOriginal::Refused with the verdict that refused it, and
destination_path is untouched: the original is placed there only once the asset it
belongs to verifies from its create. An empty history is open_synced_original, and so
is an entry of an asset this workspace already holds: its history is not read, so none of
its records can refuse the entry, and the entry is applied against its own
local_chain_head.
§Errors
As open_synced_original; an adoption whose write failed
leaves nothing at destination_path.
Sourcepub fn escrow_blob(
&self,
recovery_secret: Vec<u8>,
tier: FfiDeviceTier,
) -> Result<Vec<u8>, FfiError>
pub fn escrow_blob( &self, recovery_secret: Vec<u8>, tier: FfiDeviceTier, ) -> Result<Vec<u8>, FfiError>
Mint the master-key escrow blob under recovery_secret, as opaque canonical CBOR —
the bytes FfiSession::escrow_put stores.
The master key never crosses this boundary: it is wrapped inside capsule-core and only
the wrapped blob comes out. recovery_secret is the ≥128-bit secret shown to the user
exactly once at first-device enrollment.
Sourcepub fn verify_escrow_blob(
&self,
blob: Vec<u8>,
recovery_secret: Vec<u8>,
) -> Result<bool, FfiError>
pub fn verify_escrow_blob( &self, blob: Vec<u8>, recovery_secret: Vec<u8>, ) -> Result<bool, FfiError>
Local, network-free check that recovery_secret still opens blob to this device’s
master key — the recovery verification cadence’s predicate. blob is the canonical CBOR
FfiSession::escrow_get returns.
A false is not necessarily a wrong secret: the cached blob may be stale after a
rotation on another device, so refresh it and re-check once before telling the user
anything.
Sourcepub fn signed_device_directory(&self) -> Result<Vec<u8>, FfiError>
pub fn signed_device_directory(&self) -> Result<Vec<u8>, FfiError>
This workspace’s signed device directory as opaque canonical CBOR — the bytes
FfiSession::publish_device_directory
sends. Until this is published, every asset this device signs is an unknown device to
every other device, so first-device enrollment publishes before it uploads.
Sourcepub fn user_ik_public(&self) -> Result<Vec<u8>, FfiError>
pub fn user_ik_public(&self) -> Result<Vec<u8>, FfiError>
This account’s user identity public key — the pin a fetched device directory is verified against.
Sourcepub fn labels(&self, target: FfiLabelTarget) -> Result<Vec<String>, FfiError>
pub fn labels(&self, target: FfiLabelTarget) -> Result<Vec<String>, FfiError>
The labels target carries, sorted. An unknown target is FfiError::Label with
FfiLabelRefusal::NotFound.
Sourcepub fn add_label(
&self,
target: FfiLabelTarget,
label: String,
) -> Result<Vec<String>, FfiError>
pub fn add_label( &self, target: FfiLabelTarget, label: String, ) -> Result<Vec<String>, FfiError>
Add label to target and return its labels afterwards.
Sourcepub fn remove_label(
&self,
target: FfiLabelTarget,
label: String,
) -> Result<Vec<String>, FfiError>
pub fn remove_label( &self, target: FfiLabelTarget, label: String, ) -> Result<Vec<String>, FfiError>
Remove label from target (every add of it this device has observed) and return its
labels afterwards. A label the target does not carry writes nothing and answers the
unchanged list.
Sourcepub fn regions(&self, asset_id: String) -> Result<Vec<FfiRegion>, FfiError>
pub fn regions(&self, asset_id: String) -> Result<Vec<FfiRegion>, FfiError>
The asset’s live regions, oldest first.
Sourcepub fn add_region(
&self,
asset_id: String,
shape: FfiRegionShape,
labels: Vec<String>,
) -> Result<FfiRegion, FfiError>
pub fn add_region( &self, asset_id: String, shape: FfiRegionShape, labels: Vec<String>, ) -> Result<FfiRegion, FfiError>
Mark a region of asset_id with its first labels, and return it.
Every label is checked before the region is written, so a refused label leaves no unlabelled region behind; then the shape, then the asset. A refusal writes nothing.
Sourcepub fn delete_region(
&self,
asset_id: String,
region_id: String,
) -> Result<(), FfiError>
pub fn delete_region( &self, asset_id: String, region_id: String, ) -> Result<(), FfiError>
Delete a region. Final: a concurrent or later edit of it on another device does not bring it back once the two merge, and its id is never live again.
Sourcepub fn delete_asset(
&self,
asset_id: String,
retain_days: u32,
) -> Result<FfiTrashEntry, FfiError>
pub fn delete_asset( &self, asset_id: String, retain_days: u32, ) -> Result<FfiTrashEntry, FfiError>
Move an asset to the trash: sign a delete whose retention window is retain_days days
from now, and return its trash entry. An asset already in the trash keeps the window it
was deleted with and signs nothing, so a retried delete never extends it.
Sourcepub fn restore_asset(&self, asset_id: String) -> Result<(), FfiError>
pub fn restore_asset(&self, asset_id: String) -> Result<(), FfiError>
Restore an asset from the trash: sign a trash-restore. Refused with
FfiTrashRefusal::RetentionElapsed (and the error.upload.retention_elapsed code) at
or after the signed retention_until, and with FfiTrashRefusal::NotInTrash for an
asset that is not in the trash.
Sourcepub fn purge_asset(&self, asset_id: String) -> Result<FfiPurgeOutcome, FfiError>
pub fn purge_asset(&self, asset_id: String) -> Result<FfiPurgeOutcome, FfiError>
Permanently delete a trashed asset: its original, every derivative and local cache
entry, its sidecar and its index row. The provenance chain is kept as the record of the
deletion. Before retention_until a signed shorter-retention delete is appended first
and handed back in FfiPurgeOutcome::reissue_record to send to the server.
Sourcepub fn trash(&self) -> Result<Vec<FfiTrashEntry>, FfiError>
pub fn trash(&self) -> Result<Vec<FfiTrashEntry>, FfiError>
Every asset in the trash with its signed retention window, most recently deleted first.
This is the retention data, not the Recently Deleted view: a surface that shows the
trash still opens it behind the SR1 fresh-local-auth gate, as Catalog::query_trash
does.
Sourcepub fn expired_trash(
&self,
drain: Option<FfiFeedDrain>,
) -> Result<Vec<FfiTrashEntry>, FfiError>
pub fn expired_trash( &self, drain: Option<FfiFeedDrain>, ) -> Result<Vec<FfiTrashEntry>, FfiError>
The trash entries whose signed retention window has closed: the retention sweep’s
input, each one ready for purge_asset.
A deadline is judged only after a sync drained the feed to its head, so a restore on a
later page lands first: pass that drain as drain, its server_heads covering the whole
feed as FfiFeedDrain::server_heads requires. The deadline is judged by the
drain’s latest server changed_at alone, never by this device’s clock, and an asset
whose delete the server has not indexed (a held delete) never expires. With no drain
(None: the sync failed, or this device has no server), or a drain that saw no entry,
nothing has expired, and the trash keeps every asset until the user empties it.
§Errors
FfiError::InvalidArgument for a latest_changed_at that is not RFC 3339.
Sourcepub fn purged_record(
&self,
asset_id: String,
) -> Result<Option<Vec<u8>>, FfiError>
pub fn purged_record( &self, asset_id: String, ) -> Result<Option<Vec<u8>>, FfiError>
The signed delete that ended a purged asset, the head of its kept provenance chain, as
the opaque canonical CBOR record FfiPurgeOutcome::reissue_record carries. After an
early purge it is that same re-issue, so a delivery to the album’s ops surface that
failed can be resent from here, also after a reopen
(FfiSession::apply_lifecycle_op, or
FfiSession::deliver_purge for the whole stretch).
None for an asset this workspace has not purged.
Source§impl FfiWorkspace
impl FfiWorkspace
Sourcepub fn set_cull(
&self,
asset_id: String,
flag: FfiCullFlag,
) -> Result<(), FfiError>
pub fn set_cull( &self, asset_id: String, flag: FfiCullFlag, ) -> Result<(), FfiError>
Flag one asset. Neutral clears a prior flag. Signs one metadata-update, stamped with
this device and now, so concurrent flags from two devices converge under LWW.
Sourcepub fn cull_flag(&self, asset_id: String) -> Result<FfiCullFlag, FfiError>
pub fn cull_flag(&self, asset_id: String) -> Result<FfiCullFlag, FfiError>
The asset’s current flag: Neutral when it was never flagged, and for an asset this
workspace does not hold.
Sourcepub fn assets_by_cull(&self, flag: FfiCullFlag) -> Result<Vec<String>, FfiError>
pub fn assets_by_cull(&self, flag: FfiCullFlag) -> Result<Vec<String>, FfiError>
The managed, non-trashed assets currently carrying flag, sorted. Neutral includes
the never-flagged ones.
Sourcepub fn stack_memberships(&self) -> Result<Vec<FfiStackMember>, FfiError>
pub fn stack_memberships(&self) -> Result<Vec<FfiStackMember>, FfiError>
Every managed, non-trashed asset that belongs to a stack, with its stack, whether it is
the cover and its member index, sorted by asset id. An asset in no stack is absent, so a
cull pass reads it as a lone asset; a trashed member is absent too, matching the members
flag_stack writes.
Sourcepub fn flag_stack(
&self,
stack_id: String,
flag: FfiCullFlag,
) -> Result<Vec<String>, FfiError>
pub fn flag_stack( &self, stack_id: String, flag: FfiCullFlag, ) -> Result<Vec<String>, FfiError>
Flag every non-trashed member of a stack, one metadata-update each — flagging a
collapsed stack flags its members, since a stack stores no flag of its own. Returns the
members flagged, sorted; empty for a stack with no members.
Sourcepub fn stack_cull_state(
&self,
stack_id: String,
) -> Result<Option<FfiStackCullState>, FfiError>
pub fn stack_cull_state( &self, stack_id: String, ) -> Result<Option<FfiStackCullState>, FfiError>
A stack’s cull state, derived from its members on this read. None for a stack with no
non-trashed members.
Sourcepub fn reject_sweep(&self, retain_days: u32) -> Result<Vec<String>, FfiError>
pub fn reject_sweep(&self, retain_days: u32) -> Result<Vec<String>, FfiError>
The reject sweep: move every rejected, not-yet-trashed asset to the trash with a
retention window of retain_days days, and return the swept ids, sorted. Each is a
signed delete, restorable from the trash until its window closes. A refusal partway
is FfiError::Trash; the assets swept before it stay in the trash, and a retried
sweep moves the rest.
Source§impl FfiWorkspace
impl FfiWorkspace
Sourcepub fn purged_asset_ids(&self) -> Result<Vec<String>, FfiError>
pub fn purged_asset_ids(&self) -> Result<Vec<String>, FfiError>
Every asset this workspace has purged (UUID strings), whose kept chain
purged_record reads: the list a relaunch walks to deliver the
purges whose delivery failed or was held, with FfiSession::deliver_purge. A purge
the server already applied answers as a replay, so walking it again is safe.
Trait Implementations§
Source§impl<UT> LiftRef<UT> for FfiWorkspace
impl<UT> LiftRef<UT> for FfiWorkspace
type LiftType = Arc<FfiWorkspace>
Source§impl<UT> LowerError<UT> for FfiWorkspace
impl<UT> LowerError<UT> for FfiWorkspace
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Source§impl<UT> LowerReturn<UT> for FfiWorkspace
impl<UT> LowerReturn<UT> for FfiWorkspace
Source§type ReturnType = <Arc<FfiWorkspace> as LowerReturn<UniFfiTag>>::ReturnType
type ReturnType = <Arc<FfiWorkspace> as LowerReturn<UniFfiTag>>::ReturnType
Source§fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Source§impl<UT> TypeId<UT> for FfiWorkspace
impl<UT> TypeId<UT> for FfiWorkspace
const TYPE_ID_META: MetadataBuffer
Auto Trait Implementations§
impl !Freeze for FfiWorkspace
impl RefUnwindSafe for FfiWorkspace
impl Send for FfiWorkspace
impl Sync for FfiWorkspace
impl Unpin for FfiWorkspace
impl UnsafeUnpin for FfiWorkspace
impl UnwindSafe for FfiWorkspace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more