diff --git a/examples/http_bench.rs b/examples/http_bench.rs index 0a04f26..0b9f4ea 100644 --- a/examples/http_bench.rs +++ b/examples/http_bench.rs @@ -1,5 +1,5 @@ use remote_hdt::error::RemoteHDTError; -use remote_hdt::storage::matrix::MatrixLayout; +use remote_hdt::storage::layout::matrix::MatrixLayout; use remote_hdt::storage::ops::Ops; use remote_hdt::storage::params::{Backend, Serialization}; use remote_hdt::storage::Storage; diff --git a/examples/load_bench.rs b/examples/load_bench.rs index d990658..d679950 100644 --- a/examples/load_bench.rs +++ b/examples/load_bench.rs @@ -1,6 +1,6 @@ use remote_hdt::error::RemoteHDTError; +use remote_hdt::storage::layout::tabular::TabularLayout; use remote_hdt::storage::params::{Backend, Serialization}; -use remote_hdt::storage::tabular::TabularLayout; use remote_hdt::storage::Storage; use std::env; use std::time::Instant; diff --git a/examples/ntriples/main.rs b/examples/ntriples/main.rs index 04b51fc..8ab2feb 100644 --- a/examples/ntriples/main.rs +++ b/examples/ntriples/main.rs @@ -1,6 +1,6 @@ use remote_hdt::error::RemoteHDTError; +use remote_hdt::storage::layout::tabular::TabularLayout; use remote_hdt::storage::params::{Backend, ChunkingStrategy, ReferenceSystem, Serialization}; -use remote_hdt::storage::tabular::TabularLayout; use remote_hdt::storage::Storage; pub fn main() -> Result<(), RemoteHDTError> { diff --git a/examples/query_bench.rs b/examples/query_bench.rs index 23dc992..f97e448 100644 --- a/examples/query_bench.rs +++ b/examples/query_bench.rs @@ -1,5 +1,5 @@ use remote_hdt::error::RemoteHDTError; -use remote_hdt::storage::matrix::MatrixLayout; +use remote_hdt::storage::layout::matrix::MatrixLayout; use remote_hdt::storage::ops::Ops; use remote_hdt::storage::params::{Backend, Serialization}; use remote_hdt::storage::Storage; diff --git a/examples/rdf_xml/main.rs b/examples/rdf_xml/main.rs index 872c428..c415701 100644 --- a/examples/rdf_xml/main.rs +++ b/examples/rdf_xml/main.rs @@ -1,6 +1,6 @@ use remote_hdt::error::RemoteHDTError; +use remote_hdt::storage::layout::tabular::TabularLayout; use remote_hdt::storage::params::{Backend, ChunkingStrategy, ReferenceSystem, Serialization}; -use remote_hdt::storage::tabular::TabularLayout; use remote_hdt::storage::Storage; pub fn main() -> Result<(), RemoteHDTError> { diff --git a/examples/serialize_bench.rs b/examples/serialize_bench.rs index aba915a..2e15eb6 100644 --- a/examples/serialize_bench.rs +++ b/examples/serialize_bench.rs @@ -1,5 +1,5 @@ use remote_hdt::error::RemoteHDTError; -use remote_hdt::storage::matrix::MatrixLayout; +use remote_hdt::storage::layout::matrix::MatrixLayout; use remote_hdt::storage::params::{Backend, ChunkingStrategy, ReferenceSystem, Serialization}; use remote_hdt::storage::Storage; use std::env; diff --git a/examples/turtle/main.rs b/examples/turtle/main.rs index 89acf2e..76fe24a 100644 --- a/examples/turtle/main.rs +++ b/examples/turtle/main.rs @@ -1,6 +1,6 @@ use remote_hdt::error::RemoteHDTError; +use remote_hdt::storage::layout::tabular::TabularLayout; use remote_hdt::storage::params::{Backend, ChunkingStrategy, ReferenceSystem, Serialization}; -use remote_hdt::storage::tabular::TabularLayout; use remote_hdt::storage::Storage; pub fn main() -> Result<(), RemoteHDTError> { diff --git a/src/main.rs b/src/main.rs index db495e5..b476eb9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,9 @@ use clap::Parser; +use remote_hdt::storage::layout::tabular::TabularLayout; use remote_hdt::storage::params::Backend; use remote_hdt::storage::params::ChunkingStrategy; use remote_hdt::storage::params::ReferenceSystem; use remote_hdt::storage::params::Serialization; -use remote_hdt::storage::tabular::TabularLayout; use remote_hdt::storage::Storage; use remote_hdt::storage::StorageResult; diff --git a/src/storage/matrix.rs b/src/storage/layout/matrix.rs similarity index 97% rename from src/storage/matrix.rs rename to src/storage/layout/matrix.rs index c2a5d7a..8d19e1b 100644 --- a/src/storage/matrix.rs +++ b/src/storage/layout/matrix.rs @@ -10,15 +10,15 @@ use zarrs::array::DataType; use zarrs::array::DimensionName; use zarrs::array::FillValue; -use super::layout::Layout; -use super::layout::LayoutOps; -use super::AtomicZarrType; use super::ChunkingStrategy; use super::Dimensionality; use super::ReferenceSystem; use super::StorageResult; use crate::io::Graph; +use crate::storage::layout::LayoutOps; +use crate::storage::AtomicZarrType; +use crate::storage::Layout; type Chunk = Vec<(u32, u32)>; diff --git a/src/storage/layout.rs b/src/storage/layout/mod.rs similarity index 98% rename from src/storage/layout.rs rename to src/storage/layout/mod.rs index d0385ac..03b5859 100644 --- a/src/storage/layout.rs +++ b/src/storage/layout/mod.rs @@ -26,7 +26,10 @@ use super::ZarrArray; type ArrayToBytesCodec = Box; -pub trait LayoutOps { +pub mod matrix; +pub mod tabular; + +pub(crate) trait LayoutOps { fn retrieve_attributes(&mut self, arr: &Array) -> StorageResult { // 4. We get the attributes so we can obtain some values that we will need let attributes = arr.attributes(); @@ -155,7 +158,7 @@ pub trait LayoutOps { fn sharding_factor(&self, dimensionality: &Dimensionality) -> usize; } -pub trait Layout: LayoutOps { +pub(crate) trait Layout: LayoutOps { fn shape(&self, dimensionality: &Dimensionality) -> Vec; fn data_type(&self) -> DataType; fn chunk_shape( diff --git a/src/storage/tabular.rs b/src/storage/layout/tabular.rs similarity index 94% rename from src/storage/tabular.rs rename to src/storage/layout/tabular.rs index 3dbfcb2..7ee9c15 100644 --- a/src/storage/tabular.rs +++ b/src/storage/layout/tabular.rs @@ -10,15 +10,15 @@ use zarrs::array::DataType; use zarrs::array::DimensionName; use zarrs::array::FillValue; -use crate::io::Graph; - -use super::layout::Layout; -use super::layout::LayoutOps; -use super::params::ChunkingStrategy; -use super::params::Dimensionality; -use super::params::ReferenceSystem; +use super::ChunkingStrategy; +use super::Dimensionality; +use super::ReferenceSystem; use super::StorageResult; +use crate::io::Graph; +use crate::storage::layout::LayoutOps; +use crate::storage::Layout; + type Chunk = (u32, u32, u32); pub struct TabularLayout; diff --git a/src/storage/mod.rs b/src/storage/mod.rs index e3c03aa..3a4bd72 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -25,11 +25,9 @@ use self::params::Dimensionality; use self::params::ReferenceSystem; use self::params::Serialization; -mod layout; -pub mod matrix; +pub mod layout; pub mod ops; pub mod params; -pub mod tabular; pub type ZarrArray = CsMat; type AtomicZarrType = AtomicU64; diff --git a/tests/get_object_test.rs b/tests/get_object_test.rs index 3348b4a..03f8e38 100644 --- a/tests/get_object_test.rs +++ b/tests/get_object_test.rs @@ -1,11 +1,11 @@ -use remote_hdt::storage::matrix::MatrixLayout; +use remote_hdt::storage::layout::matrix::MatrixLayout; +use remote_hdt::storage::layout::tabular::TabularLayout; use remote_hdt::storage::ops::Ops; use remote_hdt::storage::ops::OpsFormat; use remote_hdt::storage::params::Backend; use remote_hdt::storage::params::ChunkingStrategy; use remote_hdt::storage::params::ReferenceSystem; use remote_hdt::storage::params::Serialization; -use remote_hdt::storage::tabular::TabularLayout; use remote_hdt::storage::Storage; use sprs::TriMat; use std::error::Error; diff --git a/tests/get_subject_test.rs b/tests/get_subject_test.rs index 011623d..d8a44fd 100644 --- a/tests/get_subject_test.rs +++ b/tests/get_subject_test.rs @@ -1,11 +1,11 @@ -use remote_hdt::storage::matrix::MatrixLayout; +use remote_hdt::storage::layout::matrix::MatrixLayout; +use remote_hdt::storage::layout::tabular::TabularLayout; use remote_hdt::storage::ops::Ops; use remote_hdt::storage::ops::OpsFormat; use remote_hdt::storage::params::Backend; use remote_hdt::storage::params::ChunkingStrategy; use remote_hdt::storage::params::ReferenceSystem; use remote_hdt::storage::params::Serialization; -use remote_hdt::storage::tabular::TabularLayout; use remote_hdt::storage::Storage; use sprs::TriMat; use std::error::Error; diff --git a/tests/orientation.rs b/tests/orientation.rs index 96afc8b..71c05df 100644 --- a/tests/orientation.rs +++ b/tests/orientation.rs @@ -1,11 +1,11 @@ -use remote_hdt::storage::matrix::MatrixLayout; +use remote_hdt::storage::layout::matrix::MatrixLayout; +use remote_hdt::storage::layout::tabular::TabularLayout; use remote_hdt::storage::ops::Ops; use remote_hdt::storage::ops::OpsFormat; use remote_hdt::storage::params::Backend; use remote_hdt::storage::params::ChunkingStrategy; use remote_hdt::storage::params::ReferenceSystem; use remote_hdt::storage::params::Serialization; -use remote_hdt::storage::tabular::TabularLayout; use remote_hdt::storage::Storage; use std::error::Error; diff --git a/tests/write_read_test.rs b/tests/write_read_test.rs index 5ef445c..0243266 100644 --- a/tests/write_read_test.rs +++ b/tests/write_read_test.rs @@ -1,9 +1,9 @@ -use remote_hdt::storage::matrix::MatrixLayout; +use remote_hdt::storage::layout::matrix::MatrixLayout; +use remote_hdt::storage::layout::tabular::TabularLayout; use remote_hdt::storage::params::Backend; use remote_hdt::storage::params::ChunkingStrategy; use remote_hdt::storage::params::ReferenceSystem; use remote_hdt::storage::params::Serialization; -use remote_hdt::storage::tabular::TabularLayout; use remote_hdt::storage::Storage; mod common;