-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RPPL-2593 Device.uid is returning a value that contains dash (#638)
RPPL-2593 Device.uid is returning a value that contains dash (#633) * fix: implement rpc_overriddes * build: cleanup * build: cleanup * fix: remove algorithm * build: cleanup * fix: cleanup device.uid after implementing legacy.device.uid in badger * fix: clippy errors * build: cleanup
- Loading branch information
1 parent
88bb7ff
commit 3270c70
Showing
7 changed files
with
58 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use crate::processor::storage::storage_manager::StorageManager; | ||
use crate::state::platform_state::PlatformState; | ||
use jsonrpsee::core::RpcResult; | ||
use ripple_sdk::{api::storage_property::StoragePropertyData, uuid::Uuid}; | ||
|
||
const UID_SCOPE: &str = "device"; | ||
|
||
pub async fn get_uid( | ||
state: &PlatformState, | ||
app_id: String, | ||
key: &'static str, | ||
) -> RpcResult<String> { | ||
let uid: String; | ||
let mut data = StoragePropertyData { | ||
scope: Some(UID_SCOPE.to_string()), | ||
key, | ||
namespace: app_id.clone(), | ||
value: String::new(), | ||
}; | ||
|
||
if let Ok(id) = StorageManager::get_string_for_scope(state, &data).await { | ||
uid = id; | ||
} else { | ||
// Using app_id as namespace will result in different uid for each app | ||
data.value = Uuid::new_v4().to_string(); | ||
StorageManager::set_string_for_scope(state, &data, None).await?; | ||
uid = data.value; | ||
} | ||
Ok(uid) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters