[−][src]Struct ciruela::cluster::Connection
Connection to a server or cluster of servers
Ciruela automatically manages a number of connections according to configs and the operations over connection (i.e. images currently uploading).
Methods
impl Connection[src]
impl Connectionpub fn new<R, I, B>(
initial_address: Vec<Name>,
resolver: R,
index_source: I,
block_source: B,
config: &Arc<Config>
) -> Connection where
I: GetIndex + Clone + Send + 'static,
B: GetBlock + Clone + Send + 'static,
R: Resolve + HostResolve + Clone + Send + 'static, [src]
pub fn new<R, I, B>(
initial_address: Vec<Name>,
resolver: R,
index_source: I,
block_source: B,
config: &Arc<Config>
) -> Connection where
I: GetIndex + Clone + Send + 'static,
B: GetBlock + Clone + Send + 'static,
R: Resolve + HostResolve + Clone + Send + 'static, Create a connection pool object
Warning: constructor should run on loop provieded by
tk_easyloop. In future, tokio will provide implicit loop reference
on it's own.
The actual underlying connections are established when specific operation is requested. Also you don't need to specify all node name in the cluster, they will be discovered.
There are two common patterns:
- [preferred] Use a DNS name that resolves to a full list of IP addresses. Common DNS servers randomize them and only spill few of the adressses because of DNS package size limit, but that's fine, as we only need 3 or so of them.
- Specify 3-5 server names and leave the discover to ciruela itself.
While you can specify a name that refers to only one address, it's not a very good idea (unless you really have one server) because the server you're connecting to may fail.
pub fn append(&self, upload: SignedUpload) -> Upload[src]
pub fn append(&self, upload: SignedUpload) -> Uploadpub fn append_weak(&self, upload: SignedUpload) -> Upload[src]
pub fn append_weak(&self, upload: SignedUpload) -> UploadInitiate a new upload (appending a directory, if not exists)
This is basically same as 'append()` but ignores errors when directory already exists (or currently downloading) but has different contents.
Panics
If connection set is already closed
pub fn replace(&self, upload: SignedUpload) -> Upload[src]
pub fn replace(&self, upload: SignedUpload) -> Uploadpub fn replace_if_matches(
&self,
upload: SignedUpload,
old_image: ImageId
) -> Upload[src]
pub fn replace_if_matches(
&self,
upload: SignedUpload,
old_image: ImageId
) -> UploadInitiate a new upload (replacing if directory hash matches)
Panics
If connection set is already closed
pub fn fetch_index(&self, vpath: &VPath) -> IndexFuture[src]
pub fn fetch_index(&self, vpath: &VPath) -> IndexFutureFetch index of a directory that is currently on the server
pub fn fetch_file<I, P>(&self, idx: &I, path: P) -> FileFuture where
P: AsRef<Path>,
I: MaterializedIndex, [src]
pub fn fetch_file<I, P>(&self, idx: &I, path: P) -> FileFuture where
P: AsRef<Path>,
I: MaterializedIndex, Trait Implementations
impl Clone for Connection[src]
impl Clone for Connectionfn clone(&self) -> Connection[src]
fn clone(&self) -> ConnectionReturns 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 Connection[src]
impl Debug for ConnectionAuto Trait Implementations
impl Send for Connection
impl Send for Connectionimpl Sync for Connection
impl Sync for ConnectionBlanket 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) -> TCreates 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 Timpl<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 TMutably 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 Ttype Output = T
Should always be Self
impl<T> Erased for T
impl<T> Erased for Timpl<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