Skip to content

Commit 485be7d

Browse files
fix(session-store): fail closed off Linux
Signed-off-by: VerifiedOrganic <verifiedorganic@sent.com>
1 parent 37d41ab commit 485be7d

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎crates/opc-session-store/src/consensus/store.rs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,14 @@ impl fmt::Debug for ConsensusSessionStore {
454454
}
455455

456456
impl ConsensusSessionStore {
457+
fn require_dynamic_consensus_platform() -> Result<(), ConsensusSessionStoreOpenError> {
458+
if cfg!(target_os = "linux") {
459+
Ok(())
460+
} else {
461+
Err(ConsensusSessionStoreOpenError::DynamicConsensusUnsupportedPlatform)
462+
}
463+
}
464+
457465
/// Start one durable Openraft node without yet forming pristine membership.
458466
///
459467
/// `topology` contains only immutable member descriptors. `backend` is this
@@ -468,6 +476,7 @@ impl ConsensusSessionStore {
468476
snapshot_dir: impl Into<PathBuf>,
469477
peers: BTreeMap<SessionConsensusNodeId, Arc<dyn SessionConsensusPeer>>,
470478
) -> Result<Self, ConsensusSessionStoreOpenError> {
479+
Self::require_dynamic_consensus_platform()?;
471480
Self::open_with_clock(
472481
topology,
473482
backend,
@@ -634,6 +643,7 @@ impl ConsensusSessionStore {
634643
peers: BTreeMap<SessionConsensusNodeId, Arc<dyn SessionConsensusPeer>>,
635644
operation_timeout: Duration,
636645
) -> Result<Self, ConsensusSessionStoreOpenError> {
646+
Self::require_dynamic_consensus_platform()?;
637647
Self::open_with_clock(
638648
topology,
639649
backend,
@@ -657,6 +667,7 @@ impl ConsensusSessionStore {
657667
clock: Arc<dyn Clock>,
658668
operation_timeout: Duration,
659669
) -> Result<Self, ConsensusSessionStoreOpenError> {
670+
Self::require_dynamic_consensus_platform()?;
660671
if operation_timeout.is_zero() || operation_timeout > Duration::from_secs(60) {
661672
return Err(ConsensusSessionStoreOpenError::InvalidRuntimeConfiguration);
662673
}

‎crates/opc-session-store/src/consensus/store/membership.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,7 @@ impl ConsensusSessionStore {
11861186
snapshot_dir: impl Into<PathBuf>,
11871187
desired_peers: SessionTopologyTransitionPeers,
11881188
) -> Result<Self, ConsensusSessionStoreOpenError> {
1189+
Self::require_dynamic_consensus_platform()?;
11891190
let SessionTopologyCandidateBootstrap {
11901191
storage_anchor,
11911192
current_topology,

‎crates/opc-session-store/src/sqlite/consensus.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,9 @@ impl SqliteConsensusCore {
11911191
authority_profile: ConsensusAuthorityProfile,
11921192
fixed_placement_policy: Option<PlacementResiliencePolicy>,
11931193
) -> Result<Self, SessionConsensusStorageError> {
1194+
if !cfg!(target_os = "linux") {
1195+
return Err(SessionConsensusStorageError::UnsupportedPlatform);
1196+
}
11941197
validate_member_set(&expected_members, false)
11951198
.map_err(|_| SessionConsensusStorageError::InvalidIdentity)?;
11961199
validate_member_bindings(&expected_members, &expected_bindings)

0 commit comments

Comments
 (0)