use hashset for closure

This commit is contained in:
cy 2025-04-28 21:39:14 -04:00
parent 09181ae785
commit 76cbc85032
2 changed files with 5 additions and 3 deletions

View file

@ -13,7 +13,7 @@ use url::Url;
use crate::store::Store;
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct PathInfo {
pub path: StorePath<String>,
pub signatures: Vec<String>,
@ -59,6 +59,7 @@ impl PathInfo {
.context("query pathinfo for path")
}
// TODO: skip call to query_path_info and return Vec<Path>?
pub async fn get_closure(&self, store: &Store) -> Result<Vec<Self>> {
let futs = store
.compute_fs_closure(self.path.clone())

View file

@ -1,4 +1,5 @@
use std::{
collections::HashSet,
fs,
iter::once,
path::PathBuf,
@ -21,7 +22,7 @@ use crate::{PushArgs, path_info::PathInfo, store::Store, uploader::Uploader};
pub struct Push {
upstream_caches: Vec<Url>,
store_paths: Arc<RwLock<Vec<PathInfo>>>,
store_paths: Arc<RwLock<HashSet<PathInfo>>>,
signing_key: SigningKey<ed25519_dalek::SigningKey>,
store: Arc<Store>,
s3: Arc<AmazonS3>,
@ -61,7 +62,7 @@ impl Push {
Ok(Self {
upstream_caches: upstreams,
store_paths: Arc::new(RwLock::new(Vec::new())),
store_paths: Arc::new(RwLock::new(HashSet::new())),
signing_key,
store: Arc::new(store),
s3: Arc::new(s3_builder.build()?),