[][src]Struct blip::Mesh

pub struct Mesh<St, R> { /* fields omitted */ }

An unstarted member of a blip mesh network.

This is a wrapper over the grpc server/router in tonic::transport, and provides a pass-through implementation for most of their configuration methods.

Most interaction with the membership state of an executing member occurs via services that implement the MeshService trait.


impl Mesh<Rejoin, Server>[src]

pub fn new() -> Self[src]

Create a new Mesh with the default configuration.

pub fn low_latency() -> Self[src]

Create a new Mesh with reduced timeouts and faster fault detection, at the expense of significantly more probe traffic.

This should generally be avoided except in test code.

impl<St, R> Mesh<St, R>[src]

Methods for blip-specific membership protocol configuration.

pub fn cd_config(self, cfg: CutDetectorConfig) -> Self[src]

Configure the cut detector. All members of the mesh must have the same configuration.


Panics if any invariants (listed at CutDetectorConfig) are not upheld.

pub fn join_seed(self, addr: SocketAddr, use_tls: bool) -> Self[src]

Set a seed node to contact in order to join an existing network. If this is left unset (the default), a new mesh will be bootstrapped with the local node as the sole member.

pub fn add_metadata<I: IntoIterator<Item = (String, Vec<u8>)>>(
    iter: I
) -> Self

Add metadata to distribute to other members of the mesh.

pub fn client_tls_config(self, tls_config: ClientTlsConfig) -> Self[src]

Configure TLS for outgoing connections to mesh members that are expecting TLS.

This will also be exposed in the MultiNodeCuts received from Subscriptions.

pub fn part_strategy<_St: Strategy>(self) -> Mesh<_St, R>[src]

Set the strategy with which to handle network partitions.

See partition for possible options to use here.

pub fn fault_timeout(self, timeout: Duration) -> Self[src]

Set a timeout for the fault detector. If a subject fails to respond to a probe within this amount of time (for fault_strikes successive attempts), it will be marked as faulty by the observer.

The rate at which probe messages are sent is also determined by this value. A probe is sent to all subjects every timeout. Extrapolated to the whole mesh, every node sends and receives subjects_per_observer probes every timeout.

Defaults to 2 seconds.

pub fn fault_strikes(self, strikes: usize) -> Self[src]

Set the number of successive fault detection probe attempts that must fail before a subject is marked as faulty.

Defaults to 3.


Panics if strikes == 0.

pub fn add_mesh_service<S: MeshService + 'static>(self, svc: S) -> Self[src]

Add a MeshService that doesn't necessarily implement ExposedService.

This can be used to receive membership updates without exposing a grpc service to other mesh members.

impl<St: Strategy> Mesh<St, Server>[src]

Methods that pass-through to tonic::transport.

pub fn server_tls_config(self, tls_config: ServerTlsConfig) -> Self[src]

Configure TLS for this server.

pub fn concurrency_limit_per_connection(self, limit: usize) -> Self[src]

Set the concurrency limit applied to on requests inbound per connection.

pub fn timeout(self, timeout: Duration) -> Self[src]

Set a timeout for all request handlers.

pub fn initial_stream_window_size<S: Into<Option<u32>>>(self, sz: S) -> Self[src]

Sets the SETTINGS_INITIAL_WINDOW_SIZE option for HTTP2 stream-level flow control.

Defaults to 65,535.

pub fn initial_connection_window_size<S: Into<Option<u32>>>(self, sz: S) -> Self[src]

Sets the max connection-level flow control for HTTP2.

Defaults to 65,535.

pub fn max_concurrent_streams<M: Into<Option<u32>>>(self, max: M) -> Self[src]

Sets the SETTINGS_MAX_CONCURRENT_STREAMS option for HTTP2 connections.

Defaults to no limit (None).

pub fn tcp_keepalive<D: Into<Option<Duration>>>(self, tcp_keepalive: D) -> Self[src]

Set whether TCP keepalive messages are enabled on accepted connections.

If None is specified, keepalive is disabled, otherwise the duration specified will be the time to remain idle before sending TCP keepalive probes.

Defaults to no keepalive (None).

pub fn tcp_nodelay(self, enabled: bool) -> Self[src]

Set the value of TCP_NODELAY option for accepted connections.

Defaults to enabled (true).

pub fn trace_fn<F>(self, f: F) -> Self where
    F: Fn(&HeaderMap) -> Span + Send + Sync + 'static, 

Intercept inbound headers and add a tracing::Span to each response future.

pub fn add_service<S>(
    svc: S
) -> Mesh<St, Router<S::Service, Unimplemented>> where
    S: ExposedService + 'static,
    <<S as ExposedService>::Service as Service<HttpRequest<Body>>>::Future: Send + 'static,
    <<S as ExposedService>::Service as Service<HttpRequest<Body>>>::Error: Into<Box<dyn Error + Send + Sync>> + Send

Add a service S to the mesh. Any endpoints it exposes should use request paths namespaced by the NamedService implementation, so they can be routed alongside other services.

pub async fn serve(self, addr: SocketAddr) -> Fallible<()>[src]

Consume this Mesh, creating a future that will run on a tokio executor.

Resolves once the mesh has exited.

pub async fn serve_with_shutdown<F>(
    __arg0: Self,
    addr: SocketAddr,
    signal: F
) -> Fallible<()> where
    F: Future<Output = ()> + Send

Consume this Mesh, creating a future that will run on a tokio executor.

Shutdown will be initiated when signal resolves.

Resolves once the mesh has exited.

Trait Implementations

impl Default for Mesh<Rejoin, Server>[src]

Auto Trait Implementations

impl<St, R> !RefUnwindSafe for Mesh<St, R>

impl<St, R> Send for Mesh<St, R> where
    R: Send,
    St: Send

impl<St, R> !Sync for Mesh<St, R>

impl<St, R> Unpin for Mesh<St, R> where
    R: Unpin,
    St: Unpin

impl<St, R> !UnwindSafe for Mesh<St, R>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> IntoRequest<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]