Skip to content

Engine → Core → memory_file_system.h

vfs::memory_file_system

Syntax

class CONJURE_API memory_file_system final : public file_system

Inheritance Hierarchy

vfs::file_system → vfs::memory_file_system

Constructors

AccessSignatureDescription
publicmemory_file_system();

Destructors

AccessSignatureDescription
public~memory_file_system() override;

Variables

AccessNameTypeDefaultDescription
privatemMutexmutable std::mutex{}
privatemReadOnlystd::atomic<bool>false
privatemRootstd::unique_ptr<node>{}
privatemWriteCounteru640

Functions

Public

create_directories

[[nodiscard]] result<void> create_directories(
    std::string_view path) override;

enumerate

[[nodiscard]] result<void> enumerate(
    std::string_view directory,
    enumerate_flags flags,
    const enumerate_callback &callback) override;

is_read_only

[[nodiscard]] bool is_read_only() const noexcept override;

open_read

[[nodiscard]] result<std::unique_ptr<file>> open_read(
    std::string_view path) override;

read_file

[[nodiscard]] result<std::vector<std::byte>> read_file(
    std::string_view path) override;

remove

[[nodiscard]] result<void> remove(
    std::string_view path) override;

remove_all

[[nodiscard]] result<void> remove_all(
    std::string_view path) override;

rename

[[nodiscard]] result<void> rename(
    std::string_view from,
    std::string_view to) override;

set_read_only

void set_read_only(
    bool readOnly) noexcept;

Freezes (or thaws) the tree: while read-only, every mutating call fails with PERMISSION_DENIED. Typically used after populating a fixture.

stat

[[nodiscard]] result<file_stat> stat(
    std::string_view path) override;

write_counter

[[nodiscard]] u64 write_counter() const;

Number of mutations performed so far; equals the write time of the newest entry.

write_file

[[nodiscard]] result<void> write_file(
    std::string_view path,
    std::span<const std::byte> data) override;

write_file_atomic

[[nodiscard]] result<void> write_file_atomic(
    std::string_view path,
    std::span<const std::byte> data) override;

Private

check_writable

[[nodiscard]] result<void> check_writable() const;

ensure_directory_locked

[[nodiscard]] result<node *> ensure_directory_locked(
    std::string_view normalizedPath);

remove_locked

[[nodiscard]] result<void> remove_locked(
    std::string_view path,
    bool recursive);