pub struct TensogramFile { /* private fields */ }Expand description
A handle for reading/writing Tensogram message files.
Supports local files, memory-mapped files (mmap feature), and
remote object stores (remote feature) via a unified API.
Implementations§
Source§impl TensogramFile
impl TensogramFile
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Sourcepub fn open_source(source: impl AsRef<str>) -> Result<Self>
pub fn open_source(source: impl AsRef<str>) -> Result<Self>
Open a local file or remote URL.
Auto-detects remote URLs (s3://, s3a://, gs://, az://, azure://, http://, https://)
when the remote feature is enabled; otherwise treats the source
as a local path.
Sourcepub fn open_remote(
source: &str,
storage_options: &BTreeMap<String, String>,
) -> Result<Self>
pub fn open_remote( source: &str, storage_options: &BTreeMap<String, String>, ) -> Result<Self>
Open a remote file with explicit storage options (credentials, region, etc.).
Sourcepub fn create(path: impl AsRef<Path>) -> Result<Self>
pub fn create(path: impl AsRef<Path>) -> Result<Self>
Create a new local file for writing (truncates if exists).
Sourcepub fn open_mmap(path: impl AsRef<Path>) -> Result<Self>
pub fn open_mmap(path: impl AsRef<Path>) -> Result<Self>
Open a file with memory-mapped I/O for zero-copy reads.
The file is mapped into memory and scan() runs directly on the
mapped buffer. read_message() returns a copy from the mapped region.
pub fn message_count(&self) -> Result<usize>
pub fn append( &mut self, global_metadata: &GlobalMetadata, descriptors: &[(&DataObjectDescriptor, &[u8])], options: &EncodeOptions, ) -> Result<()>
pub fn read_message(&self, index: usize) -> Result<Vec<u8>>
pub fn messages(&self) -> Result<Vec<Vec<u8>>>
👎Deprecated:
Use message_count() + read_message(index) for lazy access
pub fn decode_message( &self, index: usize, options: &DecodeOptions, ) -> Result<(GlobalMetadata, Vec<DecodedObject>)>
pub fn iter(&self) -> Result<FileMessageIter>
pub fn path(&self) -> Option<&Path>
pub fn source(&self) -> String
pub fn invalidate_offsets(&mut self)
pub fn decode_metadata(&self, msg_idx: usize) -> Result<GlobalMetadata>
pub fn decode_descriptors( &self, msg_idx: usize, ) -> Result<(GlobalMetadata, Vec<DataObjectDescriptor>)>
pub fn decode_object( &self, msg_idx: usize, obj_idx: usize, options: &DecodeOptions, ) -> Result<(GlobalMetadata, DataObjectDescriptor, Vec<u8>)>
pub fn decode_range_batch( &self, msg_indices: &[usize], obj_idx: usize, ranges: &[(u64, u64)], options: &DecodeOptions, ) -> Result<Vec<(DataObjectDescriptor, Vec<Vec<u8>>)>>
pub fn decode_object_batch( &self, msg_indices: &[usize], obj_idx: usize, options: &DecodeOptions, ) -> Result<Vec<(GlobalMetadata, DataObjectDescriptor, Vec<u8>)>>
pub fn decode_range( &self, msg_idx: usize, obj_idx: usize, ranges: &[(u64, u64)], options: &DecodeOptions, ) -> Result<(DataObjectDescriptor, Vec<Vec<u8>>)>
pub fn is_remote(&self) -> bool
pub async fn open_async(path: impl AsRef<Path>) -> Result<Self>
pub async fn message_count_async(&self) -> Result<usize>
pub async fn read_message_async(&self, index: usize) -> Result<Vec<u8>>
pub async fn decode_message_async( &self, index: usize, options: &DecodeOptions, ) -> Result<(GlobalMetadata, Vec<DecodedObject>)>
pub async fn open_source_async(source: impl AsRef<str>) -> Result<Self>
pub async fn open_remote_async( source: &str, storage_options: &BTreeMap<String, String>, ) -> Result<Self>
pub async fn decode_metadata_async( &self, msg_idx: usize, ) -> Result<GlobalMetadata>
pub async fn decode_descriptors_async( &self, msg_idx: usize, ) -> Result<(GlobalMetadata, Vec<DataObjectDescriptor>)>
pub async fn decode_object_async( &self, msg_idx: usize, obj_idx: usize, options: &DecodeOptions, ) -> Result<(GlobalMetadata, DataObjectDescriptor, Vec<u8>)>
pub async fn decode_range_async( &self, msg_idx: usize, obj_idx: usize, ranges: &[(u64, u64)], options: &DecodeOptions, ) -> Result<(DataObjectDescriptor, Vec<Vec<u8>>)>
pub async fn prefetch_layouts_async(&self, msg_indices: &[usize]) -> Result<()>
pub async fn decode_object_batch_async( &self, msg_indices: &[usize], obj_idx: usize, options: &DecodeOptions, ) -> Result<Vec<(GlobalMetadata, DataObjectDescriptor, Vec<u8>)>>
pub async fn decode_range_batch_async( &self, msg_indices: &[usize], obj_idx: usize, ranges: &[(u64, u64)], options: &DecodeOptions, ) -> Result<Vec<(DataObjectDescriptor, Vec<Vec<u8>>)>>
Auto Trait Implementations§
impl !Freeze for TensogramFile
impl !RefUnwindSafe for TensogramFile
impl Send for TensogramFile
impl Sync for TensogramFile
impl Unpin for TensogramFile
impl UnsafeUnpin for TensogramFile
impl !UnwindSafe for TensogramFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more