async fn new(
        persona_id: LocalPersonaId,
        global_account_id: GlobalAccountId,
        lifetime: AccountLifetime,
        context_proxy: AccountHandlerContextProxy,
        lock_request_sender: lock_request::Sender,
        inspect_parent: &Node,
    ) -> Result<Account, AccountManagerError> {
        let task_group = TaskGroup::new();
        let token_manager_task_group = task_group
            .create_child()
            .await
            .map_err(|_| AccountManagerError::new(ApiError::RemovalInProgress))?;
        let key_manager_task_group = task_group
            .create_child()
            .await
            .map_err(|_| AccountManagerError::new(ApiError::RemovalInProgress))?;
        let default_persona_task_group = task_group
            .create_child()
            .await
            .map_err(|_| AccountManagerError::new(ApiError::RemovalInProgress))?;
        let auth_provider_supplier = AuthProviderSupplier::new(context_proxy);
        let token_manager = Arc::new(match &lifetime {
            AccountLifetime::Ephemeral => {
                TokenManager::new_in_memory(auth_provider_supplier, token_manager_task_group)
            }
            AccountLifetime::Persistent { account_dir } => {
                let token_db_path = account_dir.join(TOKEN_DB);
                TokenManager::new(&token_db_path, auth_provider_supplier, token_manager_task_group)
                    .account_manager_error(ApiError::Unknown)?
            }
        });
        let key_manager = Arc::new(KeyManager::new(key_manager_task_group));
        let lifetime = Arc::new(lifetime);
        let account_inspect = inspect::Account::new(inspect_parent);
        Ok(Self {
            global_id: global_account_id,
            lifetime: Arc::clone(&lifetime),
            default_persona: Arc::new(Persona::new(
                persona_id,
                lifetime,
                token_manager,
                key_manager,
                default_persona_task_group,
                inspect_parent,
            )),
            task_group,
            lock_request_sender,
            inspect: account_inspect,
        })
    }
/// Manually construct an account object, shouldn't normally be called directly.
Manually construct an account object, shouldn't normally be called directly.
Manually construct an account object shouldn ' t normally be called directly .
async fn new(
        persona_id: LocalPersonaId,
        global_account_id: GlobalAccountId,
        lifetime: AccountLifetime,
        context_proxy: AccountHandlerContextProxy,
        lock_request_sender: lock_request::Sender,
        inspect_parent: &Node,
    ) -> Result<Account, AccountManagerError> {
        let task_group = TaskGroup::new();
        let token_manager_task_group = task_group
            .create_child()
            .await
            .map_err(|_| AccountManagerError::new(ApiError::RemovalInProgress))?;
        let key_manager_task_group = task_group
            .create_child()
            .await
            .map_err(|_| AccountManagerError::new(ApiError::RemovalInProgress))?;
        let default_persona_task_group = task_group
            .create_child()
            .await
            .map_err(|_| AccountManagerError::new(ApiError::RemovalInProgress))?;
        let auth_provider_supplier = AuthProviderSupplier::new(context_proxy);
        let token_manager = Arc::new(match &lifetime {
            AccountLifetime::Ephemeral => {
                TokenManager::new_in_memory(auth_provider_supplier, token_manager_task_group)
            }
            AccountLifetime::Persistent { account_dir } => {
                let token_db_path = account_dir.join(TOKEN_DB);
                TokenManager::new(&token_db_path, auth_provider_supplier, token_manager_task_group)
                    .account_manager_error(ApiError::Unknown)?
            }
        });
        let key_manager = Arc::new(KeyManager::new(key_manager_task_group));
        let lifetime = Arc::new(lifetime);
        let account_inspect = inspect::Account::new(inspect_parent);
        Ok(Self {
            global_id: global_account_id,
            lifetime: Arc::clone(&lifetime),
            default_persona: Arc::new(Persona::new(
                persona_id,
                lifetime,
                token_manager,
                key_manager,
                default_persona_task_group,
                inspect_parent,
            )),
            task_group,
            lock_request_sender,
            inspect: account_inspect,
        })
    }
async fn new ( persona_id : LocalPersonaId , global_account_id : GlobalAccountId , lifetime : AccountLifetime , context_proxy : AccountHandlerContextProxy , lock_request_sender : lock_request :: Sender , inspect_parent : & Node , ) -> Result < Account , AccountManagerError > { let task_group = TaskGroup :: new ( ) ; let token_manager_task_group = task_group . create_child ( ) . await . map_err ( | _ | AccountManagerError :: new ( ApiError :: RemovalInProgress ) ) ? ; let key_manager_task_group = task_group . create_child ( ) . await . map_err ( | _ | AccountManagerError :: new ( ApiError :: RemovalInProgress ) ) ? ; let default_persona_task_group = task_group . create_child ( ) . await . map_err ( | _ | AccountManagerError :: new ( ApiError :: RemovalInProgress ) ) ? ; let auth_provider_supplier = AuthProviderSupplier :: new ( context_proxy ) ; let token_manager = Arc :: new ( match & lifetime { AccountLifetime :: Ephemeral => { TokenManager :: new_in_memory ( auth_provider_supplier , token_manager_task_group ) } AccountLifetime :: Persistent { account_dir } => { let token_db_path = account_dir . join ( TOKEN_DB ) ; TokenManager :: new ( & token_db_path , auth_provider_supplier , token_manager_task_group ) . account_manager_error ( ApiError :: Unknown ) ? } } ) ; let key_manager = Arc :: new ( KeyManager :: new ( key_manager_task_group ) ) ; let lifetime = Arc :: new ( lifetime ) ; let account_inspect = inspect :: Account :: new ( inspect_parent ) ; Ok ( Self { global_id : global_account_id , lifetime : Arc :: clone ( & lifetime ) , default_persona : Arc :: new ( Persona :: new ( persona_id , lifetime , token_manager , key_manager , default_persona_task_group , inspect_parent , ) ) , task_group , lock_request_sender , inspect : account_inspect , } ) }
Manually construct an account object, shouldn't normally be called directly.
Manually construct an account object shouldn ' t normally be called directly .
persona_id
LocalPersonaId
global_account_id
GlobalAccountId
lifetime
AccountLifetime
context_proxy
AccountHandlerContextProxy
lock_request_sender
lock_request::Sender
inspect_parent
&Node
persona_id
LocalPersonaId
global_account_id
GlobalAccountId
lifetime
AccountLifetime
context_proxy
AccountHandlerContextProxy
lock_request_sender
lock_request::Sender
inspect_parent
&Node