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