Closed
Description
In one of our projects, we need to implement an ObjectStore
trait form another crate backed by Azure storage account.
Conceptually this looks something like:
pub type FileMetaStream =
Pin<Box<dyn Stream<Item = Result<FileMeta>> + Send + Sync + 'static>>;
pub struct AzureFileSystem {
client: DataLakeClient,
}
fn convert<T>(response: ListPathsResponse) -> FileMetaStream {
todo!()
}
impl ObjectStore for AzureFileSystem {
async fn list_file(&self, prefix: &str) -> DFAccessResult<FileMetaStream> {
let (file_system, prefix) = match prefix.split_once("/") {
Some((file_system, prefix)) => (file_system.to_owned(), prefix),
None => (prefix.to_owned(), ""),
};
let stream = self
.client().
.clone()
.into_file_system_client(file_system)
.list_paths()
.directory(prefix)
.into_stream()
.flat_map(|f| convert(f.unwrap()));
Ok(Box::pin(stream))
}
}
Here the compiler complains, that the returned future does not implement Sync
. To make sure, I experimented with some other operations that implement into_stream
from the cosmos crate, which seems to display similar behaviour.
Trying to debug this I went through several permutations of further constraining types on Pageable
etc with Send
and Sync
, but to no avail.
Any guidance how to further debug this, or where to look for a mitigation would wonderful :).
Metadata
Metadata
Assignees
Labels
No labels