Skip to main content

laminar_db/process_function/remote/
mod.rs

1//! Bounded Arrow IPC over a versioned gRPC control stream.
2//!
3//! Each cluster owner connects to its own loopback worker. Replay admission requires the
4//! source-order contract; Python additionally requires a live supervised replay-safe binding.
5//! Authenticated nonlocal worker transport is unsupported.
6
7mod client;
8mod codec;
9mod local_python;
10mod python_environment;
11mod response;
12mod worker;
13
14#[cfg(test)]
15mod tests;
16
17pub use client::RemoteProcessClient;
18pub use local_python::{LocalPythonWorker, LocalPythonWorkerConfig};
19pub use worker::RustReferenceWorker;
20
21#[cfg(all(test, target_os = "linux"))]
22pub(crate) use python_environment::read_only_fixture_config;
23
24#[allow(clippy::doc_markdown, clippy::default_trait_access)] // Generated tonic stubs.
25pub(crate) mod wire {
26    tonic::include_proto!("laminar.process.v1");
27}
28
29const PROTOCOL_VERSION: u32 = 1;
30const MAX_FRAME_BYTES: usize = 8 * 1024 * 1024;
31const MAX_INVOCATION_WIRE_BYTES: usize = 32 * 1024 * 1024;
32const MAX_IN_FLIGHT: usize = 32;
33
34/// Host-assigned invocation scope. Logical activation IDs remain independent of both UUIDs.
35/// A retry retains activation IDs and batch ID but receives a new attempt ID.
36#[derive(Clone, Debug)]
37pub struct RemoteInvocationScope {
38    /// Stable operator identity within the pipeline.
39    pub operator_id: String,
40    /// The one vnode represented by this call.
41    pub vnode: u32,
42    /// Size of the host vnode domain.
43    pub vnode_count: u32,
44    /// Current ownership fence, assigned by the host.
45    pub owner_generation: u64,
46    /// Current recovery generation, assigned by the host.
47    pub recovery_generation: u64,
48    /// Transport batch identity, stable across attempts of this batch.
49    pub batch_id: uuid::Uuid,
50    /// Unique execution attempt identity.
51    pub attempt_id: uuid::Uuid,
52    /// Input watermark, separate from activation event timestamps.
53    pub input_watermark_us: Option<i64>,
54}