Page MenuHomePhabricator

D11096.diff
No OneTemporary

D11096.diff

diff --git a/services/identity/src/websockets/auth.rs b/services/identity/src/websockets/auth.rs
--- a/services/identity/src/websockets/auth.rs
+++ b/services/identity/src/websockets/auth.rs
@@ -3,7 +3,7 @@
use grpc_clients::tonic::Request;
use identity::get_unauthenticated_client;
use identity::protos::unauthenticated as client_proto;
-use identity_search_messages::AuthMessage;
+use identity_search_messages::IdentitySearchAuthMessage;
use tracing::{debug, error};
use crate::constants::DEFAULT_IDENTITY_ENDPOINT;
@@ -53,7 +53,7 @@
pub async fn handle_auth_message(message: &str) -> Result<(), WebsocketError> {
let auth_message = serde_json::from_str(message.trim());
- let auth_message: AuthMessage = match auth_message {
+ let auth_message: IdentitySearchAuthMessage = match auth_message {
Ok(auth_message) => auth_message,
Err(_) => {
error!("Failed to parse auth message");
diff --git a/services/identity/src/websockets/mod.rs b/services/identity/src/websockets/mod.rs
--- a/services/identity/src/websockets/mod.rs
+++ b/services/identity/src/websockets/mod.rs
@@ -11,7 +11,7 @@
use hyper_tungstenite::HyperWebsocket;
use identity_search_messages::{
ConnectionInitializationResponse, ConnectionInitializationStatus, Heartbeat,
- Messages, SearchQuery, SearchResult, User,
+ IdentitySearchQuery, IdentitySearchResult, IdentitySearchUser, Messages,
};
use serde::{Deserialize, Serialize};
use tokio::net::TcpListener;
@@ -157,12 +157,14 @@
let search_response = send_search_request(&opensearch_url, prefix_query)
.await?
- .json::<SearchResponse<User>>()
+ .json::<SearchResponse<IdentitySearchUser>>()
.await?;
- let usernames: Vec<User> = search_response.into_documents().collect();
+ let usernames: Vec<IdentitySearchUser> =
+ search_response.into_documents().collect();
- let search_result = serde_json::to_string(&SearchResult { hits: usernames })?;
+ let search_result =
+ serde_json::to_string(&IdentitySearchResult { hits: usernames })?;
Ok(search_result)
}
@@ -180,9 +182,9 @@
debug!("Received heartbeat");
Ok(())
}
- Messages::SearchQuery(search_request) => {
+ Messages::IdentitySearchQuery(search_request) => {
let search_result = match search_request {
- SearchQuery::Prefix(prefix_request) => {
+ IdentitySearchQuery::IdentitySearchPrefix(prefix_request) => {
handle_prefix_search(&prefix_request.prefix).await
}
}?;
diff --git a/shared/identity_search_messages/src/messages/auth_messages.rs b/shared/identity_search_messages/src/messages/auth_messages.rs
--- a/shared/identity_search_messages/src/messages/auth_messages.rs
+++ b/shared/identity_search_messages/src/messages/auth_messages.rs
@@ -4,7 +4,7 @@
#[derive(Serialize, Deserialize, Debug)]
#[serde(tag = "type", rename_all = "camelCase")]
-pub struct AuthMessage {
+pub struct IdentitySearchAuthMessage {
#[serde(rename = "userID")]
pub user_id: String,
#[serde(rename = "deviceID")]
diff --git a/shared/identity_search_messages/src/messages/mod.rs b/shared/identity_search_messages/src/messages/mod.rs
--- a/shared/identity_search_messages/src/messages/mod.rs
+++ b/shared/identity_search_messages/src/messages/mod.rs
@@ -16,9 +16,9 @@
#[derive(Debug, Serialize, Deserialize)]
#[serde(untagged)]
pub enum Messages {
- AuthMessage(AuthMessage),
- SearchQuery(SearchQuery),
+ IdentitySearchAuthMessage(IdentitySearchAuthMessage),
+ IdentitySearchQuery(IdentitySearchQuery),
Heartbeat(Heartbeat),
ConnectionInitializationResponse(ConnectionInitializationResponse),
- SearchResult(SearchResult),
+ IdentitySearchResult(IdentitySearchResult),
}
diff --git a/shared/identity_search_messages/src/messages/search_query.rs b/shared/identity_search_messages/src/messages/search_query.rs
--- a/shared/identity_search_messages/src/messages/search_query.rs
+++ b/shared/identity_search_messages/src/messages/search_query.rs
@@ -3,12 +3,12 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
-pub struct Prefix {
+pub struct IdentitySearchPrefix {
pub prefix: String,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "type")]
-pub enum SearchQuery {
- Prefix(Prefix),
+pub enum IdentitySearchQuery {
+ IdentitySearchPrefix(IdentitySearchPrefix),
}
diff --git a/shared/identity_search_messages/src/messages/search_result.rs b/shared/identity_search_messages/src/messages/search_result.rs
--- a/shared/identity_search_messages/src/messages/search_result.rs
+++ b/shared/identity_search_messages/src/messages/search_result.rs
@@ -3,7 +3,7 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
-pub struct User {
+pub struct IdentitySearchUser {
#[serde(rename = "userID")]
pub user_id: String,
pub username: String,
@@ -11,6 +11,6 @@
#[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "type")]
-pub struct SearchResult {
- pub hits: Vec<User>,
+pub struct IdentitySearchResult {
+ pub hits: Vec<IdentitySearchUser>,
}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 7:44 PM (20 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2577159
Default Alt Text
D11096.diff (4 KB)

Event Timeline