Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/system/lib/wasmfs/backend.h
6174 views
1
// Copyright 2021 The Emscripten Authors. All rights reserved.
2
// Emscripten is available under two separate licenses, the MIT license and the
3
// University of Illinois/NCSA Open Source License. Both these licenses can be
4
// found in the LICENSE file.
5
6
// This file defines the modular backend abstract class.
7
8
#pragma once
9
10
#include "file.h"
11
12
namespace wasmfs {
13
// A backend (or modular backend) provides a base to extend WasmFS with new
14
// storage capabilities. Files and directories will be represented in the file
15
// system structure, but their underlying backing could exist in persistent
16
// storage, another thread, etc.
17
class Backend {
18
19
public:
20
virtual std::shared_ptr<DataFile> createFile(mode_t mode) = 0;
21
virtual std::shared_ptr<Directory> createDirectory(mode_t mode) = 0;
22
virtual std::shared_ptr<Symlink> createSymlink(std::string target) = 0;
23
24
virtual ~Backend() = default;
25
};
26
27
typedef backend_t (*backend_constructor_t)(void*);
28
} // namespace wasmfs
29
30