pub struct SharedCacheHost<V = CachedAnswer> { /* private fields */ }Expand description
Answers shared-cache requests from this node’s own cache: the shards it holds.
It has no notion of who is asking; authorize callers before handing it a request (the pool
feature’s serve does).
Implementations§
Sourcepub fn new(semantic: Arc<SemanticCache<V>>) -> Self
pub fn new(semantic: Arc<SemanticCache<V>>) -> Self
Serves semantic, with no exact store and default HostLimits.
Sourcepub fn with_exact(self, store: Arc<dyn AnswerStore>) -> Self
pub fn with_exact(self, store: Arc<dyn AnswerStore>) -> Self
Serves exact entries from store too.
pub fn with_limits(self, limits: HostLimits) -> Self
pub fn semantic(&self) -> &Arc<SemanticCache<V>> ⓘ
pub fn exact(&self) -> Option<&Arc<dyn AnswerStore>>
pub fn limits(&self) -> &HostLimits
Sourcepub fn handle(&self, req: SharedCacheReq<V>) -> SharedCacheResp<V>
pub fn handle(&self, req: SharedCacheReq<V>) -> SharedCacheResp<V>
Answers one request.
Sourcepub fn handle_bytes(&self, bytes: &[u8]) -> Result<Vec<u8>, RemoteError>
pub fn handle_bytes(&self, bytes: &[u8]) -> Result<Vec<u8>, RemoteError>
Answers one encoded request with an encoded response. Unreadable requests get a
SharedCacheResp::Error too, so the asker learns why.
Trait Implementations§
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more