pub struct StatefulServicePartitionDriver { /* private fields */ }Expand description
Test driver for a single stateful service replica.
Implementations§
Source§impl StatefulServicePartitionDriver
impl StatefulServicePartitionDriver
pub fn new() -> Self
Sourcepub fn register_service_factory(
&mut self,
factory: Box<dyn IStatefulServiceFactory>,
)
pub fn register_service_factory( &mut self, factory: Box<dyn IStatefulServiceFactory>, )
Register a service factory to be used to create replicas. One should register multiple factories to simulate multi node scenarios. Replicas are created in round robin fashion from the registered factories.
Source§impl StatefulServicePartitionDriver
impl StatefulServicePartitionDriver
Sourcepub fn get_primary_replica_id(&self) -> i64
pub fn get_primary_replica_id(&self) -> i64
Get the current primary replica id.
Sourcepub fn get_replica(
&self,
replica_id: i64,
) -> Option<&dyn IStatefulServiceReplica>
pub fn get_replica( &self, replica_id: i64, ) -> Option<&dyn IStatefulServiceReplica>
Get a replica by id.
Sourcepub fn get_replicator(&self, replica_id: i64) -> Option<&dyn IPrimaryReplicator>
pub fn get_replicator(&self, replica_id: i64) -> Option<&dyn IPrimaryReplicator>
Get a replicator by replica id.
Sourcepub fn list_replica_ids(&self) -> Vec<i64>
pub fn list_replica_ids(&self) -> Vec<i64>
List all replica ids.
Source§impl StatefulServicePartitionDriver
impl StatefulServicePartitionDriver
Sourcepub async fn create_service_partition(
&mut self,
desc: &CreateStatefulServicePartitionArg,
) -> Result<()>
pub async fn create_service_partition( &mut self, desc: &CreateStatefulServicePartitionArg, ) -> Result<()>
Create a stateful service partition with the specified number of replicas. The first replica is the primary. Runs the replica build steps.
Sourcepub async fn delete_service_partition(&mut self) -> Result<()>
pub async fn delete_service_partition(&mut self) -> Result<()>
Delete the service partition.
Sourcepub async fn restart_secondary_graceful(
&mut self,
replica_id: i64,
) -> Result<()>
pub async fn restart_secondary_graceful( &mut self, replica_id: i64, ) -> Result<()>
Restart a secondary replica gracefully.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StatefulServicePartitionDriver
impl !RefUnwindSafe for StatefulServicePartitionDriver
impl Send for StatefulServicePartitionDriver
impl Sync for StatefulServicePartitionDriver
impl Unpin for StatefulServicePartitionDriver
impl UnsafeUnpin for StatefulServicePartitionDriver
impl !UnwindSafe for StatefulServicePartitionDriver
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
Mutably borrows from an owned value. Read more