async fn fetch_trace_batch(
        &self,
        key: &str,
        hint: CacheHint,
    ) -> Result<Arc<BlobTraceBatchPart>, Error> {
        let deadline = Instant::now() + Duration::from_secs(1_000_000_000);
        let bytes = self
            .blob
            .get(deadline, key)
            .await?
            .ok_or_else(|| Error::from(format!("no blob for trace batch at key: {}", key)))?;
        let bytes_len = bytes.len();
        self.metrics
            .blob_read_cache_fetch_bytes
            .inc_by(u64::cast_from(bytes_len));
        let batch: BlobTraceBatchPart = BlobTraceBatchPart::decode(&bytes)
            .map_err(|err| Error::from(format!("invalid trace batch at key {}: {}", key, err)))?;

        debug_assert_eq!(batch.validate(), Ok(()), "{:?}", &batch);
        // NB: Batch blobs are write-once, so we're not worried about the race
        // of two get calls for the same key.
        let ret = Arc::new(batch);
        if let CacheHint::MaybeAdd = hint {
            self.cache
                .maybe_add_trace(key.to_owned(), bytes_len, Arc::clone(&ret))?;
        }
        Ok(ret)
    }
/// Synchronously fetches the batch for the given key.
Synchronously fetches the batch for the given key.
Synchronously fetches the batch for the given key .
async fn fetch_trace_batch(
        &self,
        key: &str,
        hint: CacheHint,
    ) -> Result<Arc<BlobTraceBatchPart>, Error> {
        let deadline = Instant::now() + Duration::from_secs(1_000_000_000);
        let bytes = self
            .blob
            .get(deadline, key)
            .await?
            .ok_or_else(|| Error::from(format!("no blob for trace batch at key: {}", key)))?;
        let bytes_len = bytes.len();
        self.metrics
            .blob_read_cache_fetch_bytes
            .inc_by(u64::cast_from(bytes_len));
        let batch: BlobTraceBatchPart = BlobTraceBatchPart::decode(&bytes)
            .map_err(|err| Error::from(format!("invalid trace batch at key {}: {}", key, err)))?;
        debug_assert_eq!(batch.validate(), Ok(()), "{:?}", &batch);
        // NB: Batch blobs are write-once, so we're not worried about the race
        // of two get calls for the same key.
        let ret = Arc::new(batch);
        if let CacheHint::MaybeAdd = hint {
            self.cache
                .maybe_add_trace(key.to_owned(), bytes_len, Arc::clone(&ret))?;
        }
        Ok(ret)
    }
async fn fetch_trace_batch ( & self , key : & str , hint : CacheHint , ) -> Result < Arc < BlobTraceBatchPart > , Error > { let deadline = Instant :: now ( ) + Duration :: from_secs ( 1_000_000_000 ) ; let bytes = self . blob . get ( deadline , key ) . await ? . ok_or_else ( | | Error :: from ( format ! ( " " key ) ) ) ? ; let bytes_len = bytes . len ( ) ; self . metrics . blob_read_cache_fetch_bytes . inc_by ( u64 :: cast_from ( bytes_len ) ) ; let batch : BlobTraceBatchPart = BlobTraceBatchPart :: decode ( & bytes ) . map_err ( | err | Error :: from ( format ! ( " " key err ) ) ) ? ; debug_assert_eq ! ( batch validate ( ) Ok ( ( ) ) " " batch ) ; // NB: Batch blobs are write-once, so we're not worried about the race // of two get calls for the same key. let ret = Arc :: new ( batch ) ; if let CacheHint :: MaybeAdd = hint { self . cache . maybe_add_trace ( key . to_owned ( ) , bytes_len , Arc :: clone ( & ret ) ) ? ; } Ok ( ret ) }
Synchronously fetches the batch for the given key.
Synchronously fetches the batch for the given key .
&self
key
&str
hint
CacheHint
&self
key
&str
hint
CacheHint