pub struct ExecutionOutcome {
pub job_id: Option<String>,
pub request_id: Option<String>,
pub status: OutcomeStatus,
pub result: Option<Value>,
pub error: Option<ExecutionError>,
pub retry_after_seconds: Option<f64>,
}Fields§
§job_id: Option<String>§request_id: Option<String>§status: OutcomeStatus§result: Option<Value>§error: Option<ExecutionError>§retry_after_seconds: Option<f64>Implementations§
Source§impl ExecutionOutcome
impl ExecutionOutcome
Sourcepub fn success<T>(
job_id: impl Into<String>,
request_id: impl Into<String>,
result: T,
) -> ExecutionOutcomewhere
T: Serialize,
pub fn success<T>(
job_id: impl Into<String>,
request_id: impl Into<String>,
result: T,
) -> ExecutionOutcomewhere
T: Serialize,
Examples found in repository?
examples/socket_runner.rs (lines 27-34)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12 let runtime = RunnerRuntime::new()?;
13
14 #[cfg(feature = "otel")]
15 {
16 let _guard = runtime.enter();
17 init_tracing("rrq-runner")?;
18 }
19
20 #[cfg(feature = "otel")]
21 let telemetry = OtelTelemetry;
22 #[cfg(not(feature = "otel"))]
23 let telemetry = NoopTelemetry;
24
25 let mut registry = Registry::new();
26 registry.register("echo", |request| async move {
27 ExecutionOutcome::success(
28 request.job_id.clone(),
29 request.request_id.clone(),
30 json!({
31 "job_id": request.job_id,
32 "params": request.params,
33 }),
34 )
35 });
36
37 let tcp_socket = std::env::var(ENV_RUNNER_TCP_SOCKET).map_err(|_| {
38 std::io::Error::new(
39 std::io::ErrorKind::InvalidInput,
40 "RRQ_RUNNER_TCP_SOCKET must be set",
41 )
42 })?;
43 let addr = parse_tcp_socket(&tcp_socket)?;
44 runtime.run_tcp_with(®istry, addr, &telemetry)
45}pub fn retry( job_id: impl Into<String>, request_id: impl Into<String>, message: impl Into<String>, retry_after_seconds: Option<f64>, ) -> ExecutionOutcome
pub fn timeout( job_id: impl Into<String>, request_id: impl Into<String>, message: impl Into<String>, ) -> ExecutionOutcome
pub fn error( job_id: impl Into<String>, request_id: impl Into<String>, message: impl Into<String>, ) -> ExecutionOutcome
pub fn handler_not_found( job_id: impl Into<String>, request_id: impl Into<String>, message: impl Into<String>, ) -> ExecutionOutcome
Trait Implementations§
Source§impl Clone for ExecutionOutcome
impl Clone for ExecutionOutcome
Source§fn clone(&self) -> ExecutionOutcome
fn clone(&self) -> ExecutionOutcome
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExecutionOutcome
impl Debug for ExecutionOutcome
Source§impl<'de> Deserialize<'de> for ExecutionOutcome
impl<'de> Deserialize<'de> for ExecutionOutcome
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ExecutionOutcome, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ExecutionOutcome, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ExecutionOutcome
impl Serialize for ExecutionOutcome
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ExecutionOutcome
impl RefUnwindSafe for ExecutionOutcome
impl Send for ExecutionOutcome
impl Sync for ExecutionOutcome
impl Unpin for ExecutionOutcome
impl UnsafeUnpin for ExecutionOutcome
impl UnwindSafe for ExecutionOutcome
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more