Skip to content

Commit

Permalink
improving the project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
angelip2303 committed Feb 12, 2024
1 parent 337e2f9 commit 3517f2d
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 31 deletions.
2 changes: 1 addition & 1 deletion examples/http_bench.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion examples/load_bench.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion examples/ntriples/main.rs
Original file line number Diff line number Diff line change
@@ -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> {
Expand Down
2 changes: 1 addition & 1 deletion examples/query_bench.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion examples/rdf_xml/main.rs
Original file line number Diff line number Diff line change
@@ -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> {
Expand Down
2 changes: 1 addition & 1 deletion examples/serialize_bench.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion examples/turtle/main.rs
Original file line number Diff line number Diff line change
@@ -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> {
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
6 changes: 3 additions & 3 deletions src/storage/matrix.rs → src/storage/layout/matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)>;

Expand Down
7 changes: 5 additions & 2 deletions src/storage/layout.rs → src/storage/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ use super::ZarrArray;

type ArrayToBytesCodec = Box<dyn ArrayToBytesCodecTraits>;

pub trait LayoutOps<C> {
pub mod matrix;
pub mod tabular;

pub(crate) trait LayoutOps<C> {
fn retrieve_attributes(&mut self, arr: &Array<OpendalStore>) -> StorageResult<Dictionary> {
// 4. We get the attributes so we can obtain some values that we will need
let attributes = arr.attributes();
Expand Down Expand Up @@ -155,7 +158,7 @@ pub trait LayoutOps<C> {
fn sharding_factor(&self, dimensionality: &Dimensionality) -> usize;
}

pub trait Layout<C>: LayoutOps<C> {
pub(crate) trait Layout<C>: LayoutOps<C> {
fn shape(&self, dimensionality: &Dimensionality) -> Vec<u64>;
fn data_type(&self) -> DataType;
fn chunk_shape(
Expand Down
14 changes: 7 additions & 7 deletions src/storage/tabular.rs → src/storage/layout/tabular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize>;
type AtomicZarrType = AtomicU64;
Expand Down
4 changes: 2 additions & 2 deletions tests/get_object_test.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tests/get_subject_test.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tests/orientation.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
4 changes: 2 additions & 2 deletions tests/write_read_test.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 3517f2d

Please sign in to comment.