Struct narwhal_test_utils::cluster::AuthorityDetails
source · [−]pub struct AuthorityDetails {
pub id: usize,
pub name: PublicKey,
/* private fields */
}
Expand description
The authority details hold all the necessary structs and details to identify and manage a specific authority. An authority is composed of its primary node and the worker nodes. Via this struct we can manage the nodes one by one or in batch fashion (ex stop_all). The Authority can be cloned and reused across the instances as its internals are thread safe. So changes made from one instance will be reflected to another.
Fields
id: usize
name: PublicKey
Implementations
sourceimpl AuthorityDetails
impl AuthorityDetails
pub fn new(
id: usize,
key_pair: KeyPair,
network_key_pair: NetworkKeyPair,
worker_keypairs: Vec<NetworkKeyPair>,
parameters: Parameters,
committee: SharedCommittee,
worker_cache: SharedWorkerCache,
internal_consensus_enabled: bool
) -> Self
sourcepub async fn start(&self, preserve_store: bool, num_of_workers: Option<usize>)
pub async fn start(&self, preserve_store: bool, num_of_workers: Option<usize>)
Starts the node’s primary and workers. If the num_of_workers is provided then only those ones will be started. Otherwise all the available workers will be started instead. If the preserve_store value is true then the previous node’s storage will be preserved. If false then the node will start with a fresh (empty) storage.
sourcepub async fn start_primary(&self, preserve_store: bool)
pub async fn start_primary(&self, preserve_store: bool)
Starts the primary node. If the preserve_store value is true then the previous node’s storage will be preserved. If false then the node will start with a fresh (empty) storage.
pub async fn stop_primary(&self)
pub async fn start_all_workers(&self, preserve_store: bool)
sourcepub async fn start_worker(&self, id: WorkerId, preserve_store: bool)
pub async fn start_worker(&self, id: WorkerId, preserve_store: bool)
Starts the worker node by the provided id. If worker is not found then a panic is raised. If the preserve_store value is true then the previous node’s storage will be preserved. If false then the node will start with a fresh (empty) storage.
pub async fn stop_worker(&self, id: WorkerId)
sourcepub async fn restart(&self, preserve_store: bool, delay: Duration)
pub async fn restart(&self, preserve_store: bool, delay: Duration)
Will restart the node with the current setup that has been chosen
(ex same number of nodes).
preserve_store
: if true then the same storage will be used for the
node
delay
: before starting again we’ll wait for that long. If zero provided
then won’t wait at all
sourcepub async fn primary(&self) -> PrimaryNodeDetails
pub async fn primary(&self) -> PrimaryNodeDetails
Returns the current primary node running as a clone. If the primary node stops and starts again and it’s needed by the user then this method should be called again to get the latest one.
sourcepub async fn worker(&self, id: WorkerId) -> WorkerNodeDetails
pub async fn worker(&self, id: WorkerId) -> WorkerNodeDetails
Returns the worker with the provided id. If not found then a panic is raised instead. If the worker is stopped and started again then the worker will need to be fetched again via this method.
sourcepub async fn worker_transaction_addresses(&self) -> Vec<Multiaddr>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub async fn worker_transaction_addresses(&self) -> Vec<Multiaddr>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Helper method to return transaction addresses of all the worker nodes. Important: only the addresses of the running workers will be returned.
sourcepub async fn new_proposer_client(&self) -> ProposerClient<Channel>
pub async fn new_proposer_client(&self) -> ProposerClient<Channel>
Creates a new proposer client that connects to the corresponding client. This should be available only if the internal consensus is disabled. If the internal consensus is enabled then a panic will be thrown instead.
sourcepub async fn new_transactions_client(
&self,
worker_id: &WorkerId
) -> TransactionsClient<Channel>
pub async fn new_transactions_client(
&self,
worker_id: &WorkerId
) -> TransactionsClient<Channel>
This method returns a new client to send transactions to the dictated
worker identified by the worker_id
. If the worker_id is not found then
a panic is raised.
sourcepub async fn new_configuration_client(&self) -> ConfigurationClient<Channel>
pub async fn new_configuration_client(&self) -> ConfigurationClient<Channel>
Creates a new configuration client that connects to the corresponding client. This should be available only if the internal consensus is disabled. If the internal consensus is enabled then a panic will be thrown instead.
Trait Implementations
sourceimpl Clone for AuthorityDetails
impl Clone for AuthorityDetails
sourcefn clone(&self) -> AuthorityDetails
fn clone(&self) -> AuthorityDetails
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations
impl !RefUnwindSafe for AuthorityDetails
impl !Send for AuthorityDetails
impl !Sync for AuthorityDetails
impl Unpin for AuthorityDetails
impl !UnwindSafe for AuthorityDetails
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> FutureExt for T
impl<T> FutureExt for T
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a Request
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read morefn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read morefn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
self
, then passes self.as_ref()
into the pipe function.fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
self
, then passes self.deref()
into the pipe function.impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Tap for T
impl<T> Tap for T
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Borrow<B>
of a value. Read morefn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
BorrowMut<B>
of a value. Read morefn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
AsRef<R>
view of a value. Read morefn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
AsMut<R>
view of a value. Read morefn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Deref::Target
of a value. Read morefn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Deref::Target
of a value. Read morefn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds. Read morefn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds. Read morefn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read morefn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds. Read morefn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more