Skip to main content

ralph_workflow/cloud/
mod.rs

1//! Cloud integration for containerized deployments.
2//!
3//! This module provides abstractions for ralph-workflow to run in cloud
4//! environments with external orchestration. All cloud functionality is:
5//!
6//! - **Environment-variable configured only** (not in config files)
7//! - **Disabled by default**
8//! - **Invisible to CLI users** (no CLI flags, no help text)
9//! - **Purely additive** (zero behavior change when disabled)
10//!
11//! ## Architecture
12//!
13//! Cloud support is trait-based for testability:
14//! - `CloudReporter` - Abstract interface for progress reporting
15//! - `NoopCloudReporter` - Default (does nothing)
16//! - `HttpCloudReporter` - Production HTTP API client (in io boundary)
17//! - `MockCloudReporter` - Testing (captures calls)
18//!
19//! ## Boundary Modules
20//!
21//! - `io/` - HTTP client for cloud API communication
22//! - `runtime/` - Thread spawning for heartbeat background task
23
24pub mod io;
25pub mod io_redaction;
26pub mod redaction;
27pub mod runtime;
28pub mod types;
29
30pub use types::{CloudError, PipelineResult, ProgressEventType, ProgressUpdate};
31
32pub type HttpCloudReporter = crate::cloud::io::HttpCloudReporter;
33pub type HeartbeatGuard = crate::cloud::runtime::HeartbeatGuard;
34
35pub trait CloudReporter: Send + Sync {
36    fn report_progress(&self, update: &ProgressUpdate) -> Result<(), CloudError>;
37    fn heartbeat(&self) -> Result<(), CloudError>;
38    fn report_completion(&self, result: &PipelineResult) -> Result<(), CloudError>;
39}
40
41pub struct NoopCloudReporter;
42
43impl CloudReporter for NoopCloudReporter {
44    fn report_progress(&self, _update: &ProgressUpdate) -> Result<(), CloudError> {
45        Ok(())
46    }
47
48    fn heartbeat(&self) -> Result<(), CloudError> {
49        Ok(())
50    }
51
52    fn report_completion(&self, _result: &PipelineResult) -> Result<(), CloudError> {
53        Ok(())
54    }
55}
56
57#[cfg(any(test, feature = "test-utils"))]
58pub mod mock;
59#[cfg(any(test, feature = "test-utils"))]
60pub use mock::MockCloudReporter;