Struct lb_rs::CoreLib

source ·
#[repr(C)]
pub struct CoreLib<Client: Requester, Docs: DocumentService> { pub inner: Arc<Mutex<CoreState<Client, Docs>>>, }

Fields§

§inner: Arc<Mutex<CoreState<Client, Docs>>>

Implementations§

source§

impl CoreLib<Network, OnDiskDocuments>

source

pub fn init(config: &Config) -> Result<Self, UnexpectedError>

source§

impl<Client: Requester, Docs: DocumentService> CoreLib<Client, Docs>

source

pub fn in_tx<F, Out>(&self, f: F) -> LbResult<Out>
where F: FnOnce(&mut CoreState<Client, Docs>) -> LbResult<Out>,

source

pub fn create_account( &self, username: &str, api_url: &str, welcome_doc: bool, ) -> LbResult<Account>

source

pub fn logout_and_exit(self) -> !

This function is used to log out and delete the user’s data from the local filesystem. Don’t call it without warning the user to back up their private key.

source

pub fn import_account(&self, account_string: &str) -> LbResult<Account>

source

pub fn export_account(&self) -> Result<String, LbError>

source

pub fn export_account_qr(&self) -> Result<Vec<u8>, LbError>

source

pub fn get_account(&self) -> Result<Account, LbError>

source

pub fn get_config(&self) -> Result<Config, UnexpectedError>

source

pub fn create_file( &self, name: &str, parent: Uuid, file_type: FileType, ) -> Result<File, LbError>

source

pub fn write_document(&self, id: Uuid, content: &[u8]) -> Result<(), LbError>

source

pub fn get_root(&self) -> Result<File, LbError>

source

pub fn get_children(&self, id: Uuid) -> Result<Vec<File>, UnexpectedError>

source

pub fn get_and_get_children_recursively( &self, id: Uuid, ) -> Result<Vec<File>, LbError>

source

pub fn get_file_by_id(&self, id: Uuid) -> Result<File, LbError>

source

pub fn delete_file(&self, id: Uuid) -> Result<(), LbError>

source

pub fn read_document(&self, id: Uuid) -> Result<DecryptedDocument, LbError>

source

pub fn list_metadatas(&self) -> Result<Vec<File>, UnexpectedError>

source

pub fn rename_file(&self, id: Uuid, new_name: &str) -> Result<(), LbError>

source

pub fn move_file(&self, id: Uuid, new_parent: Uuid) -> Result<(), LbError>

source

pub fn share_file( &self, id: Uuid, username: &str, mode: ShareMode, ) -> Result<(), LbError>

source

pub fn get_pending_shares(&self) -> Result<Vec<File>, UnexpectedError>

source

pub fn delete_pending_share(&self, id: Uuid) -> Result<(), LbError>

source

pub fn create_at_path(&self, path_and_name: &str) -> Result<File, LbError>

source

pub fn get_by_path(&self, path: &str) -> Result<File, LbError>

source

pub fn get_path_by_id(&self, id: Uuid) -> Result<String, UnexpectedError>

source

pub fn list_paths( &self, filter: Option<Filter>, ) -> Result<Vec<String>, UnexpectedError>

source

pub fn get_local_changes(&self) -> Result<Vec<Uuid>, UnexpectedError>

source

pub fn calculate_work(&self) -> Result<SyncStatus, LbError>

source

pub fn sync( &self, f: Option<Box<dyn Fn(SyncProgress)>>, ) -> Result<SyncStatus, LbError>

source

pub fn get_last_synced(&self) -> Result<i64, UnexpectedError>

source

pub fn get_last_synced_human_string(&self) -> Result<String, UnexpectedError>

source

pub fn suggested_docs( &self, settings: RankingWeights, ) -> Result<Vec<Uuid>, UnexpectedError>

source

pub fn get_usage(&self) -> Result<UsageMetrics, LbError>

source

pub fn get_uncompressed_usage_breakdown( &self, ) -> Result<HashMap<Uuid, usize>, UnexpectedError>

source

pub fn get_uncompressed_usage(&self) -> Result<UsageItemMetric, LbError>

source

pub fn get_drawing(&self, id: Uuid) -> Result<Drawing, LbError>

source

pub fn save_drawing(&self, id: Uuid, d: &Drawing) -> Result<(), LbError>

source

pub fn export_drawing( &self, id: Uuid, format: SupportedImageFormats, render_theme: Option<HashMap<ColorAlias, ColorRGB>>, ) -> Result<Vec<u8>, LbError>

source

pub fn export_drawing_to_disk( &self, id: Uuid, format: SupportedImageFormats, render_theme: Option<HashMap<ColorAlias, ColorRGB>>, location: &str, ) -> Result<(), LbError>

source

pub fn import_files<F: Fn(ImportStatus)>( &self, sources: &[PathBuf], dest: Uuid, update_status: &F, ) -> Result<(), LbError>

source

pub fn export_file( &self, id: Uuid, destination: PathBuf, edit: bool, export_progress: Option<Box<dyn Fn(ExportFileInfo)>>, ) -> Result<(), LbError>

source

pub fn search_file_paths( &self, input: &str, ) -> Result<Vec<SearchResultItem>, UnexpectedError>

source

pub fn validate(&self) -> Result<Vec<Warning>, TestRepoError>

source

pub fn upgrade_account_stripe( &self, account_tier: StripeAccountTier, ) -> Result<(), LbError>

source

pub fn upgrade_account_google_play( &self, purchase_token: &str, account_id: &str, ) -> Result<(), LbError>

source

pub fn upgrade_account_app_store( &self, original_transaction_id: String, app_account_token: String, ) -> Result<(), LbError>

source

pub fn cancel_subscription(&self) -> Result<(), LbError>

source

pub fn get_subscription_info(&self) -> Result<Option<SubscriptionInfo>, LbError>

source

pub fn delete_account(&self) -> Result<(), LbError>

source

pub fn admin_disappear_account(&self, username: &str) -> Result<(), LbError>

source

pub fn admin_disappear_file(&self, id: Uuid) -> Result<(), LbError>

source

pub fn admin_list_users( &self, filter: Option<AccountFilter>, ) -> Result<Vec<Username>, LbError>

source

pub fn admin_get_account_info( &self, identifier: AccountIdentifier, ) -> Result<AccountInfo, LbError>

source

pub fn admin_validate_account( &self, username: &str, ) -> Result<AdminValidateAccount, LbError>

source

pub fn admin_validate_server(&self) -> Result<AdminValidateServer, LbError>

source

pub fn admin_file_info( &self, id: Uuid, ) -> Result<AdminFileInfoResponse, LbError>

source

pub fn admin_rebuild_index(&self, index: ServerIndex) -> Result<(), LbError>

source

pub fn admin_set_user_tier( &self, username: &str, info: AdminSetUserTierInfo, ) -> Result<(), LbError>

source

pub fn debug_info(&self, os_info: String) -> String

Trait Implementations§

source§

impl<Client: Clone + Requester, Docs: Clone + DocumentService> Clone for CoreLib<Client, Docs>

source§

fn clone(&self) -> CoreLib<Client, Docs>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<Client, Docs> Freeze for CoreLib<Client, Docs>

§

impl<Client, Docs> RefUnwindSafe for CoreLib<Client, Docs>

§

impl<Client, Docs> Send for CoreLib<Client, Docs>

§

impl<Client, Docs> Sync for CoreLib<Client, Docs>

§

impl<Client, Docs> Unpin for CoreLib<Client, Docs>

§

impl<Client, Docs> UnwindSafe for CoreLib<Client, Docs>

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.
source§

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

source§

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