@zenfs/core 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +293 -0
- package/dist/ApiError.d.ts +86 -0
- package/dist/ApiError.js +135 -0
- package/dist/backends/AsyncMirror.d.ts +102 -0
- package/dist/backends/AsyncMirror.js +252 -0
- package/dist/backends/AsyncStore.d.ts +166 -0
- package/dist/backends/AsyncStore.js +620 -0
- package/dist/backends/FolderAdapter.d.ts +52 -0
- package/dist/backends/FolderAdapter.js +184 -0
- package/dist/backends/InMemory.d.ts +25 -0
- package/dist/backends/InMemory.js +46 -0
- package/dist/backends/Locked.d.ts +64 -0
- package/dist/backends/Locked.js +302 -0
- package/dist/backends/OverlayFS.d.ts +120 -0
- package/dist/backends/OverlayFS.js +749 -0
- package/dist/backends/SyncStore.d.ts +223 -0
- package/dist/backends/SyncStore.js +479 -0
- package/dist/backends/backend.d.ts +73 -0
- package/dist/backends/backend.js +14 -0
- package/dist/backends/index.d.ts +11 -0
- package/dist/backends/index.js +15 -0
- package/dist/browser.min.js +12 -0
- package/dist/browser.min.js.map +7 -0
- package/dist/cred.d.ts +14 -0
- package/dist/cred.js +15 -0
- package/dist/emulation/callbacks.d.ts +382 -0
- package/dist/emulation/callbacks.js +422 -0
- package/dist/emulation/constants.d.ts +101 -0
- package/dist/emulation/constants.js +110 -0
- package/dist/emulation/fs.d.ts +7 -0
- package/dist/emulation/fs.js +5 -0
- package/dist/emulation/index.d.ts +5 -0
- package/dist/emulation/index.js +7 -0
- package/dist/emulation/promises.d.ts +309 -0
- package/dist/emulation/promises.js +521 -0
- package/dist/emulation/shared.d.ts +62 -0
- package/dist/emulation/shared.js +192 -0
- package/dist/emulation/sync.d.ts +278 -0
- package/dist/emulation/sync.js +392 -0
- package/dist/file.d.ts +449 -0
- package/dist/file.js +576 -0
- package/dist/filesystem.d.ts +367 -0
- package/dist/filesystem.js +542 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +113 -0
- package/dist/inode.d.ts +51 -0
- package/dist/inode.js +112 -0
- package/dist/mutex.d.ts +12 -0
- package/dist/mutex.js +48 -0
- package/dist/stats.d.ts +98 -0
- package/dist/stats.js +226 -0
- package/dist/utils.d.ts +52 -0
- package/dist/utils.js +261 -0
- package/license.md +122 -0
- package/package.json +61 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { type FileSystem, BaseFileSystem, FileSystemMetadata } from '../filesystem';
|
|
2
|
+
import { File, FileFlag, PreloadFile } from '../file';
|
|
3
|
+
import { Stats } from '../stats';
|
|
4
|
+
import LockedFS from './Locked';
|
|
5
|
+
import { Cred } from '../cred';
|
|
6
|
+
import { type BackendOptions } from './backend';
|
|
7
|
+
export declare namespace OverlayFS {
|
|
8
|
+
/**
|
|
9
|
+
* Configuration options for OverlayFS instances.
|
|
10
|
+
*/
|
|
11
|
+
interface Options {
|
|
12
|
+
/**
|
|
13
|
+
* The file system to write modified files to.
|
|
14
|
+
*/
|
|
15
|
+
writable: FileSystem;
|
|
16
|
+
/**
|
|
17
|
+
* The file system that initially populates this file system.
|
|
18
|
+
*/
|
|
19
|
+
readable: FileSystem;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* *INTERNAL, DO NOT USE DIRECTLY!*
|
|
24
|
+
*
|
|
25
|
+
* Core OverlayFS class that contains no locking whatsoever. We wrap these objects
|
|
26
|
+
* in a LockedFS to prevent races.
|
|
27
|
+
*/
|
|
28
|
+
export declare class UnlockedOverlayFS extends BaseFileSystem {
|
|
29
|
+
static isAvailable(): boolean;
|
|
30
|
+
private _writable;
|
|
31
|
+
private _readable;
|
|
32
|
+
private _isInitialized;
|
|
33
|
+
private _deletedFiles;
|
|
34
|
+
private _deleteLog;
|
|
35
|
+
private _deleteLogUpdatePending;
|
|
36
|
+
private _deleteLogUpdateNeeded;
|
|
37
|
+
private _deleteLogError;
|
|
38
|
+
constructor({ writable, readable }: OverlayFS.Options);
|
|
39
|
+
get metadata(): FileSystemMetadata;
|
|
40
|
+
getOverlayedFileSystems(): {
|
|
41
|
+
readable: FileSystem;
|
|
42
|
+
writable: FileSystem;
|
|
43
|
+
};
|
|
44
|
+
_syncAsync(file: PreloadFile<UnlockedOverlayFS>): Promise<void>;
|
|
45
|
+
_syncSync(file: PreloadFile<UnlockedOverlayFS>): void;
|
|
46
|
+
/**
|
|
47
|
+
* **INTERNAL METHOD**
|
|
48
|
+
*
|
|
49
|
+
* Called once to load up metadata stored on the writable file system.
|
|
50
|
+
*/
|
|
51
|
+
_initialize(): Promise<void>;
|
|
52
|
+
getDeletionLog(): string;
|
|
53
|
+
restoreDeletionLog(log: string, cred: Cred): void;
|
|
54
|
+
rename(oldPath: string, newPath: string, cred: Cred): Promise<void>;
|
|
55
|
+
renameSync(oldPath: string, newPath: string, cred: Cred): void;
|
|
56
|
+
stat(p: string, cred: Cred): Promise<Stats>;
|
|
57
|
+
statSync(p: string, cred: Cred): Stats;
|
|
58
|
+
open(p: string, flag: FileFlag, mode: number, cred: Cred): Promise<File>;
|
|
59
|
+
openSync(p: string, flag: FileFlag, mode: number, cred: Cred): File;
|
|
60
|
+
unlink(p: string, cred: Cred): Promise<void>;
|
|
61
|
+
unlinkSync(p: string, cred: Cred): void;
|
|
62
|
+
rmdir(p: string, cred: Cred): Promise<void>;
|
|
63
|
+
rmdirSync(p: string, cred: Cred): void;
|
|
64
|
+
mkdir(p: string, mode: number, cred: Cred): Promise<void>;
|
|
65
|
+
mkdirSync(p: string, mode: number, cred: Cred): void;
|
|
66
|
+
readdir(p: string, cred: Cred): Promise<string[]>;
|
|
67
|
+
readdirSync(p: string, cred: Cred): string[];
|
|
68
|
+
exists(p: string, cred: Cred): Promise<boolean>;
|
|
69
|
+
existsSync(p: string, cred: Cred): boolean;
|
|
70
|
+
chmod(p: string, mode: number, cred: Cred): Promise<void>;
|
|
71
|
+
chmodSync(p: string, mode: number, cred: Cred): void;
|
|
72
|
+
chown(p: string, new_uid: number, new_gid: number, cred: Cred): Promise<void>;
|
|
73
|
+
chownSync(p: string, new_uid: number, new_gid: number, cred: Cred): void;
|
|
74
|
+
utimes(p: string, atime: Date, mtime: Date, cred: Cred): Promise<void>;
|
|
75
|
+
utimesSync(p: string, atime: Date, mtime: Date, cred: Cred): void;
|
|
76
|
+
private deletePath;
|
|
77
|
+
private updateLog;
|
|
78
|
+
private _reparseDeletionLog;
|
|
79
|
+
private checkInitialized;
|
|
80
|
+
private checkPath;
|
|
81
|
+
/**
|
|
82
|
+
* With the given path, create the needed parent directories on the writable storage
|
|
83
|
+
* should they not exist. Use modes from the read-only storage.
|
|
84
|
+
*/
|
|
85
|
+
private createParentDirectories;
|
|
86
|
+
private createParentDirectoriesAsync;
|
|
87
|
+
/**
|
|
88
|
+
* Helper function:
|
|
89
|
+
* - Ensures p is on writable before proceeding. Throws an error if it doesn't exist.
|
|
90
|
+
* - Calls f to perform operation on writable.
|
|
91
|
+
*/
|
|
92
|
+
private operateOnWritable;
|
|
93
|
+
private operateOnWritableAsync;
|
|
94
|
+
/**
|
|
95
|
+
* Copy from readable to writable storage.
|
|
96
|
+
* PRECONDITION: File does not exist on writable storage.
|
|
97
|
+
*/
|
|
98
|
+
private copyToWritable;
|
|
99
|
+
private copyToWritableAsync;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* OverlayFS makes a read-only filesystem writable by storing writes on a second,
|
|
103
|
+
* writable file system. Deletes are persisted via metadata stored on the writable
|
|
104
|
+
* file system.
|
|
105
|
+
*/
|
|
106
|
+
export declare class OverlayFS extends LockedFS<UnlockedOverlayFS> {
|
|
107
|
+
static readonly Name = "OverlayFS";
|
|
108
|
+
static Create: any;
|
|
109
|
+
static readonly Options: BackendOptions;
|
|
110
|
+
static isAvailable(): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* @param options The options to initialize the OverlayFS with
|
|
113
|
+
*/
|
|
114
|
+
constructor(options: OverlayFS.Options);
|
|
115
|
+
getOverlayedFileSystems(): OverlayFS.Options;
|
|
116
|
+
getDeletionLog(): string;
|
|
117
|
+
resDeletionLog(): string;
|
|
118
|
+
unwrap(): UnlockedOverlayFS;
|
|
119
|
+
private _initialize;
|
|
120
|
+
}
|