Skip to content

Commit

Permalink
FORGOT THAT I HAD AN ERROR
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoMfer committed Mar 13, 2024
1 parent 8b763dc commit b11ff5d
Showing 1 changed file with 1 addition and 46 deletions.
47 changes: 1 addition & 46 deletions src/metadata/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,50 +131,5 @@ impl<C> Metadata<C> {
Ok(self)
}

pub fn load<'a>(
&mut self,
store: Backend<'a>,
// threading_strategy: ThreadingStrategy, TODO: implement this
) -> MetadataResult<&mut Self> {
let operator = match store {
Backend::FileSystem(path) => {
let mut builder = Fs::default();
let path = PathBuf::from_str(path)?;

match path.exists() {
false => return Err(RemoteHDTError::PathDoesNotExist),
true => {
let path = match path.into_os_string().into_string() {
Ok(string) => string,
Err(_) => return Err(RemoteHDTError::OsPathToString),
};
builder.root(&path);
}
}

Operator::new(builder)?.finish()
}
Backend::HTTP(path) => {
let mut builder = Http::default();
builder.endpoint(path);
Operator::new(builder)?.finish()
}
};

let store: Arc<OpendalStore> = Arc::new(OpendalStore::new(operator.blocking()));
let arr = Array::new(store, ARRAY_NAME)?;
let dictionary = self.structure.retrieve_attributes(&arr)?;
self.dictionary = dictionary;
self.reference_system = self.dictionary.get_reference_system();
self.dimensionality = Dimensionality::new(&self.dictionary, &Graph::default());

match self.serialization {
Serialization::Zarr => self.array = Some(arr),
Serialization::Sparse => {
self.sparse_array = Some(self.layout.parse(&arr, &self.dimensionality)?)
}
}

Ok(self)
}

}

0 comments on commit b11ff5d

Please sign in to comment.