blob: d8e584c01136ab2b88d70d9b01d936f8929381be [file] [edit]
// Copyright 2021 The Emscripten Authors. All rights reserved.
// Emscripten is available under two separate licenses, the MIT license and the
// University of Illinois/NCSA Open Source License. Both these licenses can be
// found in the LICENSE file.
// This file defines the modular backend abstract class.
#pragma once
#include "file.h"
namespace wasmfs {
// A backend (or modular backend) provides a base to extend WasmFS with new
// storage capabilities. Files and directories will be represented in the file
// system structure, but their underlying backing could exist in persistent
// storage, another thread, etc.
class Backend {
public:
virtual std::shared_ptr<DataFile> createFile(mode_t mode) = 0;
virtual std::shared_ptr<Directory> createDirectory(mode_t mode) = 0;
virtual std::shared_ptr<Symlink> createSymlink(std::string target) = 0;
virtual ~Backend() = default;
};
typedef backend_t (*backend_constructor_t)(void*);
} // namespace wasmfs