pub struct Builder { /* private fields */ }
Expand description
A builder struct for a Server
.
The expected sequence of events to bootstrap a server is:
- Initialize a
freqfs::Cache
- Load the data directory and transactional workspace into the cache
- Initialize an implementation of
RPCClient
- Create a new
Builder
with the data directory, workspace, and RPC client - Register one or more
crate::aes256::Key
s to use for symmetric encryption - For a secure server, provide links to the user and group authorized to administer the server
- Load the kernel
- Start the public interface for the server (e.g. HTTP or HTTPS)
- Discover peers via mDNS
- 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
- Send requests to join the replica set authenticated using the hash of the present replica state, all in a single transaction
- Repeat steps 10-11 until successful
- Mark the server ready to receive requests from a load balancer
- Broadcast the server’s availability via mDNS
See the examples
dir for usage examples.
Implementations§
Source§impl Builder
impl Builder
pub fn load( data_dir: DirLock<CacheBlock>, workspace: DirLock<CacheBlock>, rpc_client: Arc<dyn RPCClient>, ) -> Self
pub async fn build(self) -> Server
pub fn detect_address(self) -> Self
pub fn host(&mut self) -> Host
pub fn set_port(self, port: u16) -> Self
pub fn set_group(self, group: Link) -> Self
pub fn set_owner(self, owner: Link) -> Self
pub fn set_secure(self, secure: bool) -> Self
pub fn with_keys<Keys: IntoIterator<Item = Aes256Key>>(self, keys: Keys) -> Self
Auto Trait Implementations§
impl Freeze for Builder
impl !RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl !UnwindSafe for Builder
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
Mutably borrows from an owned value. Read more
Source§impl<F> Match for F
impl<F> Match for F
Source§fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
Returns
true
if self
can be cast into the target type T
.Source§impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
Source§fn can_cast_from(_: &F) -> bool
fn can_cast_from(_: &F) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(f: F) -> Option<T>
fn opt_cast_from(f: F) -> Option<T>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
Source§fn can_cast_into(&self) -> bool
fn can_cast_into(&self) -> bool
Test if
self
can be cast into T
.Source§fn opt_cast_into(self) -> Option<T>
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,
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
.