[][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.

Methods

impl Mesh<Rejoin, Server>[src]

pub fn new() -> Self[src]

Create a new Mesh.

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.

Panics

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>)>>(
    self,
    iter: I
) -> Self
[src]

Add metadata to distribute to other members of the mesh.

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

Configure TLS for connections to other mesh members, as well as for any of the endpoints returned in MeshService membership updates.

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

Sets the strategy with which to handle network partitions.

See partition for possible options to use here.

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

Add a MeshService that doesn't necessarily implement Service.

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 on 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, 
[src]

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

pub fn add_service<S>(self, svc: S) -> Mesh<St, Router<S, Unimplemented>> where
    S: Service<HttpRequest<Body>, Response = HttpResponse<BoxBody>> + NamedService + MeshService + Clone + Send + 'static,
    S::Future: Send + 'static,
    S::Error: Into<Box<dyn Error + Send + Sync>> + Send
[src]

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_simulated(
    self,
    net: Network,
    addr: SocketAddr
) -> Fallible<()>
[src]

This is supported on feature="simulation" only.

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

Resolves once the mesh has exited.

pub async fn serve_simulated_shutdown<F>(
    __arg0: Self,
    net: Network,
    addr: SocketAddr,
    signal: F
) -> Fallible<()> where
    F: Future<Output = ()> + Send
[src]

This is supported on feature="simulation" only.

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.

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
[src]

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
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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]