/// Modifies the account corresponding to the provided `id` with the provided `settings`
/// in Redis. Returns the modified account (tokens remain encrypted)
Modifies the account corresponding to the provided `id` with the provided `settings`
in Redis. Returns the modified account (tokens remain encrypted)
Modifies the account corresponding to the provided ` id ` with the provided ` settings ` in Redis . Returns the modified account ( tokens remain encrypted )
async fn redis_modify_account(
        &self,
        id: Uuid,
        settings: EncryptedAccountSettings,
    ) -> Result<AccountWithEncryptedTokens, NodeStoreError> {
        let mut pipe = redis_crate::pipe();
        pipe.atomic();
        let accounts_key = accounts_key(&self.db_prefix, id);
        if let Some(ref endpoint) = settings.ilp_over_btp_url {
            pipe.hset(&accounts_key, "ilp_over_btp_url", endpoint);
        }
        if let Some(ref endpoint) = settings.ilp_over_http_url {
            pipe.hset(&accounts_key, "ilp_over_http_url", endpoint);
        }
        if let Some(ref token) = settings.ilp_over_btp_outgoing_token {
            pipe.hset(&accounts_key, "ilp_over_btp_outgoing_token", token.as_ref());
        }
        if let Some(ref token) = settings.ilp_over_http_outgoing_token {
            pipe.hset(
                &accounts_key,
                "ilp_over_http_outgoing_token",
                token.as_ref(),
            );
        }
        if let Some(ref token) = settings.ilp_over_btp_incoming_token {
            pipe.hset(&accounts_key, "ilp_over_btp_incoming_token", token.as_ref());
        }
        if let Some(ref token) = settings.ilp_over_http_incoming_token {
            pipe.hset(
                &accounts_key,
                "ilp_over_http_incoming_token",
                token.as_ref(),
            );
        }
        if let Some(settle_threshold) = settings.settle_threshold {
            pipe.hset(&accounts_key, "settle_threshold", settle_threshold);
        }
        if let Some(settle_to) = settings.settle_to {
            if settle_to > std::i64::MAX as u64 {
                // Redis cannot handle values greater than i64::MAX (other stores maybe can though)
                return Err(NodeStoreError::InvalidAccount(
                    CreateAccountError::ParamTooLarge("settle_to".to_owned()),
                ));
            }
            pipe.hset(&accounts_key, "settle_to", settle_to);
        }
        pipe.query_async(&mut self.connection.clone()).await?;
        // return the updated account
        self.redis_get_account(id).await
    }
async fn redis_modify_account ( & self , id : Uuid , settings : EncryptedAccountSettings , ) -> Result < AccountWithEncryptedTokens , NodeStoreError > { let mut pipe = redis_crate :: pipe ( ) ; pipe . atomic ( ) ; let accounts_key = accounts_key ( & self . db_prefix , id ) ; if let Some ( ref endpoint ) = settings . ilp_over_btp_url { pipe . hset ( & accounts_key , " " , endpoint ) ; } if let Some ( ref endpoint ) = settings . ilp_over_http_url { pipe . hset ( & accounts_key , " " , endpoint ) ; } if let Some ( ref token ) = settings . ilp_over_btp_outgoing_token { pipe . hset ( & accounts_key , " " , token . as_ref ( ) ) ; } if let Some ( ref token ) = settings . ilp_over_http_outgoing_token { pipe . hset ( & accounts_key , " " , token . as_ref ( ) , ) ; } if let Some ( ref token ) = settings . ilp_over_btp_incoming_token { pipe . hset ( & accounts_key , " " , token . as_ref ( ) ) ; } if let Some ( ref token ) = settings . ilp_over_http_incoming_token { pipe . hset ( & accounts_key , " " , token . as_ref ( ) , ) ; } if let Some ( settle_threshold ) = settings . settle_threshold { pipe . hset ( & accounts_key , " " , settle_threshold ) ; } if let Some ( settle_to ) = settings . settle_to { if settle_to > std :: i64 :: MAX as u64 { // Redis cannot handle values greater than i64::MAX (other stores maybe can though) return Err ( NodeStoreError :: InvalidAccount ( CreateAccountError :: ParamTooLarge ( " " . to_owned ( ) ) , ) ) ; } pipe . hset ( & accounts_key , " " , settle_to ) ; } pipe . query_async ( & mut self . connection . clone ( ) ) . await ? ; // return the updated account self . redis_get_account ( id ) . await }
Modifies the account corresponding to the provided `id` with the provided `settings`
in Redis.
Modifies the account corresponding to the provided ` id ` with the provided ` settings ` in Redis .
&self
id
Uuid
settings
EncryptedAccountSettings