datex_core/runtime/execution/context/
remote.rs1#[cfg(feature = "compiler")]
2use crate::compiler::scope::CompilationScope;
3use crate::{
4 global::dxb_block::OutgoingContextId,
5 runtime::execution::context::{ExecutionContext, ExecutionMode},
6 values::core_values::endpoint::Endpoint,
7};
8
9#[derive(Debug, Clone, Default)]
10pub struct RemoteExecutionContext {
11 #[cfg(feature = "compiler")]
12 pub compile_scope: CompilationScope,
13 pub endpoint: Endpoint,
14 pub context_id: Option<OutgoingContextId>,
15 pub execution_mode: ExecutionMode,
16}
17
18impl RemoteExecutionContext {
19 pub fn new(
21 endpoint: impl Into<Endpoint>,
22 execution_mode: ExecutionMode,
23 ) -> Self {
24 RemoteExecutionContext {
25 #[cfg(feature = "compiler")]
26 compile_scope: CompilationScope::new(execution_mode),
27 endpoint: endpoint.into(),
28 context_id: None,
29 execution_mode,
30 }
31 }
32}
33
34impl ExecutionContext {
35 pub fn remote(endpoint: impl Into<Endpoint>) -> Self {
36 ExecutionContext::Remote(RemoteExecutionContext::new(
37 endpoint,
38 ExecutionMode::Static,
39 ))
40 }
41
42 pub fn remote_unbounded(endpoint: impl Into<Endpoint>) -> Self {
43 ExecutionContext::Remote(RemoteExecutionContext::new(
44 endpoint,
45 ExecutionMode::unbounded(),
46 ))
47 }
48}