Builder

Struct Builder 

Source
pub struct Builder {
Show 14 fields pub config: Config, pub verifier: DynVerifier, pub auth_material: Option<Vec<u8>>, pub kitsune: DynKitsuneFactory, pub space: DynSpaceFactory, pub peer_store: DynPeerStoreFactory, pub bootstrap: DynBootstrapFactory, pub fetch: DynFetchFactory, pub transport: DynTransportFactory, pub op_store: DynOpStoreFactory, pub peer_meta_store: DynPeerMetaStoreFactory, pub gossip: DynGossipFactory, pub local_agent_store: Arc<dyn LocalAgentStoreFactory>, pub publish: DynPublishFactory,
}
Expand description

The general Kitsune2 builder. This contains both configuration and factory instances, allowing construction of runtime module instances.

Fields§

§config: Config

The module configuration to be used when building modules. This can be loaded from disk or modified before freezing the builder.

§verifier: DynVerifier

The Verifier to use for this Kitsune2 instance.

§auth_material: Option<Vec<u8>>

Any auth_material required to connect to sbd/signal and bootstrap services.

§kitsune: DynKitsuneFactory

The KitsuneFactory to be used for creating Kitsune module instances.

§space: DynSpaceFactory

The SpaceFactory to be used for creating Space instances.

§peer_store: DynPeerStoreFactory

The PeerStoreFactory to be used for creating PeerStore instances.

§bootstrap: DynBootstrapFactory

The BootstrapFactory to be used for creating Bootstrap instances for initial WAN discovery.

§fetch: DynFetchFactory

The FetchFactory to be used for creating Fetch instances.

§transport: DynTransportFactory

The TransportFactory to be used for creating Transport instances.

§op_store: DynOpStoreFactory

The OpStoreFactory to be used for creating OpStore instances.

§peer_meta_store: DynPeerMetaStoreFactory

The PeerMetaStoreFactory to be used for creating PeerMetaStore instances.

§gossip: DynGossipFactory

The GossipFactory to be used for creating Gossip instances.

§local_agent_store: Arc<dyn LocalAgentStoreFactory>

The LocalAgentStoreFactory to be used for creating LocalAgentStore instances.

§publish: DynPublishFactory

The PublishFactory to be used for creating Publish instances

Implementations§

Source§

impl Builder

Source

pub fn with_default_config(self) -> K2Result<Self>

Construct a default config given the configured module factories.

Note, this should be called before Self::build or otherwise freezing the Builder instance in an Arc<>.

Source

pub fn validate_config(&self) -> K2Result<()>

Validate the current configuration.

Source

pub async fn build(self) -> K2Result<DynKitsune>

Generate the actual kitsune instance, validating configuration if that has not already explicitly been done.

Trait Implementations§

Source§

impl Debug for Builder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<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
Source§

impl<T> ErasedDestructor for T
where T: 'static,