[−][src]Struct ciruela::cluster::Config
Configuration for clustered connection
More settings will be added as needed.
Methods
impl Config
[src]
impl Config
pub fn new() -> Config
[src]
pub fn new() -> Config
Create an initial config connecting to 127.0.0.1:24783
pub fn initial_connections(&mut self, num: u32) -> &mut Self
[src]
pub fn initial_connections(&mut self, num: u32) -> &mut Self
Set number of connections to initiate when accessing cluster
Default: 3
.
Ciruela picks num
random addresses from the ones passed to
connection constructor, and connects to them initially. Then if image
is not accepted at this node or if the node fails, ciruela establishes
connections to other nodes keeping max num
connections for any
specific image upload.
In other words, this is a hint of how much simultaneous uploads might be going of any specific image. Rules of thumb:
- Too large value means you're uploading data to more servers from a client which presumably has slower connections than local connection between nodes.
- Small value like 1 is bad when node downloading image would fail
- The default of 3 is just good enough
Note, that big value (1) is also not a big deal because nodes will try
top optimize download anyway. Also, num=1
(2) is not big deal as
ciruela will reconnect when node fails anyway. So technically any
value is okay.
pub fn port(&mut self, port: u16) -> &mut Self
[src]
pub fn port(&mut self, port: u16) -> &mut Self
Set ciruela server port
This port is used both for initial connections and when redirecting connections to other host names.
pub fn early_upload(
&mut self,
hosts: u32,
fraction: f32,
timeout: Duration
) -> &mut Self
[src]
pub fn early_upload(
&mut self,
hosts: u32,
fraction: f32,
timeout: Duration
) -> &mut Self
Define how to define early success of an upload
Basically this means that if after timeout
we couldn't get
notifications that all hosts are downloaded the image, but this number
of hosts done, we stop the upload tool and report success.
The number of hosts is determined as the following:
- Find out hosts that accept a directory,
ceil(accepting_hosts*fraction)
- If the number above is smaller than
hosts
we the latter instead - If
accepting_hosts
is smaller thanhosts
we use former
Defaults are: hosts=3, fraction=0.75, duration=30 sec
By default this provides resilience in the following ways:
- Upload to at least three hosts (unless total hosts count is smaller)
- Tolerate 25% of nodes currently failing
- Do not wait full deadline if some hosts are failing because that would make deploy too long
(I.e. we need to keep the deadline huge, because 100% new/uncached image over a slow channel between CI and production might take lot of time to upload)
pub fn maximum_timeout(&mut self, timeout: Duration) -> &mut Self
[src]
pub fn maximum_timeout(&mut self, timeout: Duration) -> &mut Self
Maximum time to wait before for upload before reporting failure
Default: 30 minutes
Thix timeout should be big, because 100% new/uncached image over a slow channel between CI and production might take lot of time to upload. Still default might be too pessimistic if you know your setup better.
pub fn done(&mut self) -> Arc<Config>
[src]
pub fn done(&mut self) -> Arc<Config>
Finalize config and return an Arc of a config
Trait Implementations
impl Clone for Config
[src]
impl Clone for Config
fn clone(&self) -> Config
[src]
fn clone(&self) -> Config
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Config
[src]
impl Debug for Config
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> Same for T
impl<T> Same for T
type Output = T
Should always be Self
impl<T> Erased for T
impl<T> Erased for T
impl<T> Any for T where
T: Any,
[src]
impl<T> Any for T where
T: Any,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId