pub struct Client { /* private fields */ }Expand description
What the clients of every service share: credentials, endpoints, an HTTP client and the consistency token. Cloning it is cheap, and the clones share all of it.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new() -> Result<Self, Error>
pub fn new() -> Result<Self, Error>
A client configured by the environment: the credentials
default_credentials finds, and the
region ORIGINCLOUD_REGION names, if any.
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
A builder of a client configured otherwise.
Sourcepub fn service(&self, shortcode: &str, regional: bool) -> Service
pub fn service(&self, shortcode: &str, regional: bool) -> Service
The endpoint of the service whose host starts with shortcode, such
as pvs. A regional service answers at its region’s front door when
the client has a region; a global one always at its regionless host.
The generated clients call it.
A shortcode that isn’t a host label, [a-z0-9-]+, makes every call
of the service fail with Error::Config.
Sourcepub fn consistency_token(&self) -> String
pub fn consistency_token(&self) -> String
The consistency token the client holds: the one the last answer
carrying one brought, or empty before any. Hand it to
Client::set_consistency_token of a client in another process for
its reads to show this client’s writes.
Sourcepub fn set_consistency_token(&self, token: impl Into<String>)
pub fn set_consistency_token(&self, token: impl Into<String>)
Replaces the consistency token the client sends with its calls.
The API merges a mutation’s position into the token the mutation presented, so writes made one after another each answer with a token covering all of them. Writes made concurrently each present the same earlier token, and the client keeps whichever token is answered last: a read then sees that write, not necessarily the others, until it presents a token covering them, such as one from waiting on their operations.