|
Sparse Virtual File System
0.4.1
A Sparse Virtual File System.
|
Sometimes you don't need the whole file. Sometimes you don't want the whole file. Especially if it is huge and on some remote server. But, you might know what parts of the file that you want and svfsc can help you store them locally so it looks as if you have access to the complete file but with just the pieces of interest.
svfsc is targeted at reading very large binary files such as TIFF, RP66V1, HDF5 where the structure is well known. For example you might want to parse a TIFF file for its metadata or for a particular image tile or strip which is a tiny fraction of the file itself.
svfsc implements a Sparse Virtual File, a specialised in-memory cache where a particular file might not be available but parts of it can be obtained without reading the whole file. A Sparse Virtual File (SVFS::SparseVirtualFile) is represented internally as a map of blocks of data with the key being their file offsets. Any write to an SVFS::SparseVirtualFile will coalesce these blocks where possible.
A Sparse Virtual File System (SVFS::SparseVirtualFileSystem) is an extension of this to provide a key/value store where the key is a file ID and the value a SVFS::SparseVirtualFile.
svfsc is written in C++. It is thread safe.
A SVFS::SparseVirtualFile might be used like this:
Here is a conceptual example of a SVFS::SparseVirtualFile running on a local file system containing data from a single file.
Here is a conceptual example of a SVFS::SparseVirtualFile running with a remote file system.
svfsc is written in C++ so can be used directly:
The basic operation is to check if the SVFS::SparseVirtualFile has data, if not then get it and write that data to the SVFS::SparseVirtualFile. Then read directly: