BlobReader¶
- class dsviper.BlobReader¶
Bases:
objectThe handle on a blob being read from a database, in pieces.
It reports where the read stands - offset, remaining, is_closed - and moves it with seek. It reads nothing itself: blob_reader_open, blob_reader_read and blob_reader_close, on a CommitDatabase or a Database, do the reading.
An open reader holds a read lock on the database file: another connection cannot commit until blob_reader_close, or until the last reference to the reader goes.
Note: Not directly instantiable.
- blob_id() ValueBlobId¶
Return the ValueBlobId of the blob being read.
- is_closed() bool¶
Return True if the reader is closed.
- offset() int¶
Return the offset the next read starts at.
- remaining() int¶
Return the bytes count left to read.
- seek(offset: int) None¶
Move the next read to offset, forward or back.
offset may be the size of the blob, where a read answers nothing. Raises past it, or once the reader is closed.
- size() int¶
Return the size of the blob in bytes.