mars-shard · shadow
Public declarations and documentation for mars-shard::shadow.
Prototype / draft — separate from production registry operations.
Package: mars-shard · Workspace version: 0.1.0 · Module: shadow
Status: prototype / draft. This is not the production registry topology.
This reference follows declared modules and public syntax, including public implementation methods. Function bodies and constant values are omitted. Feature conditions are retained. Private-module re-exports and trait resolution require the compiler; not every declaration is a root import.
shadow::ShadowConfig
Configuration for shadow shard replication.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ShadowConfig {
/// Minimum number of shadow copies per primary (must be >= 1).
pub min_shadows: usize,
/// Maximum number of shadow copies per primary.
pub max_shadows: usize,
/// Whether shadows must be in different clusters than the primary.
#[serde(default = "default_true")]
pub require_different_clusters: bool
}Source line: 21.
shadow::ShadowStatus
Replication status of a shadow shard.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ShadowStatus {
/// Shadow is catching up with the primary.
Syncing,
/// Shadow is fully synced and serving reads.
Active,
/// Shadow has fallen behind the primary.
Stale,
/// Shadow is being promoted to primary.
Promoting,
}Source line: 51.
shadow::ShadowShard
A shadow (replica) shard tracking replication state.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ShadowShard {
/// Unique ID for this shadow shard.
pub shadow_id: String,
/// ID of the primary shard being replicated.
pub primary_shard_id: String,
/// Cluster where this shadow is deployed.
pub cluster_id: String,
/// Region where this shadow is deployed.
pub region: String,
/// Last replicated sequence number.
pub last_sync_sequence: u64,
/// Current replication status.
pub status: ShadowStatus
}Source line: 69.
shadow::ShadowManager
Manages shadow shard assignment, promotion, and staleness tracking.
pub struct ShadowManager {
}Source line: 89.
shadow::ShadowManager::new
Create a new shadow manager with the given configuration.
pub fn new(config: ShadowConfig) -> Self;Source line: 99.
shadow::ShadowManager::assign_shadows
Assign shadow shards to a primary shard based on topology.
Picks candidate shards from different clusters (if configured) and
creates shadow entries up to max_shadows.
pub fn assign_shadows(
&mut self,
primary_shard_id: &str,
topology: &ShardTopology,
) -> Result<Vec<ShadowShard>, ShardError>;Source line: 111.
shadow::ShadowManager::promote_shadow
Promote the best shadow to primary status.
Selects the shadow with the highest last_sync_sequence and sets it
to Promoting status. Returns the promoted shadow.
pub fn promote_shadow(&mut self, primary_shard_id: &str) -> Result<ShadowShard, ShardError>;Source line: 169.
shadow::ShadowManager::sync_update
Update a shadow's replication progress.
pub fn sync_update(&mut self, shadow_id: &str, sequence: u64) -> Result<(), ShardError>;Source line: 196.
shadow::ShadowManager::shadows_for
List shadows for a primary shard.
pub fn shadows_for(&self, primary_shard_id: &str) -> Vec<&ShadowShard>;Source line: 226.
shadow::ShadowManager::stale_shadows
Find shadows that have fallen behind by more than max_lag sequences.
Compares each shadow's last_sync_sequence against the primary's
current sequence (approximated as the max across all shadows + max_lag).
pub fn stale_shadows(&self, max_lag: u64) -> Vec<&ShadowShard>;Source line: 237.
Source provenance
Source: mars-shard/src/shadow.rs · SHA-256 2fa83f34f08d190d42e8b21009b4f2ce28d276b61d9a6ef532877fb13d62eefd. Package overview.