Documentation ¶
Overview ¶
rat is an extension to the classical tar archive, focused on allowing constant-time random file access with linear memory consumption increase. tape archive, was originally developed to write and read streamed sources, making random access to the content very inefficient.
Based on the benchmarks, we found that rat is 4x to 60x times faster over SSD and HDD than the classic tar file, when reading a single file from a tar archive.
Note: Any tar file produced by rat is compatible with standard tar implementation.
Index ¶
Constants ¶
const IndexVersion int64 = 1
Variables ¶
var ( IndexSignature = []byte{'R', 'A', 'T'} UnsuportedIndex = errors.New("Unsuported tar file") UnableToSerializeIndexEntry = errors.New("Unable to serialize: invalid content") )
var ( FileNotFound = errors.New("File not found") NotRegFile = errors.New("This is not a regular file") )
Functions ¶
func AddIndexToTar ¶ added in v1.1.0
AddIndexToTar reads from input a standard tar file and writes on output a new tar file with the rat signature on it.
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
A Reader provides random access to the contents of a rat archive. You can use archive/tar.Reader with any rat file for sequencial access.
func NewReader ¶
func NewReader(r io.ReadSeeker) (*Reader, error)
NewReader creates a new Reader reading from r.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
A Writer provides sequential writing of a rat archive. Writer has exactly the same interfaces as http://golang.org/pkg/archive/tar/#Writer does
func (*Writer) Close ¶
Close closes the tar archive, flushing any unwritten data to the underlying writer and writes the rat signature at the end of the writer.