-
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 (#633) (… (
#660) RPPL-2593 Device.uid is returning a value that contains dash (#633) (… (#657) RPPL-2593 Device.uid is returning a value that contains dash (#633) (#656) * 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 Co-authored-by: Suresh <[email protected]>
- Loading branch information
1 parent
52999ca
commit 8eedd0c
Showing
7 changed files
with
70 additions
and
105 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