Enum cargo::util::cache_lock::CacheLockMode
source · pub enum CacheLockMode {
DownloadExclusive,
Shared,
MutateExclusive,
}
Expand description
The style of lock to acquire.
Variants§
DownloadExclusive
A DownloadExclusive
lock ensures that only one cargo is doing
resolution and downloading new packages.
You should use this when downloading new packages or doing resolution.
If another cargo has a MutateExclusive
lock, then an attempt to get
a DownloadExclusive
lock will block.
If another cargo has a Shared
lock, then both can operate
concurrently.
A Shared
lock allows multiple cargos to read from the source files.
You should use this when cargo is reading source files from the
package cache. This is typically done during the build phase, since
cargo only needs to read files during that time. This allows multiple
cargo processes to build concurrently without interfering with one
another, while guarding against other cargos using MutateExclusive
.
If another cargo has a MutateExclusive
lock, then an attempt to get
a Shared
will block.
If another cargo has a DownloadExclusive
lock, then they both can
operate concurrently under the assumption that downloading does not
modify existing source files.
MutateExclusive
A MutateExclusive
lock ensures no other cargo is reading or writing
from the package caches.
You should use this when modifying existing files in the package
cache. For example, things like garbage collection want to avoid
deleting files while other cargos are trying to read (Shared
) or
resolve or download (DownloadExclusive
).
If another cargo has a DownloadExclusive
or Shared
lock, then this
will block until they all release their locks.
Trait Implementations§
source§impl Clone for CacheLockMode
impl Clone for CacheLockMode
source§fn clone(&self) -> CacheLockMode
fn clone(&self) -> CacheLockMode
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CacheLockMode
impl Debug for CacheLockMode
source§impl PartialEq for CacheLockMode
impl PartialEq for CacheLockMode
source§fn eq(&self, other: &CacheLockMode) -> bool
fn eq(&self, other: &CacheLockMode) -> bool
self
and other
values to be equal, and is used
by ==
.