pub trait CloudKitOps: Send + Sync {
Show 19 methods
// Required methods
fn provider_identity(
&self,
scope: &CloudKitScope,
) -> Result<CloudKitProviderIdentity, CloudHomeError>;
fn accepted_read_write_share(
&self,
scope: &CloudKitScope,
) -> Result<CloudKitAcceptedShareRecord, CloudHomeError>;
fn write_record(
&self,
scope: &CloudKitScope,
key: &str,
data: Vec<u8>,
) -> Result<(), CloudHomeError>;
fn read_record(
&self,
scope: &CloudKitScope,
key: &str,
) -> Result<Vec<u8>, CloudHomeError>;
fn list_records(
&self,
scope: &CloudKitScope,
prefix: &str,
) -> Result<Vec<String>, CloudHomeError>;
fn delete_record(
&self,
scope: &CloudKitScope,
key: &str,
) -> Result<(), CloudHomeError>;
fn record_exists(
&self,
scope: &CloudKitScope,
key: &str,
) -> Result<bool, CloudHomeError>;
fn read_versioned_record(
&self,
scope: &CloudKitScope,
key: &str,
) -> Result<CloudVersionedHead, CloudHomeError>;
fn create_record(
&self,
scope: &CloudKitScope,
key: &str,
data: Vec<u8>,
) -> Result<CloudVersionedHead, CloudHeadCreateError>;
fn replace_record(
&self,
scope: &CloudKitScope,
key: &str,
expected: &CloudHeadVersion,
data: Vec<u8>,
) -> Result<CloudVersionedHead, CloudHeadReplaceError>;
fn begin_atomic_create(
&self,
scope: &CloudKitScope,
) -> Result<CloudKitAtomicCreateBatch, CloudHomeError>;
fn stage_atomic_create_record(
&self,
scope: &CloudKitScope,
batch: &CloudKitAtomicCreateBatch,
record: CloudKitRecordCreate,
) -> Result<(), CloudHomeError>;
fn commit_atomic_create(
&self,
scope: &CloudKitScope,
batch: &CloudKitAtomicCreateBatch,
) -> Result<Vec<CloudKitRecordVersion>, CloudHomeError>;
fn discard_atomic_create(
&self,
scope: &CloudKitScope,
batch: &CloudKitAtomicCreateBatch,
) -> Result<(), CloudHomeError>;
fn delete_record_versions(
&self,
scope: &CloudKitScope,
records: &[CloudKitRecordVersion],
) -> Result<(), CloudHomeError>;
fn share_for_member(
&self,
member_pubkey: &str,
) -> Result<Option<CloudKitShare>, CloudHomeError>;
fn grant_share(
&self,
member_pubkey: &str,
) -> Result<CloudKitShare, CloudHomeError>;
fn revoke_share(&self, member_pubkey: &str) -> Result<(), CloudHomeError>;
fn accept_share(
&self,
share_url: &str,
) -> Result<CloudKitShare, CloudHomeError>;
}Expand description
Synchronous interface for raw CloudKit record operations. Implemented by a host bridge to its platform CloudKit driver. Methods block the calling thread while CloudKit async operations complete.
Required Methods§
Sourcefn provider_identity(
&self,
scope: &CloudKitScope,
) -> Result<CloudKitProviderIdentity, CloudHomeError>
fn provider_identity( &self, scope: &CloudKitScope, ) -> Result<CloudKitProviderIdentity, CloudHomeError>
Stable CloudKit namespace and principal facts for the selected zone.
Fetch the accepted CKShare for a shared scope and return its exact canonical record bytes plus the participant facts verified by the host.
fn write_record( &self, scope: &CloudKitScope, key: &str, data: Vec<u8>, ) -> Result<(), CloudHomeError>
fn read_record( &self, scope: &CloudKitScope, key: &str, ) -> Result<Vec<u8>, CloudHomeError>
fn list_records( &self, scope: &CloudKitScope, prefix: &str, ) -> Result<Vec<String>, CloudHomeError>
fn delete_record( &self, scope: &CloudKitScope, key: &str, ) -> Result<(), CloudHomeError>
fn record_exists( &self, scope: &CloudKitScope, key: &str, ) -> Result<bool, CloudHomeError>
Sourcefn read_versioned_record(
&self,
scope: &CloudKitScope,
key: &str,
) -> Result<CloudVersionedHead, CloudHomeError>
fn read_versioned_record( &self, scope: &CloudKitScope, key: &str, ) -> Result<CloudVersionedHead, CloudHomeError>
Read the exact CKRecord and return its opaque recordChangeTag with the
bytes. A later replacement must mutate this fetched record.
fn create_record( &self, scope: &CloudKitScope, key: &str, data: Vec<u8>, ) -> Result<CloudVersionedHead, CloudHeadCreateError>
Sourcefn replace_record(
&self,
scope: &CloudKitScope,
key: &str,
expected: &CloudHeadVersion,
data: Vec<u8>,
) -> Result<CloudVersionedHead, CloudHeadReplaceError>
fn replace_record( &self, scope: &CloudKitScope, key: &str, expected: &CloudHeadVersion, data: Vec<u8>, ) -> Result<CloudVersionedHead, CloudHeadReplaceError>
Replace by saving the previously fetched CKRecord with
ifServerRecordUnchanged; copying its tag into a new CKRecord is invalid.
Sourcefn begin_atomic_create(
&self,
scope: &CloudKitScope,
) -> Result<CloudKitAtomicCreateBatch, CloudHomeError>
fn begin_atomic_create( &self, scope: &CloudKitScope, ) -> Result<CloudKitAtomicCreateBatch, CloudHomeError>
Open a host-owned local staging batch. Staging never creates CloudKit records; the host keeps payloads in temporary CKAsset files until commit.
Sourcefn stage_atomic_create_record(
&self,
scope: &CloudKitScope,
batch: &CloudKitAtomicCreateBatch,
record: CloudKitRecordCreate,
) -> Result<(), CloudHomeError>
fn stage_atomic_create_record( &self, scope: &CloudKitScope, batch: &CloudKitAtomicCreateBatch, record: CloudKitRecordCreate, ) -> Result<(), CloudHomeError>
Stage one bounded record payload in the host-owned batch.
Sourcefn commit_atomic_create(
&self,
scope: &CloudKitScope,
batch: &CloudKitAtomicCreateBatch,
) -> Result<Vec<CloudKitRecordVersion>, CloudHomeError>
fn commit_atomic_create( &self, scope: &CloudKitScope, batch: &CloudKitAtomicCreateBatch, ) -> Result<Vec<CloudKitRecordVersion>, CloudHomeError>
Create every staged record as one atomic custom-zone modification. Every record uses CloudKit’s create-only save policy. A known precommit failure leaves no record present. If the commit response is lost, the whole batch may be present; preserve those records so the caller can read back every requested key and settle the outcome. Returned versions follow staging order when the response is received.
Sourcefn discard_atomic_create(
&self,
scope: &CloudKitScope,
batch: &CloudKitAtomicCreateBatch,
) -> Result<(), CloudHomeError>
fn discard_atomic_create( &self, scope: &CloudKitScope, batch: &CloudKitAtomicCreateBatch, ) -> Result<(), CloudHomeError>
Discard host-local staging without deleting any CloudKit records the batch may have committed. This is idempotent. On failure, return an error naming the batch; the caller surfaces it and does not hide or retry it.
Sourcefn delete_record_versions(
&self,
scope: &CloudKitScope,
records: &[CloudKitRecordVersion],
) -> Result<(), CloudHomeError>
fn delete_record_versions( &self, scope: &CloudKitScope, records: &[CloudKitRecordVersion], ) -> Result<(), CloudHomeError>
Delete exactly these fetched record versions as one CloudKit atomic zone modification. A changed or missing record fails the whole deletion.