Skip to content

Commit

Permalink
refactor: local file system update - linux test update
Browse files Browse the repository at this point in the history
  • Loading branch information
hopeyen committed Jan 31, 2024
1 parent e2c0153 commit 09fce66
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions file-exchange/src/manifest/local_file_system.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use bytes::Bytes;
use futures::StreamExt;
use object_store::{path::Path, ObjectStore};
use object_store::{ObjectMeta, PutResult};

Expand All @@ -17,6 +16,7 @@ use crate::manifest::Error;
use super::file_hasher::hash_chunk;
use super::FileManifest;

#[derive(Debug)]
pub struct Store {
local_file_system: Arc<LocalFileSystem>,
read_concurrency: usize,
Expand Down Expand Up @@ -48,14 +48,12 @@ impl Store {

/// List out all files in the path, optionally filtered by a prefix to the filesystem
pub async fn list(&self, prefix: Option<&Path>) -> Result<Vec<ObjectMeta>, Error> {
let mut list_stream = self.local_file_system.list(prefix);

let mut objects = vec![];
while let Ok(Some(meta)) = list_stream.next().await.transpose() {
tracing::trace!("File name: {}, size: {}", meta.location, meta.size);
objects.push(meta.clone());
}
Ok(objects)
Ok(self
.local_file_system
.list_with_delimiter(prefix)
.await
.map_err(Error::ObjectStoreError)?
.objects)
}

/// Find a specific object by file name with optional prefix
Expand Down

0 comments on commit 09fce66

Please sign in to comment.