mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-31 12:00:42 +00:00
control_plane: implement attach hook
This commit is contained in:
@@ -39,3 +39,16 @@ pub struct ValidateResponseTenant {
|
||||
pub id: TenantId,
|
||||
pub valid: bool,
|
||||
}
|
||||
|
||||
#[cfg(testing)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct AttachHookRequest {
|
||||
tenant_id: TenantId,
|
||||
pageserver_id: Option<NodeId>,
|
||||
}
|
||||
|
||||
#[cfg(testing)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct AttachHookResponse {
|
||||
gen: Option<u32>,
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ impl Id {
|
||||
Id::from(tli_buf)
|
||||
}
|
||||
|
||||
fn hex_encode(&self) -> String {
|
||||
pub fn hex_encode(&self) -> String {
|
||||
static HEX: &[u8] = b"0123456789abcdef";
|
||||
|
||||
let mut buf = vec![0u8; self.0.len() * 2];
|
||||
@@ -133,6 +133,10 @@ macro_rules! id_newtype {
|
||||
pub const fn from_array(b: [u8; 16]) -> Self {
|
||||
$t(Id(b))
|
||||
}
|
||||
|
||||
pub fn hex_encode(&self) -> String {
|
||||
self.0.hex_encode()
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for $t {
|
||||
|
||||
Reference in New Issue
Block a user