BarecatReadWriteFileObject#
- class barecat.io.fileobj.BarecatReadWriteFileObject(shard_file, offset, size, on_close_callback, mode='r+b')[source]#
Bases:
BarecatFileObjectFile-like object for writing to a barecat file with spillover support.
Writes within original bounds go directly to shard
Writes beyond original bounds go to spillover (temp file)
- Parameters:
shard_file (FileIO) – file-like object representing the shard where the file lives
offset (int) – offset of the file within the shard
size (int) – original size of the file
on_close_callback (Callable[[BarecatReadWriteFileObject], None]) – callback function to be called on close, arg has to be self
mode (str) – file mode string
Instance Methods#
|
Return current stream position. |
|
Change stream position. |
|
Truncate file to size bytes. |
|
Return whether object was opened for reading. |
|
Return whether object was opened for writing. |
|
Return whether object supports random access. |
|
Flush write buffers, if applicable. |
|
Flush and close the IO object. |