pub struct VeloBuilder { /* private fields */ }Expand description
Builder for configuring and creating a Velo instance.
Implementations§
Source§impl VeloBuilder
impl VeloBuilder
Sourcepub fn add_transport(self, transport: Arc<dyn Transport>) -> Self
pub fn add_transport(self, transport: Arc<dyn Transport>) -> Self
Add a transport to the system.
Sourcepub fn stream_config(self, config: StreamConfig) -> Result<Self>
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.
Sourcepub fn stream_bind_addr(self, addr: IpAddr) -> Self
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).
Sourcepub fn messenger_mux(self, config: MuxConfig) -> Result<Self>
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.
Sourcepub fn discovery(self, discovery: Arc<dyn PeerDiscovery>) -> Self
pub fn discovery(self, discovery: Arc<dyn PeerDiscovery>) -> Self
Set the peer discovery backend.
Sourcepub fn metrics(self, metrics: Arc<VeloMetrics>) -> Self
pub fn metrics(self, metrics: Arc<VeloMetrics>) -> Self
Install Prometheus collectors for this Velo instance.
Sourcepub async fn build(self) -> Result<Arc<Velo>>
pub async fn build(self) -> Result<Arc<Velo>>
Build the Velo system with the configured transports and discovery.
Construction order:
- Build Messenger (async)
- Extract WorkerId
- Resolve the streaming transport from
stream_config(default: TCP on0.0.0.0:0with multi-interface advertise via WorkerAddress). - Merge the streaming transport’s
address()into the local PeerInfo’s WorkerAddress (so peers can discover the streaming listener alongside messenger endpoints). - Create AnchorManager via builder, with the streaming transport wired in as both the default and the only registry entry (keyed by its TransportKey).
- Register streaming control-plane handlers on Messenger.
- Assemble Velo struct, holding a clone of the streaming transport
so
register_peercan fan out to it on every newly-known peer.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for VeloBuilder
impl !UnwindSafe for VeloBuilder
impl Freeze for VeloBuilder
impl Send for VeloBuilder
impl Sync for VeloBuilder
impl Unpin for VeloBuilder
impl UnsafeUnpin for VeloBuilder
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request