lockbook-server 26.4.13

Lockbook's server, exposed as a library for testing.
Documentation
use db_rs::{LookupMap, LookupSet, LookupTable, Single};
use db_rs_derive::Schema;
use lb_rs::model::file_metadata::{DocumentHmac, Owner};
use lb_rs::model::server_meta::ServerMeta;
use lb_rs::service::debug::DebugInfo;
use lb_rs::service::lb_id::LbID;
use serde::{Deserialize, Serialize};
use uuid::Uuid;

use crate::{billing::billing_model::SubscriptionProfile, defense::BandwidthReport};

#[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize)]
pub struct OneKey;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Account {
    pub username: String,
    pub billing_info: SubscriptionProfile,
}

pub type ServerDb = ServerV5;

#[derive(Schema)]
#[cfg_attr(feature = "no-network", derive(Clone))]
pub struct ServerV5 {
    pub usernames: LookupTable<String, Owner>,
    pub metas: LookupTable<Uuid, ServerMeta>,
    pub google_play_ids: LookupTable<String, Owner>,
    pub stripe_ids: LookupTable<String, Owner>,
    pub app_store_ids: LookupTable<String, Owner>,
    pub last_seen: LookupTable<Owner, u64>,
    pub accounts: LookupTable<Owner, Account>,
    pub owned_files: LookupSet<Owner, Uuid>,
    pub shared_files: LookupSet<Owner, Uuid>,
    pub file_children: LookupSet<Uuid, Uuid>,
    pub server_egress: Single<BandwidthReport>,
    pub egress_by_owner: LookupTable<Owner, BandwidthReport>,
    pub scheduled_file_cleanups: LookupTable<(Uuid, DocumentHmac), i64>,
    pub debug_info: LookupMap<Owner, LbID, DebugInfo>,
}