Expand description
Distributed spatial computing framework
This module provides a comprehensive distributed computing framework for spatial algorithms, enabling scaling across multiple nodes, automatic load balancing, fault tolerance, and efficient data partitioning for massive spatial datasets. It supports both message-passing and shared-memory paradigms with optimized communication patterns.
§Features
- Distributed spatial data structures: Scale KD-trees, spatial indices across nodes
- Automatic data partitioning: Space-filling curves, load-balanced partitioning
- Fault-tolerant computation: Checkpointing, automatic recovery, redundancy
- Adaptive load balancing: Dynamic workload redistribution
- Communication optimization: Bandwidth-aware algorithms, compression
- Hierarchical clustering: Multi-level distributed algorithms
- Streaming spatial analytics: Real-time processing of spatial data streams
- Elastic scaling: Add/remove nodes dynamically
§Architecture
The framework uses a hybrid architecture combining:
- Master-worker pattern for coordination
- Peer-to-peer communication for data exchange
- Hierarchical topology for scalability
- Event-driven programming for responsiveness
§Examples
use scirs2_spatial::distributed::{DistributedSpatialCluster, NodeConfig};
use scirs2_core::ndarray::array;
// Create distributed spatial cluster
let clusterconfig = NodeConfig::new()
.with_node_count(4)
.with_fault_tolerance(true)
.with_load_balancing(true)
.with_compression(true);
let mut cluster = DistributedSpatialCluster::new(clusterconfig)?;
// Distribute large spatial dataset
let large_dataset = array![[0.0, 0.0], [1.0, 0.0]];
cluster.distribute_data(&large_dataset.view()).await?;
// Run distributed k-means clustering
let (centroids, assignments) = cluster.distributed_kmeans(5, 100).await?;
println!("Distributed clustering completed: {} centroids", centroids.nrows());
// Query distributed spatial index
let query_point = array![0.5, 0.5];
let nearest_neighbors = cluster.distributed_knn_search(&query_point.view(), 10).await?;
println!("Found {} nearest neighbors across cluster", nearest_neighbors.len());Structs§
- Cluster
Performance Metrics - Cluster performance metrics
- Cluster
State - Overall cluster state
- Cluster
Statistics - Cluster statistics
- Communication
Layer - Communication layer for inter-node communication
- Communication
Stats - Statistics for communication performance
- Data
Partition - Data partition for distributed processing
- Distributed
Spatial Cluster - Distributed spatial computing cluster
- Distributed
Spatial Index - Distributed spatial index
- Fault
Detector - Fault detector for monitoring node health
- Global
Index Metadata - Global index metadata shared across nodes
- Index
Statistics - Index statistics
- Load
Balancer - Load balancer for distributed workload management
- Load
Metrics - Load metrics for nodes
- Local
Spatial Index - Local spatial index on each node
- Node
Config - Node configuration for distributed cluster
- Node
Health - Node health information
- Node
Instance - Individual node in the distributed cluster
- Partition
Migration - Partition migration instruction
- Query
Parameters - Query parameters
- Rebalance
Plan - Load rebalancing plan
- Recovery
Action - Recovery action
- Recovery
Plan - Recovery plan for fault tolerance
- Routing
Table - Routing table for distributed queries
- Spatial
Bounds - Spatial bounds for data partition
- Spatial
Key - Spatial key for routing
Enums§
- Distributed
Message - Distributed message types
- Failure
Type - Types of failures that can be detected
- Load
Balancing Strategy - Load balancing strategies
- Node
Status - Node status enumeration
- Query
Results - Query results
- Query
Type - Types of distributed queries
- Recovery
Strategy - Recovery strategies for different failure types