Assumes self.max_volume_size is set.
If using compression through a _Stream, use _size_left_stream instead
"""
- # left-over size = max_size - offset - 2 zero-blocks written in close
+ # left-over size = max_size - offset - 2 blocks (either 2 zero-blocks
+ # written in close or 1 tarinfo-block + first data block of next file)
size_left = self.max_volume_size - 2*BLOCKSIZE - self.offset
# limit size left to a discrete number of blocks, because we won't
# write only half a block when writting the end of a volume
Assumes self.max_volume_size is set and self.fileobj is a _Stream
(otherwise use _size_left_file)
"""
- # left-over size = max_size - bytes written - 2 zero-blocks (close)
+ # left-over size = max_size - offset - 2 blocks (either 2 zero-blocks
+ # written in close or 1 tarinfo-block + first data block of next file)
size_left = self.max_volume_size - self.fileobj.estim_file_size() \
- 2*BLOCKSIZE
return BLOCKSIZE * (size_left // BLOCKSIZE)