pub struct RuntimeServices {
pub time_provider: Arc<dyn TimeProvider>,
pub transport_factory: Arc<dyn TransportFactory>,
pub pow_generator: Arc<dyn ParallelPowGenerator>,
}Expand description
The bundle of environment-dependent services that both clients and servers need to participate in the protocol.
Every layer of the crate — transport, protocol, client, server — takes its dependencies
through a shared RuntimeServices rather than reaching out to concrete clock /
network / PoW implementations directly. This is the seam that makes the in-memory
integration tests possible: swap TransportFactory for an in-memory one, TimeProvider
for a virtual clock, and ParallelPowGenerator for a single-threaded stub, and an entire
hashiverse network can run deterministically inside a single test binary.
In production, crate::client::hashiverse_client::HashiverseClient and the server
binary each construct a RuntimeServices with the real implementations of these traits
and pass the same Arc<RuntimeServices> down through every constructor that needs it.
Fields§
§time_provider: Arc<dyn TimeProvider>§transport_factory: Arc<dyn TransportFactory>§pow_generator: Arc<dyn ParallelPowGenerator>Implementations§
Source§impl RuntimeServices
impl RuntimeServices
pub fn default_for_testing() -> Arc<Self>
Trait Implementations§
Source§impl Clone for RuntimeServices
impl Clone for RuntimeServices
Source§fn clone(&self) -> RuntimeServices
fn clone(&self) -> RuntimeServices
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for RuntimeServices
impl !RefUnwindSafe for RuntimeServices
impl Send for RuntimeServices
impl Sync for RuntimeServices
impl Unpin for RuntimeServices
impl UnsafeUnpin for RuntimeServices
impl !UnwindSafe for RuntimeServices
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more