mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-13 16:32:56 +00:00
bump
This commit is contained in:
committed by
Conrad Ludgate
parent
783260b88a
commit
bdd68bb069
@@ -114,7 +114,7 @@ ed25519-dalek = { version = "2", default-features = false, features = ["rand_cor
|
||||
rsa = "0.9"
|
||||
|
||||
workspace_hack.workspace = true
|
||||
paracord = { version = "0.1.0-rc.5", features = ["serde"] }
|
||||
paracord = { version = "0.1.0-rc.6", features = ["serde"] }
|
||||
|
||||
[dev-dependencies]
|
||||
assert-json-diff.workspace = true
|
||||
|
||||
@@ -203,7 +203,7 @@ async fn authenticate(
|
||||
|
||||
let user: RoleName = db_info.user.into();
|
||||
let user_info = ComputeUserInfo {
|
||||
endpoint: db_info.aux.endpoint_id.resolve().into(),
|
||||
endpoint: db_info.aux.endpoint_id.as_str().into(),
|
||||
user: user.clone(),
|
||||
options: NeonOptions::default(),
|
||||
};
|
||||
|
||||
@@ -87,7 +87,7 @@ impl JwkCacheEntry {
|
||||
self.key_sets
|
||||
.values()
|
||||
// make sure our requested role has access to the key set
|
||||
.filter(|key_set| key_set.role_names.iter().any(|role| *role.resolve() == **role_name))
|
||||
.filter(|key_set| key_set.role_names.iter().any(|role| *role.as_str() == **role_name))
|
||||
// try and find the requested key-id in the key set
|
||||
.find_map(|key_set| {
|
||||
key_set
|
||||
|
||||
@@ -38,9 +38,9 @@ impl LocalBackend {
|
||||
},
|
||||
// TODO(conrad): make this better reflect compute info rather than endpoint info.
|
||||
aux: MetricsAuxInfo {
|
||||
endpoint_id: EndpointIdInt::get_or_intern("local"),
|
||||
project_id: ProjectIdInt::get_or_intern("local"),
|
||||
branch_id: BranchIdInt::get_or_intern("local"),
|
||||
endpoint_id: EndpointIdInt::from_str_or_intern("local"),
|
||||
project_id: ProjectIdInt::from_str_or_intern("local"),
|
||||
branch_id: BranchIdInt::from_str_or_intern("local"),
|
||||
compute_id: "local".into(),
|
||||
cold_start_info: ColdStartInfo::WarmCached,
|
||||
},
|
||||
|
||||
8
proxy/src/cache/project_info.rs
vendored
8
proxy/src/cache/project_info.rs
vendored
@@ -194,7 +194,7 @@ impl ProjectInfoCacheImpl {
|
||||
&self,
|
||||
endpoint_id: &EndpointId,
|
||||
) -> Option<Ref<'_, EndpointIdInt, EndpointInfo>> {
|
||||
let endpoint_id = EndpointIdInt::get(endpoint_id)?;
|
||||
let endpoint_id = EndpointIdInt::try_from_str(endpoint_id)?;
|
||||
self.cache.get(&endpoint_id)
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ impl ProjectInfoCacheImpl {
|
||||
role_name: &RoleName,
|
||||
) -> Option<RoleAccessControl> {
|
||||
let valid_since = self.get_cache_times();
|
||||
let role_name = RoleNameInt::get(role_name)?;
|
||||
let role_name = RoleNameInt::try_from_str(role_name)?;
|
||||
let endpoint_info = self.get_endpoint_cache(endpoint_id)?;
|
||||
endpoint_info.get_role_secret(role_name, valid_since)
|
||||
}
|
||||
@@ -297,10 +297,10 @@ impl ProjectInfoCacheImpl {
|
||||
}
|
||||
|
||||
pub fn maybe_invalidate_role_secret(&self, endpoint_id: &EndpointId, role_name: &RoleName) {
|
||||
let Some(endpoint_id) = EndpointIdInt::get(endpoint_id) else {
|
||||
let Some(endpoint_id) = EndpointIdInt::try_from_str(endpoint_id) else {
|
||||
return;
|
||||
};
|
||||
let Some(role_name) = RoleNameInt::get(role_name) else {
|
||||
let Some(role_name) = RoleNameInt::try_from_str(role_name) else {
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ impl RequestContext {
|
||||
pub(crate) fn set_project(&self, x: MetricsAuxInfo) {
|
||||
let mut this = self.0.try_lock().expect("should not deadlock");
|
||||
if this.endpoint_id.is_none() {
|
||||
this.set_endpoint_id(x.endpoint_id.resolve().into());
|
||||
this.set_endpoint_id(x.endpoint_id.as_str().into());
|
||||
}
|
||||
this.branch = Some(x.branch_id);
|
||||
this.project = Some(x.project_id);
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use core::fmt;
|
||||
|
||||
use paracord::custom_key;
|
||||
|
||||
use crate::types::{AccountId, BranchId, EndpointId, ProjectId, RoleName};
|
||||
@@ -12,92 +10,62 @@ custom_key!(pub struct AccountIdInt);
|
||||
|
||||
impl From<&RoleName> for RoleNameInt {
|
||||
fn from(value: &RoleName) -> Self {
|
||||
RoleNameInt::get_or_intern(value)
|
||||
}
|
||||
}
|
||||
impl fmt::Display for RoleNameInt {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(self.resolve())
|
||||
RoleNameInt::from_str_or_intern(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&EndpointId> for EndpointIdInt {
|
||||
fn from(value: &EndpointId) -> Self {
|
||||
EndpointIdInt::get_or_intern(value)
|
||||
EndpointIdInt::from_str_or_intern(value)
|
||||
}
|
||||
}
|
||||
impl From<EndpointId> for EndpointIdInt {
|
||||
fn from(value: EndpointId) -> Self {
|
||||
EndpointIdInt::get_or_intern(&value)
|
||||
}
|
||||
}
|
||||
impl fmt::Display for EndpointIdInt {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(self.resolve())
|
||||
EndpointIdInt::from_str_or_intern(&value)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&BranchId> for BranchIdInt {
|
||||
fn from(value: &BranchId) -> Self {
|
||||
BranchIdInt::get_or_intern(value)
|
||||
BranchIdInt::from_str_or_intern(value)
|
||||
}
|
||||
}
|
||||
impl From<BranchId> for BranchIdInt {
|
||||
fn from(value: BranchId) -> Self {
|
||||
BranchIdInt::get_or_intern(&value)
|
||||
}
|
||||
}
|
||||
impl AsRef<str> for BranchIdInt {
|
||||
fn as_ref(&self) -> &str {
|
||||
self.resolve()
|
||||
BranchIdInt::from_str_or_intern(&value)
|
||||
}
|
||||
}
|
||||
impl std::ops::Deref for BranchIdInt {
|
||||
type Target = str;
|
||||
fn deref(&self) -> &str {
|
||||
self.resolve()
|
||||
self.as_str()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&ProjectId> for ProjectIdInt {
|
||||
fn from(value: &ProjectId) -> Self {
|
||||
ProjectIdInt::get_or_intern(value)
|
||||
ProjectIdInt::from_str_or_intern(value)
|
||||
}
|
||||
}
|
||||
impl From<ProjectId> for ProjectIdInt {
|
||||
fn from(value: ProjectId) -> Self {
|
||||
ProjectIdInt::get_or_intern(&value)
|
||||
}
|
||||
}
|
||||
impl AsRef<str> for ProjectIdInt {
|
||||
fn as_ref(&self) -> &str {
|
||||
self.resolve()
|
||||
ProjectIdInt::from_str_or_intern(&value)
|
||||
}
|
||||
}
|
||||
impl std::ops::Deref for ProjectIdInt {
|
||||
type Target = str;
|
||||
fn deref(&self) -> &str {
|
||||
self.resolve()
|
||||
}
|
||||
}
|
||||
impl fmt::Display for ProjectIdInt {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(self.resolve())
|
||||
self.as_str()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&AccountId> for AccountIdInt {
|
||||
fn from(value: &AccountId) -> Self {
|
||||
AccountIdInt::get_or_intern(value)
|
||||
AccountIdInt::from_str_or_intern(value)
|
||||
}
|
||||
}
|
||||
impl From<AccountId> for AccountIdInt {
|
||||
fn from(value: AccountId) -> Self {
|
||||
AccountIdInt::get_or_intern(&value)
|
||||
}
|
||||
}
|
||||
impl fmt::Display for AccountIdInt {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(self.resolve())
|
||||
AccountIdInt::from_str_or_intern(&value)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ impl EndpointId {
|
||||
|
||||
#[must_use]
|
||||
pub fn normalize_intern(&self) -> EndpointIdInt {
|
||||
EndpointIdInt::get_or_intern(self.normalize_str())
|
||||
EndpointIdInt::from_str_or_intern(self.normalize_str())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user