Skip to content

Commit

Permalink
Some debug derivations and implementations (#545)
Browse files Browse the repository at this point in the history
This is just to be able to stick tracing::instrument in places, it's
especially useful to be able to do this on TypedSocketSender::send
  • Loading branch information
pretentious7 authored Jan 10, 2024
1 parent 3ac3c53 commit d27db21
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plane/src/drone/docker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub mod types;
/// The existence of this label is used to determine whether a container is managed by Plane.
const PLANE_DOCKER_LABEL: &str = "dev.plane.backend";

#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct PlaneDocker {
docker: Docker,
runtime: Option<String>,
Expand Down
8 changes: 7 additions & 1 deletion plane/src/typed_socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ pub struct TypedSocketSender<A> {
Arc<dyn Fn(SocketAction<A>) -> Result<(), TypedSocketError> + 'static + Send + Sync>,
}

impl<T> Debug for TypedSocketSender<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("typed socket sender")
}
}

#[derive(Debug, thiserror::Error)]
pub enum TypedSocketError {
#[error("Socket closed")]
Expand All @@ -47,7 +53,7 @@ impl<A> From<TrySendError<A>> for TypedSocketError {
}
}

impl<A> TypedSocketSender<A> {
impl<A: Debug> TypedSocketSender<A> {
pub fn send(&self, message: A) -> Result<(), TypedSocketError> {
(self.inner_send)(SocketAction::Send(message))?;
Ok(())
Expand Down
1 change: 1 addition & 0 deletions plane/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ impl Default for ExponentialBackoff {
}
}

#[derive(Debug)]
pub struct GuardHandle {
handle: JoinHandle<()>,
}
Expand Down

0 comments on commit d27db21

Please sign in to comment.