Skip to main content

ViewReader

Struct ViewReader 

Source
pub struct ViewReader { /* private fields */ }
Expand description

视图读取器:打开已经构建好的 Store-P 视图,按物理槽位读取记录。 这是面向产品面/PyO3 的读取 API(build_view 负责写;本类型负责读)。

Implementations§

Source§

impl ViewReader

Source

pub fn open(view_file: &Path) -> Result<Self>

打开视图文件;优先从 .manifest.json 读取槽宽与记录数,缺失时按文件大小推断。

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn slot_bytes(&self) -> u64

Source

pub fn read_record(&self, index: usize, buf: &mut [u8]) -> Result<usize>

读取一个 gram 的完整 e_t 记录到 buf。返回实际读到的槽宽(通常 2560B)。

Source

pub fn read_records(&self, indices: &[usize], out: &mut [u8]) -> Result<()>

按物理槽位读取多条记录;out 长度必须 >= indices.len() * slot_bytes。

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.