update some Rust dependencies

I didn't go to quite the latest version of everything, in an effort to
minimize duplicates in the cargo tree.
This commit is contained in:
Scott Lamb
2024-01-06 10:43:20 -08:00
parent 2bcee02ea6
commit 86816e862a
25 changed files with 695 additions and 597 deletions

View File

@@ -4,14 +4,14 @@
//! UI bundled (compiled/linked) into the executable for single-file deployment.
use fnv::FnvHashMap;
use base::FastHashMap;
use http::{header, HeaderMap, HeaderValue};
use std::io::Read;
use std::sync::OnceLock;
use crate::body::{BoxedError, Chunk};
pub struct Ui(FnvHashMap<&'static str, FileSet>);
pub struct Ui(FastHashMap<&'static str, FileSet>);
/// A file as passed in from `build.rs`.
struct BuildFile {

View File

@@ -7,10 +7,10 @@ use crate::web;
use crate::web::accept::Listener;
use base::clock;
use base::err;
use base::FastHashMap;
use base::{bail, Error};
use bpaf::Bpaf;
use db::{dir, writer};
use fnv::FnvHashMap;
use hyper::service::{make_service_fn, service_fn};
use itertools::Itertools;
use retina::client::SessionGroup;
@@ -134,7 +134,7 @@ struct Syncer {
}
#[cfg(target_os = "linux")]
fn get_preopened_sockets() -> Result<FnvHashMap<String, Listener>, Error> {
fn get_preopened_sockets() -> Result<FastHashMap<String, Listener>, Error> {
use libsystemd::activation::IsType as _;
use std::os::fd::{FromRawFd, IntoRawFd};
@@ -142,7 +142,7 @@ fn get_preopened_sockets() -> Result<FnvHashMap<String, Listener>, Error> {
// activation.
if std::env::var_os("LISTEN_FDS").is_none() {
info!("no LISTEN_FDs");
return Ok(FnvHashMap::default());
return Ok(FastHashMap::default());
}
let sockets = libsystemd::activation::receive_descriptors_with_names(false)
@@ -176,13 +176,14 @@ fn get_preopened_sockets() -> Result<FnvHashMap<String, Listener>, Error> {
}
#[cfg(not(target_os = "linux"))]
fn get_preopened_sockets() -> Result<FnvHashMap<String, Listener>, Error> {
Ok(FnvHashMap::default())
fn get_preopened_sockets() -> Result<FastHashMap<String, Listener>, Error> {
Ok(FastHashMap::default())
}
fn read_config(path: &Path) -> Result<ConfigFile, Error> {
let config = std::fs::read(path)?;
let config = toml::from_slice(&config).map_err(|e| err!(InvalidArgument, source(e)))?;
let config = std::str::from_utf8(&config).map_err(|e| err!(InvalidArgument, source(e)))?;
let config = toml::from_str(&config).map_err(|e| err!(InvalidArgument, source(e)))?;
Ok(config)
}
@@ -267,7 +268,7 @@ fn prepare_unix_socket(p: &Path) {
fn make_listener(
addr: &config::AddressConfig,
#[cfg_attr(not(target_os = "linux"), allow(unused))] preopened: &mut FnvHashMap<
#[cfg_attr(not(target_os = "linux"), allow(unused))] preopened: &mut FastHashMap<
String,
Listener,
>,
@@ -341,11 +342,11 @@ async fn inner(
// Start a streamer for each stream.
let mut streamers = Vec::new();
let mut session_groups_by_camera: FnvHashMap<i32, Arc<retina::client::SessionGroup>> =
FnvHashMap::default();
let mut session_groups_by_camera: FastHashMap<i32, Arc<retina::client::SessionGroup>> =
FastHashMap::default();
let syncers = if !read_only {
let l = db.lock();
let mut dirs = FnvHashMap::with_capacity_and_hasher(
let mut dirs = FastHashMap::with_capacity_and_hasher(
l.sample_file_dirs_by_id().len(),
Default::default(),
);
@@ -377,7 +378,7 @@ async fn inner(
// Then, with the lock dropped, create syncers.
drop(l);
let mut syncers = FnvHashMap::with_capacity_and_hasher(dirs.len(), Default::default());
let mut syncers = FastHashMap::with_capacity_and_hasher(dirs.len(), Default::default());
for (id, dir) in dirs.drain() {
let (channel, join) = writer::start_syncer(db.clone(), shutdown_rx.clone(), id)?;
syncers.insert(id, Syncer { dir, channel, join });

View File

@@ -985,7 +985,7 @@ impl FileBuilder {
pub fn build(
mut self,
db: Arc<db::Database>,
dirs_by_stream_id: Arc<::fnv::FnvHashMap<i32, Arc<dir::SampleFileDir>>>,
dirs_by_stream_id: Arc<::base::FastHashMap<i32, Arc<dir::SampleFileDir>>>,
) -> Result<File, Error> {
let mut max_end = None;
let mut etag = blake3::Hasher::new();
@@ -1777,7 +1777,7 @@ impl BodyState {
struct FileInner {
db: Arc<db::Database>,
dirs_by_stream_id: Arc<::fnv::FnvHashMap<i32, Arc<dir::SampleFileDir>>>,
dirs_by_stream_id: Arc<::base::FastHashMap<i32, Arc<dir::SampleFileDir>>>,
segments: Vec<Segment>,
slices: Slices<Slice>,
buf: Vec<u8>,

View File

@@ -20,13 +20,13 @@ use crate::mp4;
use crate::web::static_file::Ui;
use base::err;
use base::Error;
use base::FastHashMap;
use base::ResultExt;
use base::{bail, clock::Clocks, ErrorKind};
use core::borrow::Borrow;
use core::str::FromStr;
use db::dir::SampleFileDir;
use db::{auth, recording};
use fnv::FnvHashMap;
use http::header::{self, HeaderValue};
use http::{status::StatusCode, Request, Response};
use hyper::body::Bytes;
@@ -172,7 +172,7 @@ pub struct Config<'a> {
pub struct Service {
db: Arc<db::Database>,
ui: Ui,
dirs_by_stream_id: Arc<FnvHashMap<i32, Arc<SampleFileDir>>>,
dirs_by_stream_id: Arc<FastHashMap<i32, Arc<SampleFileDir>>>,
time_zone_name: String,
allow_unauthenticated_permissions: Option<db::Permissions>,
trust_forward_hdrs: bool,
@@ -199,7 +199,7 @@ impl Service {
let dirs_by_stream_id = {
let l = config.db.lock();
let mut d =
FnvHashMap::with_capacity_and_hasher(l.streams_by_id().len(), Default::default());
FastHashMap::with_capacity_and_hasher(l.streams_by_id().len(), Default::default());
for (&id, s) in l.streams_by_id().iter() {
let dir_id = match s.sample_file_dir_id {
Some(d) => d,

View File

@@ -144,8 +144,8 @@ fn encode_sid(sid: db::RawSessionId, flags: i32) -> String {
#[cfg(test)]
mod tests {
use base::FastHashMap;
use db::testutil;
use fnv::FnvHashMap;
use tracing::info;
use crate::web::tests::Server;
@@ -163,7 +163,7 @@ mod tests {
let resp = cli.post(&login_url).send().await.unwrap();
assert_eq!(resp.status(), reqwest::StatusCode::BAD_REQUEST);
let mut p = FnvHashMap::default();
let mut p = FastHashMap::default();
p.insert("username", "slamb");
p.insert("password", "asdf");
let resp = cli.post(&login_url).json(&p).send().await.unwrap();
@@ -190,7 +190,7 @@ mod tests {
testutil::init();
let s = Server::new(None);
let cli = reqwest::Client::new();
let mut p = FnvHashMap::default();
let mut p = FastHashMap::default();
p.insert("username", "slamb");
p.insert("password", "hunter2");
let resp = cli
@@ -239,7 +239,7 @@ mod tests {
.get("csrf")
.unwrap()
.as_str();
let mut p = FnvHashMap::default();
let mut p = FastHashMap::default();
p.insert("csrf", csrf);
let resp = cli
.post(&format!("{}/api/logout", &s.base_url))