Skip to main content

VeloBuilder

Struct VeloBuilder 

Source
pub struct VeloBuilder { /* private fields */ }
Expand description

Builder for configuring and creating a Velo instance.

Implementations§

Source§

impl VeloBuilder

Source

pub fn new() -> Self

Create a new empty builder.

Source

pub fn add_transport(self, transport: Arc<dyn Transport>) -> Self

Add a transport to the system.

Source

pub fn stream_config(self, config: StreamConfig) -> Result<Self>

Set the streaming transport configuration.

Only one transport server is allowed per Velo instance. Returns Err if called more than once on the same builder.

Source

pub fn stream_bind_addr(self, addr: IpAddr) -> Self

Convenience: pin the TCP streaming listener to a single interface IP (instead of the default 0.0.0.0 + multi-interface advertise).

Source

pub fn messenger_mux(self, config: MuxConfig) -> Result<Self>

Install the batched, multiplexed streaming transport (messenger-mux-v1), described in streaming/BATCHING.md.

Opt-in, and the mux is not the default transport. MuxConfig::enabled defaults to false, and calling this with it left false is exactly the same node as not calling it at all: nothing is registered and nothing is advertised.

The legacy transport stays configured either way — a mux-enabled node registers both, and each attach picks between them from what the peer advertised. So a canary is one node with the flag on, talking the mux to other canaries and the legacy path to everything else, and rollback is the same flag: set it back to false and the node stops advertising messenger-mux-v1, so the next attach negotiates the legacy path. No code change, no wire change, and no coordination with peers, because a key that is never advertised is never selected.

Only one mux may be installed per instance — its _stream_batch handler is registered on the messenger for its lifetime and the messenger refuses a duplicate handler name. Calling this twice fails here rather than at the second attach.

Source

pub fn discovery(self, discovery: Arc<dyn PeerDiscovery>) -> Self

Set the peer discovery backend.

Source

pub fn metrics(self, metrics: Arc<VeloMetrics>) -> Self

Install Prometheus collectors for this Velo instance.

Source

pub async fn build(self) -> Result<Arc<Velo>>

Build the Velo system with the configured transports and discovery.

Construction order:

  1. Build Messenger (async)
  2. Extract WorkerId
  3. Resolve the streaming transport from stream_config (default: TCP on 0.0.0.0:0 with multi-interface advertise via WorkerAddress).
  4. Merge the streaming transport’s address() into the local PeerInfo’s WorkerAddress (so peers can discover the streaming listener alongside messenger endpoints).
  5. Create AnchorManager via builder, with the streaming transport wired in as both the default and the only registry entry (keyed by its TransportKey).
  6. Register streaming control-plane handlers on Messenger.
  7. Assemble Velo struct, holding a clone of the streaming transport so register_peer can fan out to it on every newly-known peer.

Trait Implementations§

Source§

impl Default for VeloBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more