pub struct IndexCache { /* private fields */ }Expand description
The session’s graph indexes (a session config extension).
Implementations§
Source§impl IndexCache
impl IndexCache
Sourcepub fn loads(&self) -> u64
pub fn loads(&self) -> u64
How many indexes this cache has loaded from the database’s stored indexes instead of building them.
Sourcepub fn record_build(&self)
pub fn record_build(&self)
Count a build made outside the cache (an index that cannot be shared).
Sourcepub fn get(&self, key: &(String, Vec<FileIdentity>)) -> Option<Arc<GraphIndex>>
pub fn get(&self, key: &(String, Vec<FileIdentity>)) -> Option<Arc<GraphIndex>>
The index for key, if it is built and cached; nothing is built.
Sourcepub async fn get_or_build(
&self,
key: Option<(String, Vec<FileIdentity>)>,
build: BoxFuture<'_, Result<GraphIndex>>,
) -> Result<Arc<GraphIndex>>
pub async fn get_or_build( &self, key: Option<(String, Vec<FileIdentity>)>, build: BoxFuture<'_, Result<GraphIndex>>, ) -> Result<Arc<GraphIndex>>
The index for key (a fingerprint and file identities), built by
build if it is not cached. With no fingerprint, always built. The
database’s stored indexes are not consulted: see
Self::get_or_build_stored.
Sourcepub async fn get_or_build_stored(
&self,
config: &SessionConfig,
key: Option<(String, Vec<FileIdentity>)>,
build: BoxFuture<'_, Result<GraphIndex>>,
) -> Result<Arc<GraphIndex>>
pub async fn get_or_build_stored( &self, config: &SessionConfig, key: Option<(String, Vec<FileIdentity>)>, build: BoxFuture<'_, Result<GraphIndex>>, ) -> Result<Arc<GraphIndex>>
As Self::get_or_build, and on a miss, the index stored under the
same full key in the database of the session config belongs to, if
it has one. An index built in a writable database is stored there, in
the background, within the database’s ursa.index_storage_limit.
Sourcepub async fn get_or_build_for(
&self,
config: &SessionConfig,
key: Option<(String, Vec<FileIdentity>)>,
info: &BuildInfo,
build: BoxFuture<'_, Result<GraphIndex>>,
) -> Result<Arc<GraphIndex>>
pub async fn get_or_build_for( &self, config: &SessionConfig, key: Option<(String, Vec<FileIdentity>)>, info: &BuildInfo, build: BoxFuture<'_, Result<GraphIndex>>, ) -> Result<Arc<GraphIndex>>
As Self::get_or_build_stored, with notices about the build
(crate::notices) naming the graph in info.
Trait Implementations§
Source§impl Debug for IndexCache
impl Debug for IndexCache
Auto Trait Implementations§
impl !Freeze for IndexCache
impl Forget for IndexCache
impl RefUnwindSafe for IndexCache
impl Send for IndexCache
impl Sync for IndexCache
impl Unpin for IndexCache
impl UnsafeUnpin for IndexCache
impl UnwindSafe for IndexCache
Blanket Implementations§
impl<T> Allocation for T
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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