pub(crate) struct Server {
agent: Agent,
authorization: String,
started: Instant,
limits: Limits,
}Expand description
One server, signed in: requests with the account’s login, over TLS (plain
HTTP only to a test’s own stand-in, dav::allowed), never redirected. Its
requests go through the process’s one agent (dav::shared_agent): a pull,
the sends after it and the next pull reuse one connection while it is
open, each request with its own budget (limits).
Fields§
§agent: Agent§started: Instant§limits: LimitsImplementations§
Source§impl Server
impl Server
pub(crate) fn new(login: &Login, limits: Limits) -> Result<Server, SyncError>
pub(crate) fn request( &self, large: bool, method: &str, url: &str, headers: &[(&str, &str)], body: Vec<u8>, ) -> Result<Response<Body>, SyncError>
Sourcefn request_with(
&self,
whole: Duration,
method: &str,
url: &str,
headers: &[(&str, &str)],
body: Vec<u8>,
) -> Result<Response<Body>, SyncError>
fn request_with( &self, whole: Duration, method: &str, url: &str, headers: &[(&str, &str)], body: Vec<u8>, ) -> Result<Response<Body>, SyncError>
A request run with whole for all of it, limits.wait to connect and
for each read or write (stalls::ask, its answer’s body read after
included).
Sourcepub(crate) fn list(&self, url: &str) -> Result<Listing, SyncError>
pub(crate) fn list(&self, url: &str) -> Result<Listing, SyncError>
A folder’s own ETag and what it holds (Depth: 1), by name.
Sourcepub(crate) fn stat(&self, url: &str) -> Result<Option<Item>, SyncError>
pub(crate) fn stat(&self, url: &str) -> Result<Option<Item>, SyncError>
One file as the server has it now (Depth: 0): its ETag, size and
checksums; none when it is not there.
Sourcepub(crate) fn put_file(
&self,
url: &str,
body: Vec<u8>,
seen: Option<&str>,
modified_s: u64,
sha1: &str,
) -> Result<(u16, Option<String>), PutFailed>
pub(crate) fn put_file( &self, url: &str, body: Vec<u8>, seen: Option<&str>, modified_s: u64, sha1: &str, ) -> Result<(u16, Option<String>), PutFailed>
One of this device’s files sent whole beside a sync app (send): over
what is there as it was seen (If-Match its ETag, If-None-Match: *
when none was there), dated as the file here (X-OC-Mtime), with its
SHA-1 (OC-Checksum): a Nextcloud client finding the same file there
as here, same size, date and checksum, takes it as its own, without a
download and without a conflicted copy. Its status, and its ETag there.
Given the time its size asks: limits.large, and as long more as it
takes at limits.floor bytes a second (a file still moving is not cut
at a flat minute); cut when nothing moved for limits.stall. Failed:
why, how long it lasted and how many of its bytes went (PutFailed).
Sourcepub(crate) fn small(
&self,
url: &str,
) -> Result<Option<(Vec<u8>, Option<String>)>, SyncError>
pub(crate) fn small( &self, url: &str, ) -> Result<Option<(Vec<u8>, Option<String>)>, SyncError>
A small file whole (share::SMALL_FILE at most) and its ETag; none
when it is not there, or larger than any such file. A body that came
cut, or whose end cannot be told, is an error: never taken as whole.
Sourcepub(crate) fn small_up_to(
&self,
url: &str,
cap: u64,
) -> Result<Option<(Vec<u8>, Option<String>)>, SyncError>
pub(crate) fn small_up_to( &self, url: &str, cap: u64, ) -> Result<Option<(Vec<u8>, Option<String>)>, SyncError>
The same, at most cap bytes (a texts’ file may grow past a small file’s).
Sourcefn tail(&self, url: &str, from: u64) -> Result<Option<Got>, SyncError>
fn tail(&self, url: &str, from: u64) -> Result<Option<Got>, SyncError>
A file from from on (all of it from 0): where what came starts (0
when the server sent it all), what came as it came, and why the rest
did not; none when it is not there, or shorter than from now.
Sourcepub(crate) fn put(
&self,
url: &str,
body: Vec<u8>,
seen: Option<&str>,
) -> Result<(u16, Option<String>), SyncError>
pub(crate) fn put( &self, url: &str, body: Vec<u8>, seen: Option<&str>, ) -> Result<(u16, Option<String>), SyncError>
A file sent whole (PUT), over what is there as it was seen: If-Match
its ETag, or If-None-Match: * when none was there. Its status, and its
ETag there when the server says it.
Sourcepub(crate) fn mkcol(&self, url: &str) -> Result<u16, SyncError>
pub(crate) fn mkcol(&self, url: &str) -> Result<u16, SyncError>
A folder made (MKCOL): 201 made, 405 there already.
Sourcepub(crate) fn delete(
&self,
url: &str,
seen: Option<&str>,
) -> Result<u16, SyncError>
pub(crate) fn delete( &self, url: &str, seen: Option<&str>, ) -> Result<u16, SyncError>
One of this device’s files taken out (DELETE), only as it was seen (If-Match) when its ETag is known.
Sourcepub(crate) fn etag(&self, url: &str) -> Result<Option<String>, SyncError>
pub(crate) fn etag(&self, url: &str) -> Result<Option<String>, SyncError>
A file’s ETag there now (Depth: 0); none when it is not there.
Sourcepub(crate) fn download(
&self,
url: &str,
path: &Path,
limit: u64,
) -> Result<Option<u64>, SyncError>
pub(crate) fn download( &self, url: &str, path: &Path, limit: u64, ) -> Result<Option<u64>, SyncError>
A file fetched whole into path, under a hidden name beside it, then
renamed once all of it came (its length said, or chunked to its end),
at most limit bytes, as long as it moves (Limits::blob). Its size;
none when it is not there, or larger.
Auto Trait Implementations§
impl !RefUnwindSafe for Server
impl !UnwindSafe for Server
impl Freeze for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnsafeUnpin for Server
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.