|
virtual int | create (const FileSpec &spec) |
|
virtual int | create (const string &newFilePath, const map< string, string > &options={})=0 |
|
virtual int | createSplitFile (const FileSpec &spec, const string &initialFilePath) |
|
virtual void | addSplitHead (MAYBE_UNUSED FileSpec &inOutSpec) |
|
virtual bool | reopenForUpdatesSupported () const =0 |
|
virtual int | reopenForUpdates ()=0 |
|
bool | isReadOnly () const override=0 |
|
virtual int | write (const void *buffer, size_t length)=0 |
|
template<typename T , std::enable_if_t< std::is_trivially_copyable< T >::value, int > = 0> |
int | write (const T &object) |
| Helper for trivially copyable objects.
|
|
virtual int | overwrite (const void *buffer, size_t length)=0 |
|
template<typename T , std::enable_if_t< std::is_trivially_copyable< T >::value, int > = 0> |
int | overwrite (const T &object) |
| Helper for trivially copyable objects.
|
|
virtual int | addChunk ()=0 |
|
virtual int | truncate ()=0 |
|
virtual bool | getCurrentChunk (string &outChunkPath, size_t &outChunkIndex) const =0 |
| Get the path of the current chunk, or an empty string if no chunk is open.
|
|
Public Member Functions inherited from vrs::FileHandler |
virtual unique_ptr< FileHandler > | makeNew () const =0 |
|
virtual const string & | getFileHandlerName () const =0 |
|
virtual const string & | getWriteFileHandlerName () const |
|
virtual int | open (const string &filePath) |
|
virtual int | openSpec (const FileSpec &fileSpec)=0 |
|
int | delegateOpen (const FileSpec &fileSpec, unique_ptr< FileHandler > &outNewDelegate) override |
|
virtual bool | isOpened () const =0 |
|
virtual int64_t | getTotalSize () const =0 |
|
virtual int | close ()=0 |
|
virtual int | skipForward (int64_t offset)=0 |
|
virtual int | setPos (int64_t offset)=0 |
|
virtual bool | isAvailableOrPrefetch (MAYBE_UNUSED size_t length) |
|
virtual int | read (void *buffer, size_t length)=0 |
|
template<typename T , std::enable_if_t< std::is_trivially_copyable< T >::value, int > = 0> |
int | read (T &object) |
| Helper to read trivially copyable objects, in a chunk aware way.
|
|
virtual size_t | getLastRWSize () const =0 |
|
virtual vector< std::pair< string, int64_t > > | getFileChunks () const =0 |
|
virtual void | forgetFurtherChunks (int64_t maxSize)=0 |
| Call this method to forget any chunk beyond this file size.
|
|
virtual int | getLastError () const =0 |
|
virtual bool | isEof () const =0 |
|
virtual int64_t | getPos () const =0 |
|
virtual int64_t | getChunkPos () const =0 |
|
virtual int | getChunkRange (int64_t &outChunkOffset, int64_t &outChunkSize) const =0 |
|
virtual bool | setCachingStrategy (CachingStrategy) |
|
virtual CachingStrategy | getCachingStrategy () const |
|
virtual bool | prefetchReadSequence (MAYBE_UNUSED const vector< std::pair< size_t, size_t > > &sequence, MAYBE_UNUSED bool clearSequence=true) |
|
virtual bool | setStatsCallback (const CacheStatsCallbackFunction &) |
|
virtual bool | purgeCache () |
|
bool | isFileHandlerMatch (const FileSpec &fileSpec) const |
|
virtual bool | isRemoteFileSystem () const =0 |
|
virtual bool | showProgress () const |
| Tell if the file handler is probably slow, and extra progress information might be useful.
|
|
virtual int | parseUri (FileSpec &inOutFileSpec, MAYBE_UNUSED size_t colonIndex) const |
|
The WriteFileHandler interface adds write operations to the FileHandler interface.
There are two classes of WriteFileHandler implementations:
- the ones that can edit data already written, whether editing a previously created file, or while creating a new one, as typically possible with local files,
- the immutable kind, which don't allow for overwriting parts of the file already written. They can append content, maybe concatenate chunks, but not modify previously written content. That's a typical restriction for cloud storage systems.
VRS' DiskFile offers the most comprehensive implementation, because it is designed to fit all the needs of advanced VRS file creations, with chunking, but it can be used with non-VRS files.
On the other hand, network WriteFileHandler implementations often have very specific behaviors designed to accommodate the specificities of the network storage they implement. These implementation details should ideally be abstracted, but in order to optimize cloud VRS file creation, the abstraction is compromised, and cloud WriteFileHandler implementations are not easily reusable for other applications that VRS.