[−][src]Trait librapidarchive::tape::TapeDevice
Required methods
fn read_block(&mut self, buf: &mut Vec<u8>) -> Result<()>
Read until the end of the current tape block.
#Partial block reads
Due to the semantics of read
, this function may return a partial block
if the previous read operation failed to read a full block. Mixed code
using both read
and read_block
is guaranteed to encounter the
same data contents as code that exclusively uses read
or
read_block
. Code that exclusively uses read_block
is
guaranteed to never encounter a partial block.
fn write_filemark(&mut self, blocking: bool) -> Result<()>
Write a filemark onto the tape.
fn seek_blocks(&mut self, pos: SeekFrom) -> Result<()>
Seek by a number of blocks on the tape.
fn tell_blocks(&mut self) -> Result<u64>
Get the current block ID
fn seek_filemarks(&mut self, pos: SeekFrom) -> Result<()>
Seek by a number of filemarks on the tape.
This function operates similarly to seek
, but operates in units of
filemarks instead. A filemark is the tape marking that divides files on
a tape.
All seek operations are relative to the current partition, if the tape has partitions.
fn seek_setmarks(&mut self, pos: SeekFrom) -> Result<()>
Seek by a number of setmarks on the tape.
This function operates similarly to seek
, but operates in units of
setmarks instead. A setmark is the tape marking that divides sets of
files. Not many tape formats support setmarks, so you must first verify
(currently, through out-of-bounds means) if your tape can seek in units
of setmarks.
All seek operations are relative to the current partition, if the tape has partitions.
fn seek_partition(&mut self, id: u32) -> Result<()>
Switch to a new tape partition on the tape device.
Parameters
id
is the ID of the tape partition, numbered from 1. An ID of 0 is a
null operation.
Caveats/Preconditions
This only works if your tape format is partitionable, the drive supports working with them, and your tape has already been formatted with multiple partitions.