Struct Builder

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

A builder struct for a Server.

The expected sequence of events to bootstrap a server is:

  1. Initialize a freqfs::Cache
  2. Load the data directory and transactional workspace into the cache
  3. Initialize an implementation of RPCClient
  4. Create a new Builder with the data directory, workspace, and RPC client
  5. Register one or more crate::aes256::Keys to use for symmetric encryption
  6. For a secure server, provide links to the user and group authorized to administer the server
  7. Load the kernel
  8. Start the public interface for the server (e.g. HTTP or HTTPS)
  9. Discover peers via mDNS
  10. Replicate from the first peer to respond using one of the provided encryption keys 10.1 For each dir, replicate the entries in the dir (not their state, i.e. not recursively) 10.2 Repeat step 10.1 until all directory entries are replicated 10.3 Replicate each chain in each service
  11. Send requests to join the replica set authenticated using the hash of the present replica state, all in a single transaction
  12. Repeat steps 10-11 until successful
  13. Mark the server ready to receive requests from a load balancer
  14. Broadcast the server’s availability via mDNS

See the examples dir for usage examples.

Implementations§

Source§

impl Builder

Source

pub fn load( data_dir: DirLock<CacheBlock>, workspace: DirLock<CacheBlock>, rpc_client: Arc<dyn RPCClient>, ) -> Self

Source

pub async fn build(self) -> Server

Source

pub fn detect_address(self) -> Self

Source

pub fn host(&mut self) -> Host

Source

pub fn set_port(self, port: u16) -> Self

Source

pub fn set_group(self, group: Link) -> Self

Source

pub fn set_owner(self, owner: Link) -> Self

Source

pub fn set_secure(self, secure: bool) -> Self

Source

pub fn with_keys<Keys: IntoIterator<Item = Aes256Key>>(self, keys: Keys) -> Self

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<F, T> CastFrom<F> for T
where T: From<F>,

Source§

fn cast_from(f: F) -> T

Cast an instance of T into an instance of Self.
Source§

impl<T, F> CastInto<F> for T
where F: CastFrom<T>,

Source§

fn cast_into(self) -> F

Cast an instance of Self into an instance of T.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<F> Match for F

Source§

fn matches<T>(&self) -> bool
where T: TryCastFrom<Self>,

Returns true if self can be cast into the target type T.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<F, T> TryCastFrom<F> for T
where T: CastFrom<F>,

Source§

fn can_cast_from(_: &F) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(f: F) -> Option<T>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl<F, T> TryCastInto<T> for F
where T: TryCastFrom<F>,

Source§

fn can_cast_into(&self) -> bool

Test if self can be cast into T.
Source§

fn opt_cast_into(self) -> Option<T>

Returns Some(T) if self can be cast into T, otherwise None.
Source§

fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err>
where OnErr: FnOnce(&Self) -> Err,

Returns Ok(T) if self can be cast into T, otherwise calls on_err.
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ThreadSafe for T
where T: Send + Sync + 'static,