pub struct Client { /* private fields */ }Expand description
A connection to the daemon.
Implementations§
Source§impl Client
impl Client
Sourcepub fn connect_with_timeout(path: &Path, timeout: Duration) -> Result<Self>
pub fn connect_with_timeout(path: &Path, timeout: Duration) -> Result<Self>
Sourcepub fn hello_in_mode(
&mut self,
solver_path: &str,
mode: VerificationMode,
) -> Result<Identity>
pub fn hello_in_mode( &mut self, solver_path: &str, mode: VerificationMode, ) -> Result<Identity>
Identifies a solver and negotiates the connection’s cache namespace.
Call once before any cache lookup or store. A failed or repeated handshake retires the connection; connect again to retry.
§Errors
I/O errors, a rejected handshake, or a stale daemon protocol.
Sourcepub fn get(&mut self, key: &[u8; 32]) -> Result<Option<Vec<u8>>>
pub fn get(&mut self, key: &[u8; 32]) -> Result<Option<Vec<u8>>>
The cached reply for key, or None on a miss.
Requires a successful Self::hello or Self::hello_in_mode.
§Errors
I/O errors.
Sourcepub fn get_with_effort(
&mut self,
key: &[u8; 32],
) -> Result<Option<(Vec<u8>, Option<Effort>)>>
pub fn get_with_effort( &mut self, key: &[u8; 32], ) -> Result<Option<(Vec<u8>, Option<Effort>)>>
The cached reply for key with its recorded effort, if the daemon
sent one, or None on a miss.
§Errors
I/O errors.
Sourcepub fn put_all(
&mut self,
puts: impl IntoIterator<Item = ([u8; 32], PutMeta, Vec<u8>)>,
) -> Result<()>
pub fn put_all( &mut self, puts: impl IntoIterator<Item = ([u8; 32], PutMeta, Vec<u8>)>, ) -> Result<()>
Stores every (key, meta, reply) in order, sending up to a window of
requests before reading their acknowledgements, so a session’s stores
cost a few round trips instead of one each. The daemon answers each
request in order, exactly as for Client::put.
§Errors
I/O errors. Stores before the failing window may have been made.