use hashset for closure
This commit is contained in:
parent
09181ae785
commit
76cbc85032
2 changed files with 5 additions and 3 deletions
|
@ -13,7 +13,7 @@ use url::Url;
|
||||||
|
|
||||||
use crate::store::Store;
|
use crate::store::Store;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct PathInfo {
|
pub struct PathInfo {
|
||||||
pub path: StorePath<String>,
|
pub path: StorePath<String>,
|
||||||
pub signatures: Vec<String>,
|
pub signatures: Vec<String>,
|
||||||
|
@ -59,6 +59,7 @@ impl PathInfo {
|
||||||
.context("query pathinfo for path")
|
.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>> {
|
pub async fn get_closure(&self, store: &Store) -> Result<Vec<Self>> {
|
||||||
let futs = store
|
let futs = store
|
||||||
.compute_fs_closure(self.path.clone())
|
.compute_fs_closure(self.path.clone())
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use std::{
|
use std::{
|
||||||
|
collections::HashSet,
|
||||||
fs,
|
fs,
|
||||||
iter::once,
|
iter::once,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
|
@ -21,7 +22,7 @@ use crate::{PushArgs, path_info::PathInfo, store::Store, uploader::Uploader};
|
||||||
|
|
||||||
pub struct Push {
|
pub struct Push {
|
||||||
upstream_caches: Vec<Url>,
|
upstream_caches: Vec<Url>,
|
||||||
store_paths: Arc<RwLock<Vec<PathInfo>>>,
|
store_paths: Arc<RwLock<HashSet<PathInfo>>>,
|
||||||
signing_key: SigningKey<ed25519_dalek::SigningKey>,
|
signing_key: SigningKey<ed25519_dalek::SigningKey>,
|
||||||
store: Arc<Store>,
|
store: Arc<Store>,
|
||||||
s3: Arc<AmazonS3>,
|
s3: Arc<AmazonS3>,
|
||||||
|
@ -61,7 +62,7 @@ impl Push {
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
upstream_caches: upstreams,
|
upstream_caches: upstreams,
|
||||||
store_paths: Arc::new(RwLock::new(Vec::new())),
|
store_paths: Arc::new(RwLock::new(HashSet::new())),
|
||||||
signing_key,
|
signing_key,
|
||||||
store: Arc::new(store),
|
store: Arc::new(store),
|
||||||
s3: Arc::new(s3_builder.build()?),
|
s3: Arc::new(s3_builder.build()?),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue