From 0b4e10b45cae6ecbfeb7a22ed4e8d8699a11fcfa Mon Sep 17 00:00:00 2001 From: Robert Kruszewski Date: Thu, 17 Oct 2024 18:09:23 +0100 Subject: [PATCH] shuffle --- vortex-serde/src/layouts/read/footer.rs | 2 +- vortex-serde/src/layouts/read/layouts/flat.rs | 8 ++++---- vortex-serde/src/layouts/read/mod.rs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vortex-serde/src/layouts/read/footer.rs b/vortex-serde/src/layouts/read/footer.rs index 6fe0de5aab..94ef67bbe3 100644 --- a/vortex-serde/src/layouts/read/footer.rs +++ b/vortex-serde/src/layouts/read/footer.rs @@ -152,7 +152,7 @@ impl FooterReader { } let ps = root::( - &buf[magic_bytes_loc - 32..magic_bytes_loc], + &buf[magic_bytes_loc - (FILE_POSTSCRIPT_SIZE - MAGIC_BYTES.len())..magic_bytes_loc], )?; Ok(Footer { diff --git a/vortex-serde/src/layouts/read/layouts/flat.rs b/vortex-serde/src/layouts/read/layouts/flat.rs index e07be7801b..1e29a5ffd3 100644 --- a/vortex-serde/src/layouts/read/layouts/flat.rs +++ b/vortex-serde/src/layouts/read/layouts/flat.rs @@ -9,7 +9,7 @@ use vortex_flatbuffers::footer; use crate::layouts::read::cache::RelativeLayoutCache; use crate::layouts::{ - LayoutDeserializer, LayoutId, LayoutReader, LayoutSpec, Messages, ReadResult, Scan, + LayoutDeserializer, LayoutId, LayoutReader, LayoutSpec, Message, ReadResult, Scan, }; use crate::message_reader::ArrayBufferReader; use crate::stream_writer::ByteRange; @@ -92,8 +92,8 @@ impl FlatLayout { } } - fn own_message(&self) -> Messages { - vec![(self.cache.absolute_id(&[]), self.range)] + fn own_message(&self) -> Message { + (self.cache.absolute_id(&[]), self.range) } fn array_from_bytes(&self, mut buf: Bytes) -> VortexResult { @@ -128,7 +128,7 @@ impl LayoutReader for FlatLayout { self.cached_array = Some(self.array_from_bytes(buf)?); self.read_next() } else { - Ok(Some(ReadResult::ReadMore(self.own_message()))) + Ok(Some(ReadResult::ReadMore(vec![self.own_message()]))) } } } diff --git a/vortex-serde/src/layouts/read/mod.rs b/vortex-serde/src/layouts/read/mod.rs index 5261627ac8..baa58f7db9 100644 --- a/vortex-serde/src/layouts/read/mod.rs +++ b/vortex-serde/src/layouts/read/mod.rs @@ -45,11 +45,11 @@ pub struct Scan { /// Unique identifier for a message within a layout pub type LayoutPartId = u16; pub type MessageId = Vec; -pub type Messages = Vec<(MessageId, ByteRange)>; +pub type Message = (MessageId, ByteRange); #[derive(Debug)] pub enum ReadResult { - ReadMore(Messages), + ReadMore(Vec), Batch(Array), }