Struct ciruela::cluster::Connection [−][src]
pub struct Connection { /* fields omitted */ }
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 Connection
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,
[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) -> Upload
pub fn append_weak(&self, upload: SignedUpload) -> Upload
[src]
pub fn append_weak(&self, upload: SignedUpload) -> Upload
Initiate 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) -> Upload
pub fn replace_if_matches(
&self,
upload: SignedUpload,
old_image: ImageId
) -> Upload
[src]
pub fn replace_if_matches(
&self,
upload: SignedUpload,
old_image: ImageId
) -> Upload
Initiate 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) -> IndexFuture
Fetch 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 Debug for Connection
[src]
impl Debug for Connection
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Connection
[src]
impl Clone for Connection
fn clone(&self) -> Connection
[src]
fn clone(&self) -> Connection
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
Auto Trait Implementations
impl Send for Connection
impl Send for Connection
impl Sync for Connection
impl Sync for Connection