-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9eb4d72
commit d893ed4
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use crate::api::v3; | ||
|
||
#[derive(Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] | ||
pub struct Request {} | ||
|
||
super::super::impl_convert!( | ||
struct Request = v3::Empty { | ||
} | ||
); | ||
|
||
#[derive(Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] | ||
pub enum Response { | ||
#[default] | ||
Unknown = 0, | ||
Serving = 1, | ||
NotServing = 2, | ||
} | ||
|
||
impl From<i32> for Response { | ||
fn from(value: i32) -> Self { | ||
match value { | ||
0 => Self::Unknown, | ||
1 => Self::Serving, | ||
2 => Self::NotServing, | ||
_ => Self::Unknown, | ||
} | ||
} | ||
} | ||
|
||
impl From<Response> for v3::worker::HealthCheckReply { | ||
fn from(value: Response) -> Self { | ||
Self { | ||
status: value as i32, | ||
} | ||
} | ||
} | ||
|
||
impl From<v3::worker::HealthCheckReply> for Response { | ||
fn from(value: v3::worker::HealthCheckReply) -> Self { | ||
value.status.into() | ||
} | ||
} | ||
|
||
super::super::impl_convert!(req Response : v3::worker::HealthCheckReply); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub mod health_check; | ||
pub mod process; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use super::super::Output; | ||
|
||
use crate::api::v3; | ||
|
||
pub struct Response { | ||
pub communication_token: String, | ||
pub output: Output, | ||
} | ||
|
||
super::super::impl_convert!( | ||
struct Response = v3::worker::ProcessReply { | ||
communication_token, | ||
output = option output, | ||
} | ||
); |