feat: impement kube manifest caching in kube_cache, also fix Server to request data from the cache, instead of saving it
All checks were successful
/ build (push) Successful in 6m33s

This commit is contained in:
Tamipes 2026-06-07 16:03:44 +02:00
parent 6db804cdc1
commit 46c3a994c6
3 changed files with 207 additions and 185 deletions

View file

@ -115,7 +115,45 @@ pub trait MinecraftServerHandle: Clone {
tracing::trace!("data exchanged while proxying status: {:?}", data_amount);
Ok(())
}
async fn query_description(&self) -> Result<Box<dyn StatusTrait>, OpaqueError>;
async fn query_description(&self) -> Result<Box<dyn StatusTrait>, OpaqueError> {
let status = self.query_status().await?;
match status {
ServerDeploymentStatus::Connectable(mut tcp_stream) => {
let handshake = crate::packets::serverbound::handshake::Handshake::create(
crate::types::VarInt::from(746).ok_or("could not create VarInt WTF?")?,
crate::types::VarString::from(self.get_addr()),
crate::types::UShort::from(1234),
crate::types::VarInt::from(1).ok_or("could not create VarInt WTF?")?,
)
.ok_or("failed to create handshake packet from scratch... WTF?")?;
handshake
.send_packet(&mut tcp_stream)
.await
.map_err(|_e| "failed to send handshake packet to server")?;
let status_rq = crate::packets::Packet::from_bytes(0, Vec::new())
.ok_or("Failed to create status request packet from scratch")?;
status_rq
.send_packet(&mut tcp_stream)
.await
.map_err(|_e| "failed to send status request packet to server")?;
let return_packet = crate::packets::Packet::parse(&mut tcp_stream).await?;
let status_response =
crate::packets::clientbound::status::StatusResponse::parse(return_packet)
.await
.unwrap();
return status_response.get_json().ok_or(OpaqueError::create(
"failed to parse status response from server",
));
}
_ => {
return Err(OpaqueError::create(&format!(
"server is not running; status={:?}",
status
)))
}
}
}
}
pub trait MinecraftAPI<T> {