Store

Struct Store 

Source
pub struct Store { /* private fields */ }

Implementations§

Source§

impl Store

Source

pub fn new(db_path: impl AsRef<Path>) -> ApiResult<Self>

Source

pub fn new_shared_memory(db_name: &str) -> ApiResult<Self>

Creates a store backed by an in-memory database that shares its memory API (required for autofill sync tests).

Source

pub fn add_credit_card( &self, fields: UpdatableCreditCardFields, ) -> ApiResult<CreditCard>

Source

pub fn get_credit_card(&self, guid: String) -> ApiResult<CreditCard>

Source

pub fn get_all_credit_cards(&self) -> ApiResult<Vec<CreditCard>>

Source

pub fn count_all_credit_cards(&self) -> ApiResult<i64>

Source

pub fn update_credit_card( &self, guid: String, credit_card: UpdatableCreditCardFields, ) -> ApiResult<()>

Source

pub fn delete_credit_card(&self, guid: String) -> ApiResult<bool>

Source

pub fn touch_credit_card(&self, guid: String) -> ApiResult<()>

Source

pub fn add_address( &self, new_address: UpdatableAddressFields, ) -> ApiResult<Address>

Source

pub fn add_address_with_meta( &self, entry_with_meta: UpdatableAddressFieldsWithMeta, ) -> ApiResult<Address>

Adds an address including metadata. Normally you will use add_address instead, and the metadata (guid, timestamps, change counter) will be taken care of here. However, in some cases this method is necessary, for example when migrating data from another store that already contains the metadata.

Source

pub fn add_many_addresses_with_meta( &self, entries_with_meta: Vec<UpdatableAddressFieldsWithMeta>, ) -> ApiResult<Vec<AddressBulkResultEntry>>

Adds multiple addresses including metadata, with a result per record.

Source

pub fn add_many_address_tombstones( &self, tombstones: Vec<AddressTombstone>, ) -> ApiResult<Vec<AddressBulkTombstoneResultEntry>>

Adds tombstones for addresses whose deletion has not yet been uploaded, with a result per record.

Source

pub fn delete_all_addresses(&self) -> ApiResult<()>

Removes every address and every address tombstone.

Source

pub fn get_address(&self, guid: String) -> ApiResult<Address>

Source

pub fn get_all_addresses(&self) -> ApiResult<Vec<Address>>

Source

pub fn count_all_addresses(&self) -> ApiResult<i64>

Source

pub fn update_address( &self, guid: String, address: UpdatableAddressFields, ) -> ApiResult<()>

Source

pub fn update_address_with_meta( &self, entry_with_meta: UpdatableAddressFieldsWithMeta, ) -> ApiResult<()>

Updates an address including metadata, setting both its fields and its timestamps and times_used to the supplied values. Normally you will use update_address instead, which leaves time_last_modified to this store; this is for keeping a record identical to one held elsewhere. Errors with NoSuchRecord if the guid is absent.

Source

pub fn delete_address(&self, guid: String) -> ApiResult<bool>

Source

pub fn touch_address(&self, guid: String) -> ApiResult<()>

Source

pub fn add_passport( &self, fields: UpdatablePassportFields, ) -> ApiResult<Passport>

Source

pub fn get_passport(&self, guid: String) -> ApiResult<Passport>

Source

pub fn get_all_passports(&self) -> ApiResult<Vec<Passport>>

Source

pub fn count_all_passports(&self) -> ApiResult<i64>

Source

pub fn update_passport( &self, guid: String, passport: UpdatablePassportFields, ) -> ApiResult<()>

Source

pub fn delete_passport(&self, guid: String) -> ApiResult<bool>

Source

pub fn touch_passport(&self, guid: String) -> ApiResult<()>

Source

pub fn scrub_encrypted_data(self: Arc<Self>) -> ApiResult<()>

Source

pub fn scrub_undecryptable_credit_card_data_for_remote_replacement( self: Arc<Self>, local_encryption_key: String, ) -> ApiResult<CreditCardsDeletionMetrics>

Source

pub fn run_maintenance(&self) -> ApiResult<()>

Source

pub fn shutdown(&self)

Source

pub fn register_with_sync_manager(self: Arc<Self>)

Source

pub fn create_credit_cards_sync_engine(self: Arc<Self>) -> Box<dyn SyncEngine>

Source

pub fn create_addresses_sync_engine(self: Arc<Self>) -> Box<dyn SyncEngine>

Source§

impl Store

Source

pub fn addresses_bridged_engine(self: Arc<Self>) -> Arc<AddressesBridgedEngine>

Returns a bridged sync engine for addresses, for use by Desktop’s Sync framework. Constructing a ConfigSyncEngine only assembles structs and never touches the DB, so this cannot fail.

Trait Implementations§

§

impl<UT> LiftRef<UT> for Store

§

impl<UT> LowerError<UT> for Store

§

fn lower_error(obj: Self) -> RustBuffer

Lower this value for scaffolding function return Read more
§

impl<UT> LowerReturn<UT> for Store

§

type ReturnType = <Arc<Store> as LowerReturn<UniFfiTag>>::ReturnType

The type that should be returned by scaffolding functions for this type. Read more
§

fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>

Lower the return value from an scaffolding call Read more
§

fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>

Lower the return value for failed argument lifts Read more
§

impl<UT> TypeId<UT> for Store

§

const TYPE_ID_META: MetadataBuffer

Auto Trait Implementations§

§

impl !Freeze for Store

§

impl !RefUnwindSafe for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl !UnwindSafe for Store

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
§

unsafe fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<> Read more
§

unsafe fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,