Lance C/C++ Bindings
C ABI and header-only C++ RAII wrappers for the Lance columnar data format
Loading...
Searching...
No Matches
lance::BlobFile Class Reference

#include <lance/detail/declarations.hpp>

Public Member Functions

 BlobFile (LanceBlobFile *blob)
 Adopt a handle from the C API; closed on destruction.
 
uint64_t size () const
 Size of the blob in bytes. Independent of the cursor.
 
std::vector< uint8_t > read ()
 Read from the cursor to the end (the whole blob when the cursor is 0).
 
std::vector< uint8_t > read_up_to (size_t len)
 
size_t read_into (uint8_t *dst, size_t len)
 
std::vector< uint8_t > read_range (uint64_t offset, size_t len) const
 
std::vector< std::vector< uint8_t > > read_ranges (const std::vector< BlobRange > &ranges) const
 
void set_buffer_size (size_t buffer_size)
 Set the native sequential read-ahead size. Zero disables read-ahead.
 
void seek (uint64_t pos)
 
uint64_t tell () const
 Current cursor position, in bytes from the start of the blob.
 
void close ()
 
bool closed () const
 Native closed state.
 

Detailed Description

RAII handle over one value of a Blob v2 column, from Dataset::take_blobs(), take_blobs_by_indices() or take_blobs_by_addresses(). Stays usable after the Dataset is destroyed. read(), read_up_to() and read_into() advance the cursor, while read_range() and read_ranges() do not. close() marks the native file closed; the destructor frees the handle. Not thread-safe per handle.

Definition at line 2497 of file declarations.hpp.

Constructor & Destructor Documentation

◆ BlobFile()

lance::BlobFile::BlobFile ( LanceBlobFile * blob)
explicit

Adopt a handle from the C API; closed on destruction.

Member Function Documentation

◆ close()

void lance::BlobFile::close ( )

Mark the native blob file closed. Idempotent. The allocation remains owned until destruction.

◆ closed()

bool lance::BlobFile::closed ( ) const

Native closed state.

◆ read()

std::vector< uint8_t > lance::BlobFile::read ( )

Read from the cursor to the end (the whole blob when the cursor is 0).

◆ read_into()

size_t lance::BlobFile::read_into ( uint8_t * dst,
size_t len )

Read at most len bytes from the current cursor into caller storage. Returns the number of bytes written, which is shorter than len at the end of the blob. Reuses the C read_up_to operation.

◆ read_range()

std::vector< uint8_t > lance::BlobFile::read_range ( uint64_t offset,
size_t len ) const

Read exactly len bytes at offset without moving the cursor. The range must lie within the blob.

◆ read_ranges()

std::vector< std::vector< uint8_t > > lance::BlobFile::read_ranges ( const std::vector< BlobRange > & ranges) const

Read multiple ranges without moving the cursor. The result for ranges[i] contains exactly ranges[i].length bytes; order, duplicates and overlaps are preserved.

◆ read_up_to()

std::vector< uint8_t > lance::BlobFile::read_up_to ( size_t len)

Read at most len bytes from the current cursor, advancing it past them. The result is shorter than len at the end of the blob.

◆ seek()

void lance::BlobFile::seek ( uint64_t pos)

Move the cursor. Seeking past the end is allowed; reads then return no bytes.

◆ set_buffer_size()

void lance::BlobFile::set_buffer_size ( size_t buffer_size)

Set the native sequential read-ahead size. Zero disables read-ahead.

◆ size()

uint64_t lance::BlobFile::size ( ) const

Size of the blob in bytes. Independent of the cursor.

◆ tell()

uint64_t lance::BlobFile::tell ( ) const

Current cursor position, in bytes from the start of the blob.


The documentation for this class was generated from the following file: