-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
want to try something, just in case i fk up
- Loading branch information
Showing
7 changed files
with
386 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,61 @@ | ||
pub struct DefaultComplementLayout; | ||
use super::ComplementLayout; | ||
|
||
|
||
pub struct DefaultComplementLayout; | ||
use crate::complement::Dimensionality; | ||
use crate::complement::layout::DataType; | ||
use crate::complement::ChunkingStrategy; | ||
use crate::complement::layout::ComplementStorageResult; | ||
use crate::complement::layout::ComplementLayoutOps; | ||
|
||
use std::num::NonZeroU64; | ||
|
||
use zarrs::array::ChunkGrid; | ||
use zarrs::array::FillValue; | ||
use zarrs::array::DimensionName; | ||
use zarrs::array::codec::ArrayToBytesCodecTraits; | ||
use zarrs::array::codec::array_to_bytes::sharding::ShardingCodecBuilder; | ||
use zarrs::array::codec::GzipCodec; | ||
|
||
|
||
impl ComplementLayout for DefaultComplementLayout{ | ||
Check failure on line 21 in src/complement/layout/default.rs GitHub Actions / Test Suite (stable)
Check failure on line 21 in src/complement/layout/default.rs GitHub Actions / Clippy (stable)
|
||
fn shape(&self, dimensionality: &Dimensionality) -> Vec<u64> { | ||
vec![ | ||
dimensionality.get_graph_size(), | ||
dimensionality.get_nodes_size(), | ||
] | ||
} | ||
|
||
fn data_type(&self) -> DataType { | ||
DataType::UInt64 | ||
} | ||
|
||
fn chunk_shape(&self, chunking_strategy: ChunkingStrategy, _: &Dimensionality) -> ChunkGrid { | ||
vec![chunking_strategy.into(), NonZeroU64::new(3).unwrap()].into() // TODO: make this a constant value | ||
} | ||
|
||
fn fill_value(&self) -> FillValue { | ||
FillValue::from(0u64) | ||
} | ||
|
||
fn dimension_names(&self) -> Option<Vec<DimensionName>> { | ||
Some(vec![ | ||
DimensionName::new("Triples"), | ||
DimensionName::new("Fields"), | ||
]) | ||
} | ||
|
||
//TODO | ||
fn array_to_bytes_codec( | ||
&self, | ||
_: &Dimensionality, | ||
) -> ComplementStorageResult<Box<dyn ArrayToBytesCodecTraits>> { | ||
let mut sharding_codec_builder = ShardingCodecBuilder::new(vec![1, 3].try_into()?); | ||
sharding_codec_builder.bytes_to_bytes_codecs(vec![Box::new(GzipCodec::new(5)?)]); | ||
Ok(Box::new(sharding_codec_builder.build())) | ||
} | ||
} | ||
|
||
impl ComplementLayoutOps for DefaultComplementLayout { | ||
Check failure on line 59 in src/complement/layout/default.rs GitHub Actions / Test Suite (stable)
Check failure on line 59 in src/complement/layout/default.rs GitHub Actions / Clippy (stable)
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.