|
Lance C/C++ Bindings
C ABI and header-only C++ RAII wrappers for the Lance columnar data format
|
#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. | |
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.
|
explicit |
Adopt a handle from the C API; closed on destruction.
| void lance::BlobFile::close | ( | ) |
Mark the native blob file closed. Idempotent. The allocation remains owned until destruction.
| bool lance::BlobFile::closed | ( | ) | const |
Native closed state.
| std::vector< uint8_t > lance::BlobFile::read | ( | ) |
Read from the cursor to the end (the whole blob when the cursor is 0).
| 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.
| 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.
| 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.
| 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.
| void lance::BlobFile::seek | ( | uint64_t | pos | ) |
Move the cursor. Seeking past the end is allowed; reads then return no bytes.
| void lance::BlobFile::set_buffer_size | ( | size_t | buffer_size | ) |
Set the native sequential read-ahead size. Zero disables read-ahead.
| uint64_t lance::BlobFile::size | ( | ) | const |
Size of the blob in bytes. Independent of the cursor.
| uint64_t lance::BlobFile::tell | ( | ) | const |
Current cursor position, in bytes from the start of the blob.