AbstractFilesystem

Functions

AbstractFilesystem

~AbstractFilesystem

std::unique_ptr< AbstractFile >

NewFile

std::unique_ptr< AbstractFile >

NewFile

path

Cleaned

bool

Exists

bool

IsDirectory

bool

IsRegularFile

bool

IsSymlink

bool

IsEmpty

void

GetChildren

uintmax_t

RemoveAll

bool

Remove

bool

Rename

bool

CreateDir

bool

CreateDirs

Detailed Description

class AbstractFilesystem

The AbstractFilesystem class to represent any kind of file system. The SC Store will use it to interact with the storage and create AbstractFile objects. This class must be implemented to customize storage management. Read methods are widely used by the SC Store. Write methods are mostly used during authoring or to handle scz compressed files during streaming.

Public Functions

AbstractFilesystem() = default
virtual ~AbstractFilesystem() = default
virtual std::unique_ptr<AbstractFile> NewFile() = 0

Create a new AbstractFile object. Allow to create your own AbstractFile with extra parameters if needed.

virtual std::unique_ptr<AbstractFile> NewFile(path const &path) = 0
virtual path Cleaned(path const &path) const = 0

Return a new cleaned path. For example, without “..”. It’s used by the SC Store to clean any path given as an input. For example: model names, workspace path, model search directories.

virtual bool Exists(path const &path) const = 0

Return true if the given path exist in the storage. The path can be a directory or a file.

virtual bool IsDirectory(path const &path) const = 0

Return true if the given path is a directory in the storage

virtual bool IsRegularFile(path const &path) const = 0

Return true if the given path is a regular file (eg: which contains readable data) in the storage

virtual bool IsSymlink(path const &path) const = 0

Return true if the given path is a symlink in the storage

virtual bool IsEmpty(path const &path) const = 0

Return true if the directory at the given path is empty.

virtual void GetChildren(path const &path, std::vector<IO::path> &out_children) const = 0

Populate out_children with the list of children of the directory at the given path.

virtual uintmax_t RemoveAll(path const &path) = 0

Remove everything at the given path. Same as std::filesystem::remove_all.

virtual bool Remove(path const &path) = 0

Remove the given path. Same as std::filesystem::remove.

virtual bool Rename(path const &old_path, path const &new_path) = 0

Rename the target. Same as std::filesystem::rename.

virtual bool CreateDir(path const &path) = 0

Create new directory or directories. Same as std::filesystem::create_directory and std::filesystem::create_directories.

virtual bool CreateDirs(path const &path) = 0