Struct ServerState

Source
pub struct ServerState<S, A, G, D>{
    pub config: Config,
    pub index_db: Arc<Mutex<ServerV4>>,
    pub stripe_client: S,
    pub google_play_client: G,
    pub app_store_client: A,
    pub document_service: D,
}

Fields§

§config: Config§index_db: Arc<Mutex<ServerV4>>§stripe_client: S§google_play_client: G§app_store_client: A§document_service: D

Implementations§

Source§

impl<S, A, G, D> ServerState<S, A, G, D>

Source

pub async fn new_account( &self, context: RequestContext<NewAccountRequest>, ) -> Result<NewAccountResponse, ServerError<NewAccountError>>

Create a new account given a username, public_key, and root folder. Checks that username is valid, and that username, public_key and root_folder are new. Inserts all of these values into their respective keys along with the default free account tier size

Source

pub async fn get_public_key( &self, context: RequestContext<GetPublicKeyRequest>, ) -> Result<GetPublicKeyResponse, ServerError<GetPublicKeyError>>

Source

pub fn public_key_from_username( &self, username: &str, ) -> Result<GetPublicKeyResponse, ServerError<GetPublicKeyError>>

Source

pub async fn get_username( &self, context: RequestContext<GetUsernameRequest>, ) -> Result<GetUsernameResponse, ServerError<GetUsernameError>>

Source

pub fn username_from_public_key( &self, key: PublicKey, ) -> Result<GetUsernameResponse, ServerError<GetUsernameError>>

Source

pub async fn get_usage( &self, context: RequestContext<GetUsageRequest>, ) -> Result<GetUsageResponse, ServerError<GetUsageError>>

Source

pub fn get_usage_helper<T>( tree: &mut LazyTree<T>, sizes: &HashMap<Uuid, u64>, ) -> Result<Vec<FileUsage>, ServerError<GetUsageHelperError>>
where T: TreeLike,

Source

pub fn get_cap( db: &ServerDb, public_key: &PublicKey, ) -> Result<u64, ServerError<GetUsageHelperError>>

Source

pub async fn delete_account( &self, context: RequestContext<DeleteAccountRequest>, ) -> Result<(), ServerError<DeleteAccountError>>

Source

pub async fn admin_disappear_account( &self, context: RequestContext<AdminDisappearAccountRequest>, ) -> Result<(), ServerError<AdminDisappearAccountError>>

Source

pub async fn admin_list_users( &self, context: RequestContext<AdminListUsersRequest>, ) -> Result<AdminListUsersResponse, ServerError<AdminListUsersError>>

Source

pub async fn admin_get_account_info( &self, context: RequestContext<AdminGetAccountInfoRequest>, ) -> Result<AdminGetAccountInfoResponse, ServerError<AdminGetAccountInfoError>>

Source

pub async fn delete_account_helper( &self, public_key: &PublicKey, free_username: bool, ) -> Result<(), ServerError<DeleteAccountHelperError>>

Source

pub fn is_admin<E: Debug>( db: &ServerDb, public_key: &PublicKey, admins: &HashSet<Username>, ) -> Result<bool, ServerError<E>>

Source§

impl<S, A, G, D> ServerState<S, A, G, D>

Source§

impl<S, A, G, D> ServerState<S, A, G, D>

Source

pub async fn upgrade_account_app_store( &self, context: RequestContext<UpgradeAccountAppStoreRequest>, ) -> Result<UpgradeAccountAppStoreResponse, ServerError<UpgradeAccountAppStoreError>>

Source

pub async fn upgrade_account_google_play( &self, context: RequestContext<UpgradeAccountGooglePlayRequest>, ) -> Result<UpgradeAccountGooglePlayResponse, ServerError<UpgradeAccountGooglePlayError>>

Source

pub async fn upgrade_account_stripe( &self, context: RequestContext<UpgradeAccountStripeRequest>, ) -> Result<UpgradeAccountStripeResponse, ServerError<UpgradeAccountStripeError>>

Source

pub async fn get_subscription_info( &self, context: RequestContext<GetSubscriptionInfoRequest>, ) -> Result<GetSubscriptionInfoResponse, ServerError<GetSubscriptionInfoError>>

Source

pub async fn cancel_subscription( &self, context: RequestContext<CancelSubscriptionRequest>, ) -> Result<CancelSubscriptionResponse, ServerError<CancelSubscriptionError>>

Source

pub async fn admin_set_user_tier( &self, context: RequestContext<AdminSetUserTierRequest>, ) -> Result<AdminSetUserTierResponse, ServerError<AdminSetUserTierError>>

Source

pub async fn stripe_webhooks( &self, request_body: Bytes, stripe_sig: HeaderValue, ) -> Result<(), ServerError<StripeWebhookError>>

Source

pub async fn google_play_notification_webhooks( &self, request_body: Bytes, query_parameters: HashMap<String, String>, ) -> Result<(), ServerError<GooglePlayWebhookError>>

Source

pub async fn app_store_notification_webhook( &self, body: Bytes, ) -> Result<(), ServerError<AppStoreNotificationError>>

Source§

impl<S, A, G, D> ServerState<S, A, G, D>

Source§

impl<S, A, G, D> ServerState<S, A, G, D>

Source§

impl<S, A, G, D> ServerState<S, A, G, D>

Source

pub async fn upsert_file_metadata( &self, context: RequestContext<UpsertRequest>, ) -> Result<(), ServerError<UpsertError>>

Source

pub async fn change_doc( &self, context: RequestContext<ChangeDocRequest>, ) -> Result<(), ServerError<ChangeDocError>>

Source

pub async fn get_document( &self, context: RequestContext<GetDocRequest>, ) -> Result<GetDocumentResponse, ServerError<GetDocumentError>>

Source

pub async fn get_file_ids( &self, context: RequestContext<GetFileIdsRequest>, ) -> Result<GetFileIdsResponse, ServerError<GetFileIdsError>>

Source

pub async fn get_updates( &self, context: RequestContext<GetUpdatesRequest>, ) -> Result<GetUpdatesResponse, ServerError<GetUpdatesError>>

Source

pub async fn admin_disappear_file( &self, context: RequestContext<AdminDisappearFileRequest>, ) -> Result<(), ServerError<AdminDisappearFileError>>

Source

pub async fn admin_validate_account( &self, context: RequestContext<AdminValidateAccountRequest>, ) -> Result<AdminValidateAccount, ServerError<AdminValidateAccountError>>

Source

pub fn validate_account_helper( &self, db: &mut ServerDb, owner: Owner, ) -> SharedResult<AdminValidateAccount>

Source

pub async fn admin_validate_server( &self, context: RequestContext<AdminValidateServerRequest>, ) -> Result<AdminValidateServer, ServerError<AdminValidateServerError>>

Source

pub async fn admin_file_info( &self, context: RequestContext<AdminFileInfoRequest>, ) -> Result<AdminFileInfoResponse, ServerError<AdminFileInfoError>>

Source

pub async fn admin_rebuild_index( &self, context: RequestContext<AdminRebuildIndexRequest>, ) -> Result<(), ServerError<AdminRebuildIndexError>>

Source§

impl<S, A, G, D> ServerState<S, A, G, D>

Trait Implementations§

Source§

impl<S, A, G, D> Clone for ServerState<S, A, G, D>

Source§

fn clone(&self) -> ServerState<S, A, G, D>

Returns a duplicate 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<S, A, G, D> Freeze for ServerState<S, A, G, D>
where S: Freeze, G: Freeze, A: Freeze, D: Freeze,

§

impl<S, A, G, D> RefUnwindSafe for ServerState<S, A, G, D>

§

impl<S, A, G, D> Send for ServerState<S, A, G, D>

§

impl<S, A, G, D> Sync for ServerState<S, A, G, D>

§

impl<S, A, G, D> Unpin for ServerState<S, A, G, D>
where S: Unpin, G: Unpin, A: Unpin, D: Unpin,

§

impl<S, A, G, D> UnwindSafe for ServerState<S, A, G, D>

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

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

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