pub struct ClusterNode { /* private fields */ }
Expand description
Cluster node implementation
Implementations§
Source§impl ClusterNode
impl ClusterNode
Sourcepub async fn new(config: NodeConfig) -> Result<Self>
pub async fn new(config: NodeConfig) -> Result<Self>
Create a new cluster node
Sourcepub async fn current_term(&self) -> u64
pub async fn current_term(&self) -> u64
Get current consensus term
Sourcepub async fn insert_triple(
&self,
subject: &str,
predicate: &str,
object: &str,
) -> Result<RdfResponse>
pub async fn insert_triple( &self, subject: &str, predicate: &str, object: &str, ) -> Result<RdfResponse>
Insert a triple through distributed consensus
Sourcepub async fn delete_triple(
&self,
subject: &str,
predicate: &str,
object: &str,
) -> Result<RdfResponse>
pub async fn delete_triple( &self, subject: &str, predicate: &str, object: &str, ) -> Result<RdfResponse>
Delete a triple through distributed consensus
Sourcepub async fn clear_store(&self) -> Result<RdfResponse>
pub async fn clear_store(&self) -> Result<RdfResponse>
Clear all triples through distributed consensus
Sourcepub async fn begin_transaction(&self) -> Result<String>
pub async fn begin_transaction(&self) -> Result<String>
Begin a distributed transaction
Sourcepub async fn commit_transaction(&self, tx_id: &str) -> Result<RdfResponse>
pub async fn commit_transaction(&self, tx_id: &str) -> Result<RdfResponse>
Commit a distributed transaction
Sourcepub async fn rollback_transaction(&self, tx_id: &str) -> Result<RdfResponse>
pub async fn rollback_transaction(&self, tx_id: &str) -> Result<RdfResponse>
Rollback a distributed transaction
Sourcepub async fn query_triples(
&self,
subject: Option<&str>,
predicate: Option<&str>,
object: Option<&str>,
) -> Vec<(String, String, String)>
pub async fn query_triples( &self, subject: Option<&str>, predicate: Option<&str>, object: Option<&str>, ) -> Vec<(String, String, String)>
Query triples (can be done on any node)
Sourcepub async fn query_sparql(&self, sparql: &str) -> Result<Vec<String>>
pub async fn query_sparql(&self, sparql: &str) -> Result<Vec<String>>
Execute SPARQL query using distributed query processing
Sourcepub async fn query_sparql_bindings(
&self,
sparql: &str,
) -> Result<Vec<ResultBinding>>
pub async fn query_sparql_bindings( &self, sparql: &str, ) -> Result<Vec<ResultBinding>>
Execute SPARQL query and return structured results
Sourcepub async fn get_query_statistics(&self) -> Result<HashMap<String, QueryStats>>
pub async fn get_query_statistics(&self) -> Result<HashMap<String, QueryStats>>
Get query execution statistics
Sourcepub async fn clear_query_cache(&self) -> Result<()>
pub async fn clear_query_cache(&self) -> Result<()>
Clear query cache
Sourcepub async fn add_cluster_node(
&mut self,
node_id: OxirsNodeId,
address: SocketAddr,
) -> Result<()>
pub async fn add_cluster_node( &mut self, node_id: OxirsNodeId, address: SocketAddr, ) -> Result<()>
Add a new node to the cluster
Sourcepub async fn remove_cluster_node(&mut self, node_id: OxirsNodeId) -> Result<()>
pub async fn remove_cluster_node(&mut self, node_id: OxirsNodeId) -> Result<()>
Remove a node from the cluster
Sourcepub async fn get_status(&self) -> ClusterStatus
pub async fn get_status(&self) -> ClusterStatus
Get comprehensive cluster status
Sourcepub async fn add_node_with_consensus(
&mut self,
node_id: OxirsNodeId,
address: SocketAddr,
) -> Result<()>
pub async fn add_node_with_consensus( &mut self, node_id: OxirsNodeId, address: SocketAddr, ) -> Result<()>
Add a new node to the cluster using consensus protocol
Sourcepub async fn remove_node_with_consensus(
&mut self,
node_id: OxirsNodeId,
) -> Result<()>
pub async fn remove_node_with_consensus( &mut self, node_id: OxirsNodeId, ) -> Result<()>
Remove a node from the cluster using consensus protocol
Sourcepub async fn graceful_shutdown(&mut self) -> Result<()>
pub async fn graceful_shutdown(&mut self) -> Result<()>
Gracefully shutdown this node
Sourcepub async fn transfer_leadership(
&mut self,
target_node: OxirsNodeId,
) -> Result<()>
pub async fn transfer_leadership( &mut self, target_node: OxirsNodeId, ) -> Result<()>
Transfer leadership to another node
Sourcepub async fn force_evict_node(&mut self, node_id: OxirsNodeId) -> Result<()>
pub async fn force_evict_node(&mut self, node_id: OxirsNodeId) -> Result<()>
Force evict a non-responsive node
Sourcepub async fn check_cluster_health(&self) -> Result<Vec<NodeHealthStatus>>
pub async fn check_cluster_health(&self) -> Result<Vec<NodeHealthStatus>>
Check health of all peer nodes
Sourcepub async fn attempt_recovery(&mut self) -> Result<()>
pub async fn attempt_recovery(&mut self) -> Result<()>
Attempt recovery from partition or failure
Sourcepub fn id(&self) -> OxirsNodeId
pub fn id(&self) -> OxirsNodeId
Get the node ID
Sourcepub async fn count_triples(&self) -> Result<usize>
pub async fn count_triples(&self) -> Result<usize>
Count triples in the store
Sourcepub async fn is_active(&self) -> Result<bool>
pub async fn is_active(&self) -> Result<bool>
Check if the node is active (running and not isolated)
Sourcepub async fn isolate_network(&self) -> Result<()>
pub async fn isolate_network(&self) -> Result<()>
Isolate the node from network (simulate network partition)
Sourcepub async fn restore_network(&self) -> Result<()>
pub async fn restore_network(&self) -> Result<()>
Restore network connectivity
Sourcepub async fn enable_byzantine_mode(&self) -> Result<()>
pub async fn enable_byzantine_mode(&self) -> Result<()>
Enable Byzantine behavior (for testing)
Sourcepub async fn is_byzantine(&self) -> Result<bool>
pub async fn is_byzantine(&self) -> Result<bool>
Check if node is in Byzantine mode
Sourcepub fn region_manager(&self) -> Option<&Arc<RegionManager>>
pub fn region_manager(&self) -> Option<&Arc<RegionManager>>
Get multi-region manager (if configured)
Sourcepub fn is_multi_region_enabled(&self) -> bool
pub fn is_multi_region_enabled(&self) -> bool
Check if multi-region deployment is enabled
Sourcepub fn get_region_id(&self) -> Option<String>
pub fn get_region_id(&self) -> Option<String>
Get current node’s region ID
Sourcepub fn get_availability_zone_id(&self) -> Option<String>
pub fn get_availability_zone_id(&self) -> Option<String>
Get current node’s availability zone ID
Sourcepub async fn get_regional_peers(&self) -> Result<Vec<OxirsNodeId>>
pub async fn get_regional_peers(&self) -> Result<Vec<OxirsNodeId>>
Get nodes in the same region
Sourcepub async fn get_regional_leader_candidates(&self) -> Result<Vec<OxirsNodeId>>
pub async fn get_regional_leader_candidates(&self) -> Result<Vec<OxirsNodeId>>
Get optimal leader candidates considering region affinity
Sourcepub async fn get_cross_region_replication_targets(&self) -> Result<Vec<String>>
pub async fn get_cross_region_replication_targets(&self) -> Result<Vec<String>>
Calculate cross-region replication targets
Sourcepub async fn monitor_region_latencies(&self) -> Result<()>
pub async fn monitor_region_latencies(&self) -> Result<()>
Monitor inter-region latencies and update metrics
Sourcepub async fn get_region_health(&self, region_id: &str) -> Result<RegionHealth>
pub async fn get_region_health(&self, region_id: &str) -> Result<RegionHealth>
Get region health status
Sourcepub async fn perform_region_failover(
&self,
failed_region: &str,
target_region: &str,
) -> Result<()>
pub async fn perform_region_failover( &self, failed_region: &str, target_region: &str, ) -> Result<()>
Perform region failover operation
Sourcepub async fn get_region_topology(&self) -> Result<RegionTopology>
pub async fn get_region_topology(&self) -> Result<RegionTopology>
Get multi-region topology information
Sourcepub async fn add_node_to_region(
&self,
node_id: OxirsNodeId,
region_id: String,
availability_zone_id: String,
data_center: Option<String>,
rack: Option<String>,
) -> Result<()>
pub async fn add_node_to_region( &self, node_id: OxirsNodeId, region_id: String, availability_zone_id: String, data_center: Option<String>, rack: Option<String>, ) -> Result<()>
Add a node to a specific region and availability zone
Sourcepub fn conflict_resolver(&self) -> &Arc<ConflictResolver>
pub fn conflict_resolver(&self) -> &Arc<ConflictResolver>
Get conflict resolver instance
Sourcepub async fn get_vector_clock(&self) -> VectorClock
pub async fn get_vector_clock(&self) -> VectorClock
Get current vector clock value
Sourcepub async fn update_vector_clock(&self, received_clock: &VectorClock)
pub async fn update_vector_clock(&self, received_clock: &VectorClock)
Update vector clock with received clock
Sourcepub async fn create_timestamped_operation(
&self,
operation: RdfOperation,
priority: u32,
) -> TimestampedOperation
pub async fn create_timestamped_operation( &self, operation: RdfOperation, priority: u32, ) -> TimestampedOperation
Create a timestamped operation with current vector clock
Sourcepub async fn detect_operation_conflicts(
&self,
operations: &[TimestampedOperation],
) -> Result<Vec<ConflictType>>
pub async fn detect_operation_conflicts( &self, operations: &[TimestampedOperation], ) -> Result<Vec<ConflictType>>
Detect conflicts in a batch of operations
Sourcepub async fn resolve_operation_conflicts(
&self,
conflicts: &[ConflictType],
) -> Result<Vec<ResolutionResult>>
pub async fn resolve_operation_conflicts( &self, conflicts: &[ConflictType], ) -> Result<Vec<ResolutionResult>>
Resolve conflicts using configured strategies
Sourcepub async fn submit_conflict_aware_operation(
&self,
operation: RdfOperation,
priority: u32,
) -> Result<RdfResponse>
pub async fn submit_conflict_aware_operation( &self, operation: RdfOperation, priority: u32, ) -> Result<RdfResponse>
Submit an operation for conflict-aware processing
Sourcepub async fn get_conflict_resolution_statistics(&self) -> ResolutionStatistics
pub async fn get_conflict_resolution_statistics(&self) -> ResolutionStatistics
Get conflict resolution statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClusterNode
impl !RefUnwindSafe for ClusterNode
impl Send for ClusterNode
impl Sync for ClusterNode
impl Unpin for ClusterNode
impl !UnwindSafe for ClusterNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.