Skip to content

Commit 45c5e06

Browse files
authored
[ENH]: (Rust client): fix database resolution (#5692)
1 parent e165e3a commit 45c5e06

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
use serde::{Deserialize, Serialize};
2+
use std::collections::HashSet;
23

34
#[derive(Serialize, Deserialize, Debug)]
45
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
56
pub struct GetUserIdentityResponse {
67
pub user_id: String,
78
pub tenant: String,
8-
pub databases: Vec<String>,
9+
pub databases: HashSet<String>,
910
}

rust/chroma/src/client/chroma_http_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ impl ChromaHttpClient {
349349
));
350350
}
351351

352-
let database_name = identity.databases.first().ok_or_else(|| {
352+
let database_name = identity.databases.into_iter().next().ok_or_else(|| {
353353
ChromaClientError::CouldNotResolveDatabaseId(
354354
"Client has access to no databases".to_string(),
355355
)

rust/frontend/src/auth/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::collections::HashSet;
12
use std::fmt::{Display, Formatter};
23
use std::future::{ready, Future};
34
use std::pin::Pin;
@@ -122,7 +123,7 @@ fn default_identity() -> GetUserIdentityResponse {
122123
GetUserIdentityResponse {
123124
user_id: String::new(),
124125
tenant: "default_tenant".to_string(),
125-
databases: vec!["default_database".to_string()],
126+
databases: HashSet::from(["default_database".to_string()]),
126127
}
127128
}
128129

0 commit comments

Comments
 (0)