This is an abstract class.

#include <file_system.h>

A generic interface for accessing a file system.


Implementations of custom filesystem adapters must implement this interface, RandomAccessFile, WritableFile, and ReadOnlyMemoryRegion classes.

Constructors and Destructors


Public functions

CreateDir(const string & dirname)=0
virtual Status
Creates the specified directory.
DeleteDir(const string & dirname)=0
virtual Status
Deletes the specified directory.
DeleteFile(const string & fname)=0
virtual Status
Deletes the named file.
DeleteRecursively(const string & dirname, int64 *undeleted_files, int64 *undeleted_dirs)
virtual Status
Deletes the specified directory and all subdirectories and files underneath it.
FileExists(const string & fname)=0
virtual Status
Returns OK if the named path exists and NOT_FOUND otherwise.
FilesExist(const std::vector< string > & files, std::vector< Status > *status)
virtual bool
Returns true if all the listed files exist, false otherwise.
GetChildren(const string & dir, std::vector< string > *result)=0
virtual Status
Returns the immediate children in the given directory.
GetFileSize(const string & fname, uint64 *file_size)=0
virtual Status
Stores the size of fname in *file_size.
GetMatchingPaths(const string & pattern, std::vector< string > *results)
virtual Status
Given a pattern, stores in *results the set of paths that matches that pattern.
IsDirectory(const string & fname)
virtual Status
Returns whether the given path is a directory or not.
NewAppendableFile(const string & fname, std::unique_ptr< WritableFile > *result)=0
virtual Status
Creates an object that either appends to an existing file, or writes to a new file (if the file does not exist to begin with).
NewRandomAccessFile(const string & fname, std::unique_ptr< RandomAccessFile > *result)=0
virtual Status
Creates a brand new random access read-only file with the specified name.
NewReadOnlyMemoryRegionFromFile(const string & fname, std::unique_ptr< ReadOnlyMemoryRegion > *result)=0
virtual Status
Creates a readonly region of memory with the file context.
NewWritableFile(const string & fname, std::unique_ptr< WritableFile > *result)=0