pub struct Population<'cache> { /* private fields */ }Expand description
Exclusive population capability for one build identifier.
Dropping the guard releases its process lock. A staging file is not created
until Population::into_writer consumes this value.
Implementations§
Source§impl<'cache> Population<'cache>
impl<'cache> Population<'cache>
Sourcepub fn into_writer(self) -> Result<PopulationWriter<'cache>>
pub fn into_writer(self) -> Result<PopulationWriter<'cache>>
Creates a staged GSYM file and transitions to its write-only owner.
The returned writer owns this population capability. Writers can stream directly into it without a second full-size allocation or copy.
§Errors
Returns an error if the temporary file cannot be created.
Sourcepub fn record_failure_for(
self,
kind: FailureKind,
lifetime: Duration,
) -> Result<CachedFailure>
pub fn record_failure_for( self, kind: FailureKind, lifetime: Duration, ) -> Result<CachedFailure>
Atomically records an expiring population failure.
Consuming the population guard ensures no successful publisher for the
same build identifier races this record. Applications should use a
short lifetime for missing inputs and transient resource failures.
The lifetime is rounded up to whole Unix seconds and must be nonzero and
at most MAX_FAILURE_TTL.
Returns the cached failure, including its rounded expiration time.
§Errors
Returns an error if lifetime is zero, exceeds MAX_FAILURE_TTL,
cannot be represented, or the record cannot be published.