Bump lru from 0.7.8 to 0.8.0 (#6060)

* Bump lru from 0.7.8 to 0.8.0

Bumps [lru](https://github.com/jeromefroe/lru-rs) from 0.7.8 to 0.8.0.
- [Release notes](https://github.com/jeromefroe/lru-rs/releases)
- [Changelog](https://github.com/jeromefroe/lru-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jeromefroe/lru-rs/compare/0.7.8...0.8.0)

---
updated-dependencies:
- dependency-name: lru
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Change `LruCache` paramerter to `NonZeroUsize`

* Change type of `session_cache_lru_size` to `NonZeroUsize`

* Add expects instead of unwrap

Co-authored-by: Bastian Köcher <info@kchr.de>

* Use match to get rid of expects

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
dependabot[bot]
2022-10-04 11:28:21 +00:00
committed by GitHub
parent 7114a8cfca
commit a64cc4a860
17 changed files with 64 additions and 32 deletions
@@ -20,6 +20,7 @@
use std::{
collections::{HashMap, VecDeque},
num::NonZeroUsize,
pin::Pin,
time::Duration,
};
@@ -77,7 +78,10 @@ const LOG_TARGET: &str = "parachain::availability-recovery";
const N_PARALLEL: usize = 50;
// Size of the LRU cache where we keep recovered data.
const LRU_SIZE: usize = 16;
const LRU_SIZE: NonZeroUsize = match NonZeroUsize::new(16) {
Some(cap) => cap,
None => panic!("Availability-recovery cache size must be non-zero."),
};
const COST_INVALID_REQUEST: Rep = Rep::CostMajor("Peer sent unparsable request");