Skip to main content

oxigeo_edge/
lib.rs

1//! # OxiGeo Edge Computing Platform
2//!
3//! `oxigeo-edge` provides edge computing capabilities for geospatial data processing
4//! with a focus on:
5//! - Minimal binary footprint for embedded deployment
6//! - Offline-first architecture with local caching
7//! - Edge-to-cloud synchronization with conflict resolution
8//! - Resource-constrained device support
9//!
10//! ## Features
11//!
12//! - **Edge Runtime**: Lightweight runtime optimized for resource-constrained devices
13//! - **Synchronization**: [`sync::SyncManager`] drives edge-to-cloud sync
14//!   against any caller-supplied [`SyncProtocol`]. A real, non-default
15//!   `http-sync`-gated [`sync::HttpSyncProtocol`] is provided for REST
16//!   backends; production code must inject its own protocol (there is no
17//!   hidden in-memory default) -- see [`sync::SyncManager::new`].
18//! - **CRDT-based Conflict Resolution**: Automatic conflict resolution for distributed nodes
19//! - **Edge Compression**: Optimized compression for bandwidth-limited environments
20//! - **Local Caching**: Offline-first caching strategy
21//! - **Resource Management**: Memory and CPU management for constrained devices
22//!
23//! ## Example
24//!
25//! ```rust,no_run
26//! use oxigeo_edge::{EdgeRuntime, EdgeConfig};
27//!
28//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
29//! // Create edge runtime with minimal footprint
30//! let config = EdgeConfig::minimal();
31//! let runtime = EdgeRuntime::new(config).await?;
32//!
33//! // Process data locally with caching
34//! // Sync with cloud when connection available
35//! # Ok(())
36//! # }
37//! ```
38
39#![cfg_attr(docsrs, feature(doc_cfg))]
40#![warn(missing_docs)]
41#![deny(unsafe_code)]
42
43pub mod cache;
44pub mod compression;
45pub mod conflict;
46pub mod error;
47pub mod resource;
48pub mod runtime;
49pub mod sync;
50
51pub use cache::{Cache, CacheConfig, CacheEntry, CachePolicy};
52pub use compression::{AdaptiveCompressor, CompressionLevel, CompressionStrategy, EdgeCompressor};
53pub use conflict::{ConflictResolver, CrdtMap, CrdtSet, VectorClock};
54pub use error::{EdgeError, Result};
55pub use resource::{ResourceConstraints, ResourceManager, ResourceMetrics};
56pub use runtime::{EdgeConfig, EdgeRuntime, RuntimeMode};
57#[cfg(feature = "http-sync")]
58pub use sync::{HttpSyncConfig, HttpSyncProtocol};
59pub use sync::{SyncManager, SyncProtocol, SyncStatus, SyncStrategy};
60
61/// Edge computing version
62pub const VERSION: &str = env!("CARGO_PKG_VERSION");
63
64/// Default cache size for edge devices (10 MB)
65pub const DEFAULT_CACHE_SIZE: usize = 10 * 1024 * 1024;
66
67/// Default sync interval (5 minutes)
68pub const DEFAULT_SYNC_INTERVAL_SECS: u64 = 300;
69
70/// Maximum memory usage for edge runtime (50 MB)
71pub const MAX_MEMORY_USAGE: usize = 50 * 1024 * 1024;