@effect-vfs/core 0.9.0 → 0.11.0
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/dist/BytePath.d.ts +4 -1
- package/dist/BytePath.d.ts.map +1 -1
- package/dist/BytePath.js +6 -4
- package/dist/Caller.d.ts +105 -66
- package/dist/Caller.d.ts.map +1 -1
- package/dist/Caller.js +15 -87
- package/dist/LiveVolume.d.ts +14 -8
- package/dist/LiveVolume.d.ts.map +1 -1
- package/dist/LiveVolume.js +10 -3
- package/dist/Search.d.ts +32 -8
- package/dist/Search.d.ts.map +1 -1
- package/dist/Search.js +14 -13
- package/dist/SynchronousAdapter.d.ts +58 -0
- package/dist/SynchronousAdapter.d.ts.map +1 -0
- package/dist/SynchronousAdapter.js +116 -0
- package/dist/Target.d.ts +7 -91
- package/dist/Target.d.ts.map +1 -1
- package/dist/Target.js +7 -47
- package/dist/Testing.d.ts +9 -5
- package/dist/Testing.d.ts.map +1 -1
- package/dist/Testing.js +3 -2
- package/dist/VfsError.d.ts +1 -1
- package/dist/VfsError.d.ts.map +1 -1
- package/dist/VirtualFileSystem.d.ts +143 -59
- package/dist/VirtualFileSystem.d.ts.map +1 -1
- package/dist/VirtualFileSystem.js +37 -33
- package/dist/Volume.d.ts +6 -1
- package/dist/Volume.d.ts.map +1 -1
- package/dist/Volume.js +6 -2
- package/dist/internal/adapterBinding.d.ts +13 -0
- package/dist/internal/adapterBinding.d.ts.map +1 -0
- package/dist/internal/adapterBinding.js +13 -0
- package/dist/internal/bytePath.d.ts +6 -1
- package/dist/internal/bytePath.d.ts.map +1 -1
- package/dist/internal/callerWatch.d.ts +5 -1
- package/dist/internal/callerWatch.d.ts.map +1 -1
- package/dist/internal/callerWatch.js +4 -3
- package/dist/internal/engine.d.ts +1305 -0
- package/dist/internal/engine.d.ts.map +1 -0
- package/dist/internal/engine.js +3458 -0
- package/dist/internal/errors.d.ts +1 -33
- package/dist/internal/errors.d.ts.map +1 -1
- package/dist/internal/errors.js +1 -45
- package/dist/internal/fixture.d.ts +3 -2
- package/dist/internal/fixture.d.ts.map +1 -1
- package/dist/internal/fixture.js +7 -3
- package/dist/internal/image.d.ts +4 -1
- package/dist/internal/image.d.ts.map +1 -1
- package/dist/internal/image.js +6 -3
- package/dist/internal/lines.d.ts.map +1 -1
- package/dist/internal/lines.js +3 -2
- package/dist/internal/liveImage.d.ts +4 -2
- package/dist/internal/liveImage.d.ts.map +1 -1
- package/dist/internal/liveImage.js +3 -1
- package/dist/internal/merkle.d.ts +8 -5
- package/dist/internal/merkle.d.ts.map +1 -1
- package/dist/internal/merkle.js +8 -7
- package/dist/internal/search.d.ts +3 -1
- package/dist/internal/search.d.ts.map +1 -1
- package/dist/internal/search.js +4 -3
- package/dist/internal/snapshotDelta.d.ts +14 -10
- package/dist/internal/snapshotDelta.d.ts.map +1 -1
- package/dist/internal/snapshotDelta.js +15 -9
- package/dist/internal/snapshotMerge.d.ts +1 -1
- package/dist/internal/snapshotMerge.d.ts.map +1 -1
- package/dist/internal/snapshotMerge.js +5 -2
- package/dist/internal/tree.d.ts +4 -2
- package/dist/internal/tree.d.ts.map +1 -1
- package/dist/internal/tree.js +4 -2
- package/dist/internal/virtualFileSystem.d.ts +27 -56
- package/dist/internal/virtualFileSystem.d.ts.map +1 -1
- package/dist/internal/virtualFileSystem.js +77 -2085
- package/dist/internal/volumeLimits.d.ts +1 -0
- package/dist/internal/volumeLimits.d.ts.map +1 -1
- package/dist/internal/volumeLimits.js +3 -2
- package/dist/internal/volumeState.d.ts +10 -79
- package/dist/internal/volumeState.d.ts.map +1 -1
- package/dist/internal/volumeState.js +9 -79
- package/dist/internal/watchHub.d.ts +3 -3
- package/dist/internal/watchHub.d.ts.map +1 -1
- package/dist/internal/watchHub.js +4 -2
- package/package.json +14 -9
- package/dist/internal/confinement.d.ts +0 -16
- package/dist/internal/confinement.d.ts.map +0 -1
- package/dist/internal/confinement.js +0 -79
- package/dist/internal/directoryEntries.d.ts +0 -6
- package/dist/internal/directoryEntries.d.ts.map +0 -1
- package/dist/internal/directoryEntries.js +0 -79
- package/dist/internal/inodeTable.d.ts +0 -20
- package/dist/internal/inodeTable.d.ts.map +0 -1
- package/dist/internal/inodeTable.js +0 -48
- package/dist/internal/path.d.ts +0 -56
- package/dist/internal/path.d.ts.map +0 -1
- package/dist/internal/path.js +0 -141
- package/dist/internal/resolution.d.ts +0 -139
- package/dist/internal/resolution.d.ts.map +0 -1
- package/dist/internal/resolution.js +0 -332
- package/dist/internal/testSeams.d.ts +0 -17
- package/dist/internal/testSeams.d.ts.map +0 -1
- package/dist/internal/testSeams.js +0 -20
- package/dist/internal/tokenRegistry.d.ts +0 -83
- package/dist/internal/tokenRegistry.d.ts.map +0 -1
- package/dist/internal/tokenRegistry.js +0 -146
- package/dist/internal/turnstile.d.ts +0 -8
- package/dist/internal/turnstile.d.ts.map +0 -1
- package/dist/internal/turnstile.js +0 -43
|
@@ -0,0 +1,1305 @@
|
|
|
1
|
+
import * as Brand from "effect/Brand";
|
|
2
|
+
import * as ByteSize from "effect/ByteSize";
|
|
3
|
+
import * as Cause from "effect/Cause";
|
|
4
|
+
import * as Context from "effect/Context";
|
|
5
|
+
import * as Data from "effect/Data";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
import * as HashMap from "effect/HashMap";
|
|
8
|
+
import * as Order from "effect/Order";
|
|
9
|
+
import * as Result from "effect/Result";
|
|
10
|
+
import * as Schema from "effect/Schema";
|
|
11
|
+
import * as Scope from "effect/Scope";
|
|
12
|
+
import * as Stream from "effect/Stream";
|
|
13
|
+
import { DirectoryHandleId, FileHandleId, SeekMode } from "../FileHandle.js";
|
|
14
|
+
import type { BytePath } from "./bytePath.js";
|
|
15
|
+
import { type Metadata, OwnerUpdate, Times } from "../Metadata.js";
|
|
16
|
+
import { type ArgumentFailure, type FsCode, type FsFailure, VfsError } from "../VfsError.js";
|
|
17
|
+
/** Filesystem capability contracts owned by the engine; public modules are compatibility views. @internal */
|
|
18
|
+
export type PathInput = string | BytePath;
|
|
19
|
+
/** @internal */
|
|
20
|
+
export interface EngineLimits {
|
|
21
|
+
readonly maxBytes: ByteSize.ByteSize | undefined;
|
|
22
|
+
readonly maxFileBytes: ByteSize.ByteSize;
|
|
23
|
+
readonly maxEntries: number | undefined;
|
|
24
|
+
readonly maxPathBytes: ByteSize.ByteSize | undefined;
|
|
25
|
+
/** Waiting budget; at most this many plus one callers are admitted at once. */
|
|
26
|
+
readonly maxPendingOperations: number;
|
|
27
|
+
}
|
|
28
|
+
/** @internal */
|
|
29
|
+
export interface VolumeUsage {
|
|
30
|
+
readonly usedBytes: bigint;
|
|
31
|
+
readonly entries: number;
|
|
32
|
+
}
|
|
33
|
+
/** @internal */
|
|
34
|
+
export interface ObjectReference {
|
|
35
|
+
readonly [ObjectReferenceId]: true;
|
|
36
|
+
}
|
|
37
|
+
/** @internal */
|
|
38
|
+
export interface ObjectObservation<A> {
|
|
39
|
+
readonly value: A;
|
|
40
|
+
readonly revision: bigint;
|
|
41
|
+
}
|
|
42
|
+
/** @internal */
|
|
43
|
+
export interface DirectoryEntry {
|
|
44
|
+
readonly name: Uint8Array;
|
|
45
|
+
readonly reference: ObjectReference;
|
|
46
|
+
}
|
|
47
|
+
/** @internal */
|
|
48
|
+
export interface WalkEntry {
|
|
49
|
+
readonly path: BytePath;
|
|
50
|
+
readonly name: Uint8Array;
|
|
51
|
+
readonly reference: ObjectReference;
|
|
52
|
+
readonly directory: ObjectReference;
|
|
53
|
+
readonly kind: Metadata["kind"];
|
|
54
|
+
readonly depth: number;
|
|
55
|
+
}
|
|
56
|
+
/** @internal */
|
|
57
|
+
export interface ReferenceEntryResult {
|
|
58
|
+
readonly reference: ObjectReference;
|
|
59
|
+
readonly directory: DirectoryChange;
|
|
60
|
+
}
|
|
61
|
+
/** @internal */
|
|
62
|
+
export interface DirectoryHandle {
|
|
63
|
+
readonly [DirectoryHandleId]: true;
|
|
64
|
+
readonly stat: Effect.Effect<Metadata, FsFailure>;
|
|
65
|
+
readonly close: Effect.Effect<void, FsFailure>;
|
|
66
|
+
}
|
|
67
|
+
/** @internal */
|
|
68
|
+
export interface OpenEntryResult {
|
|
69
|
+
readonly handle: FileHandle;
|
|
70
|
+
readonly reference: ObjectReference;
|
|
71
|
+
readonly created: boolean;
|
|
72
|
+
readonly directory: DirectoryChange;
|
|
73
|
+
}
|
|
74
|
+
/** @internal */
|
|
75
|
+
export interface ReadResult {
|
|
76
|
+
readonly bytes: Uint8Array;
|
|
77
|
+
readonly eof: boolean;
|
|
78
|
+
}
|
|
79
|
+
/** @internal */
|
|
80
|
+
export interface FileHandle {
|
|
81
|
+
readonly [FileHandleId]: true;
|
|
82
|
+
readonly read: (maximumBytes: number) => Effect.Effect<Uint8Array, FsFailure>;
|
|
83
|
+
readonly pread: (maximumBytes: number, offset: bigint) => Effect.Effect<ReadResult, FsFailure>;
|
|
84
|
+
readonly write: (bytes: Uint8Array) => Effect.Effect<number, FsFailure>;
|
|
85
|
+
readonly pwrite: {
|
|
86
|
+
(offset: bigint): (bytes: Uint8Array) => Effect.Effect<number, FsFailure>;
|
|
87
|
+
(bytes: Uint8Array, offset: bigint): Effect.Effect<number, FsFailure>;
|
|
88
|
+
};
|
|
89
|
+
readonly seek: {
|
|
90
|
+
(mode: SeekMode): (offset: bigint) => Effect.Effect<bigint, FsFailure>;
|
|
91
|
+
(offset: bigint, mode: SeekMode): Effect.Effect<bigint, FsFailure>;
|
|
92
|
+
};
|
|
93
|
+
readonly truncate: (length: bigint) => Effect.Effect<void, FsFailure>;
|
|
94
|
+
readonly stat: Effect.Effect<Metadata, FsFailure>;
|
|
95
|
+
readonly sync: Effect.Effect<void, FsFailure>;
|
|
96
|
+
readonly close: Effect.Effect<void, FsFailure>;
|
|
97
|
+
}
|
|
98
|
+
/** @internal */
|
|
99
|
+
export type WalkFailure = FsFailure | (VfsError & {
|
|
100
|
+
readonly code: "LimitExceeded";
|
|
101
|
+
});
|
|
102
|
+
/** Filesystem error helpers; image/codec helpers remain community-owned. @internal */
|
|
103
|
+
export declare namespace Errors {
|
|
104
|
+
/** @internal */
|
|
105
|
+
export const errorPath: (input: PathInput) => BytePath | undefined;
|
|
106
|
+
interface Details {
|
|
107
|
+
readonly path?: PathInput;
|
|
108
|
+
readonly field?: string;
|
|
109
|
+
readonly cause?: unknown;
|
|
110
|
+
}
|
|
111
|
+
/** @internal */
|
|
112
|
+
export const argumentFailure: (operation: string, field: string, cause?: unknown) => ArgumentFailure;
|
|
113
|
+
/** @internal */
|
|
114
|
+
export const decodeConfiguration: <A, I>(schema: Schema.Codec<A, I>, value: typeof Schema.Unknown.Type, operation: string) => Result.Result<A, ArgumentFailure>;
|
|
115
|
+
/** @internal */
|
|
116
|
+
export const fsFailure: (code: FsCode, operation: string, details?: Details) => FsFailure;
|
|
117
|
+
/** @internal */
|
|
118
|
+
export interface OpContext {
|
|
119
|
+
readonly operation: string;
|
|
120
|
+
readonly fail: (code: FsCode, details?: {
|
|
121
|
+
readonly cause?: unknown;
|
|
122
|
+
readonly field?: string;
|
|
123
|
+
}) => FsFailure;
|
|
124
|
+
readonly at: (path: PathInput) => OpContext;
|
|
125
|
+
}
|
|
126
|
+
/** @internal */
|
|
127
|
+
export const OpContext: {
|
|
128
|
+
make: (operation: string) => OpContext;
|
|
129
|
+
};
|
|
130
|
+
export {};
|
|
131
|
+
}
|
|
132
|
+
declare const OpContext: {
|
|
133
|
+
make: (operation: string) => Errors.OpContext;
|
|
134
|
+
};
|
|
135
|
+
type OpContext = Errors.OpContext;
|
|
136
|
+
/** Byte-name rules and filesystem lookup preparation. @internal */
|
|
137
|
+
export declare namespace Paths {
|
|
138
|
+
/** @internal */
|
|
139
|
+
const SLASH_HEX = "2f";
|
|
140
|
+
/** @internal */
|
|
141
|
+
const DOT_HEX = "2e";
|
|
142
|
+
/** @internal */
|
|
143
|
+
const DOT_DOT_HEX = "2e2e";
|
|
144
|
+
/** @internal */
|
|
145
|
+
const SLASH_BYTE = 47;
|
|
146
|
+
/** @internal */
|
|
147
|
+
const NUL_BYTE = 0;
|
|
148
|
+
/** @internal */
|
|
149
|
+
const MAX_SYMLINK_TRAVERSALS = 40;
|
|
150
|
+
/** @internal */
|
|
151
|
+
const MAX_NAME_BYTES = 255;
|
|
152
|
+
/** @internal */
|
|
153
|
+
const isNameBytes: (name: Uint8Array) => boolean;
|
|
154
|
+
/** @internal */
|
|
155
|
+
const ROOT_PATH: Uint8Array<ArrayBuffer>;
|
|
156
|
+
/** @internal */
|
|
157
|
+
const joinPath: (prefix: Uint8Array, name: Uint8Array) => Uint8Array;
|
|
158
|
+
/** @internal */
|
|
159
|
+
const isDotComponent: (name: string | undefined) => name is undefined | typeof DOT_HEX | typeof DOT_DOT_HEX;
|
|
160
|
+
/** @internal */
|
|
161
|
+
const ownedPath: (bytes: Uint8Array) => BytePath;
|
|
162
|
+
/** @internal */
|
|
163
|
+
const strictString: (bytes: Uint8Array, operation: string) => Effect.Effect<string, FsFailure, never>;
|
|
164
|
+
/** @internal */
|
|
165
|
+
const nameBytes: (name: string) => Uint8Array;
|
|
166
|
+
/** @internal */
|
|
167
|
+
const isAttachedBytes: (bytes: Uint8Array) => boolean;
|
|
168
|
+
/** @internal */
|
|
169
|
+
const pathFromBytes: (bytes: Uint8Array<ArrayBufferLike>) => Effect.Effect<BytePath, FsFailure, never>;
|
|
170
|
+
/** @internal */
|
|
171
|
+
const pathToBytes: (path: BytePath) => Effect.Effect<Uint8Array<ArrayBuffer>, FsFailure, never>;
|
|
172
|
+
/** @internal */
|
|
173
|
+
interface PreparedPath {
|
|
174
|
+
readonly input: PathInput;
|
|
175
|
+
readonly absolute: boolean;
|
|
176
|
+
readonly trailingSlash: boolean;
|
|
177
|
+
readonly bytes: Uint8Array;
|
|
178
|
+
readonly suffixes: ReadonlyArray<Uint8Array>;
|
|
179
|
+
readonly components: ReadonlyArray<string>;
|
|
180
|
+
}
|
|
181
|
+
/** @internal */
|
|
182
|
+
const isWellFormed: (value: string) => boolean;
|
|
183
|
+
/** @internal */
|
|
184
|
+
const inputBytes: (input: PathInput) => Result.Result<Uint8Array, "InvalidPathEncoding" | "InvalidArgument">;
|
|
185
|
+
/** @internal */
|
|
186
|
+
const preparePath: (input: PathInput, operation: string, maxPathBytes: ByteSize.ByteSize | undefined) => Result.Result<PreparedPath, FsFailure>;
|
|
187
|
+
}
|
|
188
|
+
type PreparedPath = Paths.PreparedPath;
|
|
189
|
+
/** @internal */
|
|
190
|
+
export interface VolumeTestSeams {
|
|
191
|
+
readonly afterSubscribe: Effect.Effect<void>;
|
|
192
|
+
readonly betweenSnapshotAndSummary: Effect.Effect<void>;
|
|
193
|
+
readonly beforeTreeRemoval: Effect.Effect<void>;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Read in the caller's fiber, so a test supplies it with `withVolumeTestSeams` on the call under test.
|
|
197
|
+
*
|
|
198
|
+
* @internal
|
|
199
|
+
*/
|
|
200
|
+
export declare const VolumeTestSeams: Context.Reference<VolumeTestSeams>;
|
|
201
|
+
/** @internal */
|
|
202
|
+
export declare const withVolumeTestSeams: (seams: Partial<VolumeTestSeams>) => <XA, E, R>(self: Effect.Effect<XA, E, R>) => Effect.Effect<XA, E, R>;
|
|
203
|
+
type CommitOutcome = "committed" | "rejected" | "unknown" | {
|
|
204
|
+
readonly _tag: "Rejected";
|
|
205
|
+
readonly cause: Cause.Cause<never>;
|
|
206
|
+
};
|
|
207
|
+
/** Private addressing; the public Target module is a compatibility view. @internal */
|
|
208
|
+
export declare namespace Address {
|
|
209
|
+
/**
|
|
210
|
+
* How a caller names what it operates on. A `Target` is a path, an object
|
|
211
|
+
* reference, or an open handle; an `Entry` is a child of a directory target
|
|
212
|
+
* called `name`. Every verb takes one or the other, so the three addressing
|
|
213
|
+
* modes share one body and one option vocabulary.
|
|
214
|
+
*
|
|
215
|
+
* @since 0.6.0
|
|
216
|
+
*/
|
|
217
|
+
/**
|
|
218
|
+
* A target: a path resolved from the caller's working directory or a base
|
|
219
|
+
* handle, an object reference, or an open handle.
|
|
220
|
+
*
|
|
221
|
+
* @category models
|
|
222
|
+
* @since 0.6.0
|
|
223
|
+
*/
|
|
224
|
+
export type Target = Data.TaggedEnum<{
|
|
225
|
+
readonly Path: {
|
|
226
|
+
readonly path: PathInput;
|
|
227
|
+
/** A live directory handle from the same volume that a relative path starts from. */
|
|
228
|
+
readonly relativeTo?: DirectoryHandle;
|
|
229
|
+
/** Whether a final symbolic link is followed. Defaults to `true`. */
|
|
230
|
+
readonly followFinalSymlink?: boolean;
|
|
231
|
+
};
|
|
232
|
+
readonly Reference: {
|
|
233
|
+
readonly reference: ObjectReference;
|
|
234
|
+
};
|
|
235
|
+
readonly Handle: {
|
|
236
|
+
readonly handle: FileHandle | DirectoryHandle;
|
|
237
|
+
};
|
|
238
|
+
}>;
|
|
239
|
+
const enumeration: Data.TaggedEnum.Constructor<{
|
|
240
|
+
readonly _tag: "Handle";
|
|
241
|
+
readonly handle: FileHandle | DirectoryHandle;
|
|
242
|
+
} | {
|
|
243
|
+
readonly _tag: "Path";
|
|
244
|
+
readonly path: PathInput;
|
|
245
|
+
readonly relativeTo?: DirectoryHandle;
|
|
246
|
+
readonly followFinalSymlink?: boolean;
|
|
247
|
+
} | {
|
|
248
|
+
readonly _tag: "Reference";
|
|
249
|
+
readonly reference: ObjectReference;
|
|
250
|
+
}>;
|
|
251
|
+
/**
|
|
252
|
+
* Whether a value is a `Target`.
|
|
253
|
+
*
|
|
254
|
+
* @category predicates
|
|
255
|
+
* @since 0.6.0
|
|
256
|
+
*/
|
|
257
|
+
export const isTarget: (value: unknown) => value is Target;
|
|
258
|
+
/**
|
|
259
|
+
* Anything a verb accepts where it takes a target: a `Target`, or the bare
|
|
260
|
+
* path, reference, or handle it would wrap.
|
|
261
|
+
*
|
|
262
|
+
* @category models
|
|
263
|
+
* @since 0.6.0
|
|
264
|
+
*/
|
|
265
|
+
export type TargetInput = Target | PathInput | ObjectReference | FileHandle | DirectoryHandle;
|
|
266
|
+
/**
|
|
267
|
+
* Constructors and matchers for `Target`, plus `of`, which wraps a bare path,
|
|
268
|
+
* reference, or handle.
|
|
269
|
+
*
|
|
270
|
+
* @category constructors
|
|
271
|
+
* @since 0.6.0
|
|
272
|
+
*/
|
|
273
|
+
export const Target: typeof enumeration & {
|
|
274
|
+
readonly of: (input: TargetInput) => Target;
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* A directory entry name as bytes or as a string encoded as UTF-8: one to 255
|
|
278
|
+
* bytes with no NUL and no slash. `.` and `..` are well formed but reserved.
|
|
279
|
+
*
|
|
280
|
+
* @category models
|
|
281
|
+
* @since 0.6.0
|
|
282
|
+
*/
|
|
283
|
+
export type NameInput = string | Uint8Array;
|
|
284
|
+
/**
|
|
285
|
+
* Schema for a well-formed entry name, as bytes.
|
|
286
|
+
*
|
|
287
|
+
* @category schemas
|
|
288
|
+
* @since 0.6.0
|
|
289
|
+
*/
|
|
290
|
+
export const Name: Schema.Uint8Array;
|
|
291
|
+
/**
|
|
292
|
+
* A well-formed entry name, as bytes.
|
|
293
|
+
*
|
|
294
|
+
* @category models
|
|
295
|
+
* @since 0.6.0
|
|
296
|
+
*/
|
|
297
|
+
export type Name = typeof Name.Type;
|
|
298
|
+
/**
|
|
299
|
+
* A child of a directory target, called `name`.
|
|
300
|
+
*
|
|
301
|
+
* @category models
|
|
302
|
+
* @since 0.6.0
|
|
303
|
+
*/
|
|
304
|
+
export interface Entry {
|
|
305
|
+
readonly directory: Target;
|
|
306
|
+
readonly name: NameInput;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Anything a verb accepts where it takes an entry: an `Entry`, or a path (bare
|
|
310
|
+
* or as a path target with a base) whose final component is the name and
|
|
311
|
+
* whose prefix is the directory.
|
|
312
|
+
*
|
|
313
|
+
* @category models
|
|
314
|
+
* @since 0.6.0
|
|
315
|
+
*/
|
|
316
|
+
export type EntryInput = Entry | PathInput | PathTarget;
|
|
317
|
+
/**
|
|
318
|
+
* The path variant of `Target`.
|
|
319
|
+
*
|
|
320
|
+
* @category models
|
|
321
|
+
* @since 0.6.0
|
|
322
|
+
*/
|
|
323
|
+
export type PathTarget = Extract<Target, {
|
|
324
|
+
readonly _tag: "Path";
|
|
325
|
+
}>;
|
|
326
|
+
/**
|
|
327
|
+
* Whether a value is an `Entry`.
|
|
328
|
+
*
|
|
329
|
+
* @category predicates
|
|
330
|
+
* @since 0.6.0
|
|
331
|
+
*/
|
|
332
|
+
export const isEntry: (value: unknown) => value is Entry;
|
|
333
|
+
/**
|
|
334
|
+
* Names a child of a directory. The directory may be given bare.
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* ```ts
|
|
338
|
+
* import { Entry, Target } from "@effect-vfs/core/Target"
|
|
339
|
+
*
|
|
340
|
+
* const explicit = Entry(Target.Path({ path: "/var" }), "log")
|
|
341
|
+
* const bare = Entry("/var", "log")
|
|
342
|
+
* ```
|
|
343
|
+
*
|
|
344
|
+
* @category constructors
|
|
345
|
+
* @since 0.6.0
|
|
346
|
+
*/
|
|
347
|
+
export const Entry: {
|
|
348
|
+
(name: NameInput): (directory: TargetInput) => Entry;
|
|
349
|
+
(directory: TargetInput, name: NameInput): Entry;
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* Whether a path input is a byte path rather than a string.
|
|
353
|
+
*
|
|
354
|
+
* @category predicates
|
|
355
|
+
* @since 0.6.0
|
|
356
|
+
*/
|
|
357
|
+
export const isBytePathInput: (input: PathInput) => boolean;
|
|
358
|
+
export {};
|
|
359
|
+
}
|
|
360
|
+
declare const Target: {
|
|
361
|
+
readonly Handle: Data.TaggedEnum.ConstructorFrom<{
|
|
362
|
+
readonly _tag: "Handle";
|
|
363
|
+
readonly handle: FileHandle | DirectoryHandle;
|
|
364
|
+
}, "_tag">;
|
|
365
|
+
readonly Path: Data.TaggedEnum.ConstructorFrom<{
|
|
366
|
+
readonly _tag: "Path";
|
|
367
|
+
readonly path: PathInput;
|
|
368
|
+
readonly relativeTo?: DirectoryHandle;
|
|
369
|
+
readonly followFinalSymlink?: boolean;
|
|
370
|
+
}, "_tag">;
|
|
371
|
+
readonly Reference: Data.TaggedEnum.ConstructorFrom<{
|
|
372
|
+
readonly _tag: "Reference";
|
|
373
|
+
readonly reference: ObjectReference;
|
|
374
|
+
}, "_tag">;
|
|
375
|
+
} & {
|
|
376
|
+
readonly $is: <Tag extends "Handle" | "Path" | "Reference">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
377
|
+
readonly _tag: "Handle";
|
|
378
|
+
readonly handle: FileHandle | DirectoryHandle;
|
|
379
|
+
}, {
|
|
380
|
+
readonly _tag: Tag;
|
|
381
|
+
}> | Extract<{
|
|
382
|
+
readonly _tag: "Path";
|
|
383
|
+
readonly path: PathInput;
|
|
384
|
+
readonly relativeTo?: DirectoryHandle;
|
|
385
|
+
readonly followFinalSymlink?: boolean;
|
|
386
|
+
}, {
|
|
387
|
+
readonly _tag: Tag;
|
|
388
|
+
}> | Extract<{
|
|
389
|
+
readonly _tag: "Reference";
|
|
390
|
+
readonly reference: ObjectReference;
|
|
391
|
+
}, {
|
|
392
|
+
readonly _tag: Tag;
|
|
393
|
+
}>;
|
|
394
|
+
readonly $match: {
|
|
395
|
+
<Cases extends { readonly [Tag in "Handle" | "Path" | "Reference"]: (args: Extract<{
|
|
396
|
+
readonly _tag: "Handle";
|
|
397
|
+
readonly handle: FileHandle | DirectoryHandle;
|
|
398
|
+
} | {
|
|
399
|
+
readonly _tag: "Path";
|
|
400
|
+
readonly path: PathInput;
|
|
401
|
+
readonly relativeTo?: DirectoryHandle;
|
|
402
|
+
readonly followFinalSymlink?: boolean;
|
|
403
|
+
} | {
|
|
404
|
+
readonly _tag: "Reference";
|
|
405
|
+
readonly reference: ObjectReference;
|
|
406
|
+
}, {
|
|
407
|
+
readonly _tag: Tag;
|
|
408
|
+
}>) => any; }>(cases: Cases): (value: {
|
|
409
|
+
readonly _tag: "Handle";
|
|
410
|
+
readonly handle: FileHandle | DirectoryHandle;
|
|
411
|
+
} | {
|
|
412
|
+
readonly _tag: "Path";
|
|
413
|
+
readonly path: PathInput;
|
|
414
|
+
readonly relativeTo?: DirectoryHandle;
|
|
415
|
+
readonly followFinalSymlink?: boolean;
|
|
416
|
+
} | {
|
|
417
|
+
readonly _tag: "Reference";
|
|
418
|
+
readonly reference: ObjectReference;
|
|
419
|
+
}) => import("effect/Unify").Unify<ReturnType<Cases["Handle" | "Path" | "Reference"]>>;
|
|
420
|
+
<Cases extends { readonly [Tag in "Handle" | "Path" | "Reference"]: (args: Extract<{
|
|
421
|
+
readonly _tag: "Handle";
|
|
422
|
+
readonly handle: FileHandle | DirectoryHandle;
|
|
423
|
+
} | {
|
|
424
|
+
readonly _tag: "Path";
|
|
425
|
+
readonly path: PathInput;
|
|
426
|
+
readonly relativeTo?: DirectoryHandle;
|
|
427
|
+
readonly followFinalSymlink?: boolean;
|
|
428
|
+
} | {
|
|
429
|
+
readonly _tag: "Reference";
|
|
430
|
+
readonly reference: ObjectReference;
|
|
431
|
+
}, {
|
|
432
|
+
readonly _tag: Tag;
|
|
433
|
+
}>) => any; }>(value: {
|
|
434
|
+
readonly _tag: "Handle";
|
|
435
|
+
readonly handle: FileHandle | DirectoryHandle;
|
|
436
|
+
} | {
|
|
437
|
+
readonly _tag: "Path";
|
|
438
|
+
readonly path: PathInput;
|
|
439
|
+
readonly relativeTo?: DirectoryHandle;
|
|
440
|
+
readonly followFinalSymlink?: boolean;
|
|
441
|
+
} | {
|
|
442
|
+
readonly _tag: "Reference";
|
|
443
|
+
readonly reference: ObjectReference;
|
|
444
|
+
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Handle" | "Path" | "Reference"]>>;
|
|
445
|
+
};
|
|
446
|
+
} & {
|
|
447
|
+
readonly of: (input: Address.TargetInput) => Address.Target;
|
|
448
|
+
};
|
|
449
|
+
type Target = Address.Target;
|
|
450
|
+
type TargetInput = Address.TargetInput;
|
|
451
|
+
type NameInput = Address.NameInput;
|
|
452
|
+
type Entry = Address.Entry;
|
|
453
|
+
type EntryInput = Address.EntryInput;
|
|
454
|
+
/**
|
|
455
|
+
* Brand key that marks an object reference.
|
|
456
|
+
*
|
|
457
|
+
* @category type IDs
|
|
458
|
+
* @since 0.6.0
|
|
459
|
+
*/
|
|
460
|
+
export declare const ObjectReferenceId: unique symbol;
|
|
461
|
+
/**
|
|
462
|
+
* Brand key that marks an object reference.
|
|
463
|
+
*
|
|
464
|
+
* @category type IDs
|
|
465
|
+
* @since 0.6.0
|
|
466
|
+
*/
|
|
467
|
+
export type ObjectReferenceId = typeof ObjectReferenceId;
|
|
468
|
+
/**
|
|
469
|
+
* Schema for a caller's credentials. `privileged` is explicit; uid zero alone
|
|
470
|
+
* grants nothing.
|
|
471
|
+
*
|
|
472
|
+
* @category schemas
|
|
473
|
+
* @since 0.6.0
|
|
474
|
+
*/
|
|
475
|
+
export declare const Identity: Schema.Struct<{
|
|
476
|
+
readonly uid: Schema.Natural;
|
|
477
|
+
readonly gid: Schema.Natural;
|
|
478
|
+
readonly groups: Schema.$Array<Schema.Natural>;
|
|
479
|
+
readonly privileged: Schema.Boolean;
|
|
480
|
+
}>;
|
|
481
|
+
/**
|
|
482
|
+
* A caller's credentials.
|
|
483
|
+
*
|
|
484
|
+
* @category models
|
|
485
|
+
* @since 0.6.0
|
|
486
|
+
*/
|
|
487
|
+
export type Identity = typeof Identity.Type;
|
|
488
|
+
/**
|
|
489
|
+
* Schema for the options of a root caller.
|
|
490
|
+
*
|
|
491
|
+
* @category schemas
|
|
492
|
+
* @since 0.6.0
|
|
493
|
+
*/
|
|
494
|
+
export declare const RootCallerOptions: Schema.Struct<{
|
|
495
|
+
readonly identity: Schema.optionalKey<Schema.Struct<{
|
|
496
|
+
readonly uid: Schema.Natural;
|
|
497
|
+
readonly gid: Schema.Natural;
|
|
498
|
+
readonly groups: Schema.$Array<Schema.Natural>;
|
|
499
|
+
readonly privileged: Schema.Boolean;
|
|
500
|
+
}>>;
|
|
501
|
+
readonly umask: Schema.optionalKey<Schema.Natural>;
|
|
502
|
+
}>;
|
|
503
|
+
/**
|
|
504
|
+
* Options of a root caller.
|
|
505
|
+
*
|
|
506
|
+
* @category models
|
|
507
|
+
* @since 0.6.0
|
|
508
|
+
*/
|
|
509
|
+
export type RootCallerOptions = typeof RootCallerOptions.Type;
|
|
510
|
+
/**
|
|
511
|
+
* Schema for the options of `open` on a target: the access mode, whether a
|
|
512
|
+
* missing file is created, the creation mode, and append and truncate flags.
|
|
513
|
+
*
|
|
514
|
+
* @category schemas
|
|
515
|
+
* @since 0.6.0
|
|
516
|
+
*/
|
|
517
|
+
export declare const OpenOptions: Schema.Struct<{
|
|
518
|
+
readonly access: Schema.Literals<readonly ["read", "write", "readWrite"]>;
|
|
519
|
+
readonly create: Schema.optionalKey<Schema.Literals<readonly ["never", "ifMissing", "exclusive"]>>;
|
|
520
|
+
readonly mode: Schema.optionalKey<Schema.Natural>;
|
|
521
|
+
readonly append: Schema.optionalKey<Schema.Boolean>;
|
|
522
|
+
readonly truncate: Schema.optionalKey<Schema.Boolean>;
|
|
523
|
+
}>;
|
|
524
|
+
/**
|
|
525
|
+
* Options of `open` on a target.
|
|
526
|
+
*
|
|
527
|
+
* @category models
|
|
528
|
+
* @since 0.6.0
|
|
529
|
+
*/
|
|
530
|
+
export type OpenOptions = typeof OpenOptions.Type;
|
|
531
|
+
/**
|
|
532
|
+
* Schema for the options of `writeFile`: the open options plus whether a
|
|
533
|
+
* final symbolic link is replaced or followed and the mode the file ends with.
|
|
534
|
+
*
|
|
535
|
+
* @category schemas
|
|
536
|
+
* @since 0.6.0
|
|
537
|
+
*/
|
|
538
|
+
export declare const WriteFileOptions: Schema.Struct<{
|
|
539
|
+
readonly access: Schema.Literals<readonly ["read", "write", "readWrite"]>;
|
|
540
|
+
readonly create: Schema.optionalKey<Schema.Literals<readonly ["never", "ifMissing", "exclusive"]>>;
|
|
541
|
+
readonly mode: Schema.optionalKey<Schema.Natural>;
|
|
542
|
+
readonly append: Schema.optionalKey<Schema.Boolean>;
|
|
543
|
+
readonly truncate: Schema.optionalKey<Schema.Boolean>;
|
|
544
|
+
readonly followFinalSymlink: Schema.optionalKey<Schema.Boolean>;
|
|
545
|
+
readonly replaceFinalSymlink: Schema.optionalKey<Schema.Boolean>;
|
|
546
|
+
readonly finalMode: Schema.optionalKey<Schema.Natural>;
|
|
547
|
+
}>;
|
|
548
|
+
/**
|
|
549
|
+
* Options of `writeFile`.
|
|
550
|
+
*
|
|
551
|
+
* @category models
|
|
552
|
+
* @since 0.6.0
|
|
553
|
+
*/
|
|
554
|
+
export type WriteFileOptions = typeof WriteFileOptions.Type;
|
|
555
|
+
/**
|
|
556
|
+
* Schema for a directory's revision before and after a change.
|
|
557
|
+
*
|
|
558
|
+
* @category schemas
|
|
559
|
+
* @since 0.6.0
|
|
560
|
+
*/
|
|
561
|
+
export declare const DirectoryChange: Schema.Struct<{
|
|
562
|
+
readonly before: Schema.BigInt;
|
|
563
|
+
readonly after: Schema.BigInt;
|
|
564
|
+
}>;
|
|
565
|
+
/**
|
|
566
|
+
* A directory's revision before and after a change.
|
|
567
|
+
*
|
|
568
|
+
* @category models
|
|
569
|
+
* @since 0.6.0
|
|
570
|
+
*/
|
|
571
|
+
export type DirectoryChange = typeof DirectoryChange.Type;
|
|
572
|
+
/**
|
|
573
|
+
* Schema for the result of `rename`.
|
|
574
|
+
*
|
|
575
|
+
* @category schemas
|
|
576
|
+
* @since 0.6.0
|
|
577
|
+
*/
|
|
578
|
+
export declare const RenameReferenceResult: Schema.TaggedUnion<{
|
|
579
|
+
readonly DifferentDirectories: Schema.TaggedStruct<"DifferentDirectories", {
|
|
580
|
+
readonly sourceDirectory: Schema.Struct<{
|
|
581
|
+
readonly before: Schema.BigInt;
|
|
582
|
+
readonly after: Schema.BigInt;
|
|
583
|
+
}>;
|
|
584
|
+
readonly destinationDirectory: Schema.Struct<{
|
|
585
|
+
readonly before: Schema.BigInt;
|
|
586
|
+
readonly after: Schema.BigInt;
|
|
587
|
+
}>;
|
|
588
|
+
}>;
|
|
589
|
+
readonly SameDirectory: Schema.TaggedStruct<"SameDirectory", {
|
|
590
|
+
readonly directory: Schema.Struct<{
|
|
591
|
+
readonly before: Schema.BigInt;
|
|
592
|
+
readonly after: Schema.BigInt;
|
|
593
|
+
}>;
|
|
594
|
+
}>;
|
|
595
|
+
}>;
|
|
596
|
+
/**
|
|
597
|
+
* The result of `rename`.
|
|
598
|
+
*
|
|
599
|
+
* @category models
|
|
600
|
+
* @since 0.6.0
|
|
601
|
+
*/
|
|
602
|
+
export type RenameReferenceResult = typeof RenameReferenceResult.Type;
|
|
603
|
+
/**
|
|
604
|
+
* Schema for the options of `mkdir`. `exactMode` skips the caller's umask for
|
|
605
|
+
* an explicit creation mode; permission policy still applies. `recursive`
|
|
606
|
+
* creates every missing directory on the path in one change, as `mkdir -p`
|
|
607
|
+
* does, and succeeds when the final directory already exists; the mode
|
|
608
|
+
* applies to every directory it creates and the times to the final one.
|
|
609
|
+
*
|
|
610
|
+
* @category schemas
|
|
611
|
+
* @since 0.6.0
|
|
612
|
+
*/
|
|
613
|
+
export declare const MkdirOptions: Schema.Struct<{
|
|
614
|
+
readonly mode: Schema.optionalKey<Schema.Natural>;
|
|
615
|
+
readonly exactMode: Schema.optionalKey<Schema.Boolean>;
|
|
616
|
+
readonly times: Schema.optionalKey<Schema.Struct<{
|
|
617
|
+
readonly access: Schema.Union<readonly [Schema.Struct<{
|
|
618
|
+
readonly kind: Schema.Literal<"now">;
|
|
619
|
+
}>, Schema.Struct<{
|
|
620
|
+
readonly kind: Schema.Literal<"omit">;
|
|
621
|
+
}>, Schema.Struct<{
|
|
622
|
+
readonly kind: Schema.Literal<"value">;
|
|
623
|
+
readonly nanoseconds: Schema.BigInt;
|
|
624
|
+
}>]>;
|
|
625
|
+
readonly modification: Schema.Union<readonly [Schema.Struct<{
|
|
626
|
+
readonly kind: Schema.Literal<"now">;
|
|
627
|
+
}>, Schema.Struct<{
|
|
628
|
+
readonly kind: Schema.Literal<"omit">;
|
|
629
|
+
}>, Schema.Struct<{
|
|
630
|
+
readonly kind: Schema.Literal<"value">;
|
|
631
|
+
readonly nanoseconds: Schema.BigInt;
|
|
632
|
+
}>]>;
|
|
633
|
+
}>>;
|
|
634
|
+
readonly recursive: Schema.optionalKey<Schema.Boolean>;
|
|
635
|
+
}>;
|
|
636
|
+
/**
|
|
637
|
+
* Options of `mkdir`.
|
|
638
|
+
*
|
|
639
|
+
* @category models
|
|
640
|
+
* @since 0.6.0
|
|
641
|
+
*/
|
|
642
|
+
export type MkdirOptions = typeof MkdirOptions.Type;
|
|
643
|
+
/**
|
|
644
|
+
* Schema for the options of `walk`: the order entries arrive in and the
|
|
645
|
+
* optional bounds on how deep, how many, and how many bytes the walk may
|
|
646
|
+
* reach. `order` defaults to `"pre"`, each directory before its entries; a
|
|
647
|
+
* `"post"` walk reports each directory after them. Every bound defaults to
|
|
648
|
+
* unbounded, and a walk that would pass one fails with `LimitExceeded` naming
|
|
649
|
+
* the bound in `field`.
|
|
650
|
+
*
|
|
651
|
+
* @category schemas
|
|
652
|
+
* @since 0.6.0
|
|
653
|
+
*/
|
|
654
|
+
export declare const WalkOptions: Schema.Struct<{
|
|
655
|
+
readonly order: Schema.optionalKey<Schema.Literals<readonly ["pre", "post"]>>;
|
|
656
|
+
readonly maxDepth: Schema.optionalKey<Schema.Natural>;
|
|
657
|
+
readonly maxEntries: Schema.optionalKey<Schema.Natural>;
|
|
658
|
+
readonly maxBytes: Schema.optionalKey<Schema.ByteSize>;
|
|
659
|
+
}>;
|
|
660
|
+
/**
|
|
661
|
+
* Options of `walk`.
|
|
662
|
+
*
|
|
663
|
+
* @category models
|
|
664
|
+
* @since 0.6.0
|
|
665
|
+
*/
|
|
666
|
+
export type WalkOptions = typeof WalkOptions.Type;
|
|
667
|
+
/**
|
|
668
|
+
* Schema for the options of `remove`. `recursive` removes a directory and
|
|
669
|
+
* everything under it; `force` succeeds when the target itself is missing.
|
|
670
|
+
* `expected` pins object identity at each coordinated removal stage. A replacement fails `VolumeBusy`.
|
|
671
|
+
*
|
|
672
|
+
* @category schemas
|
|
673
|
+
* @since 0.6.0
|
|
674
|
+
*/
|
|
675
|
+
export declare const RemoveOptions: Schema.Struct<{
|
|
676
|
+
readonly recursive: Schema.optionalKey<Schema.Boolean>;
|
|
677
|
+
readonly force: Schema.optionalKey<Schema.Boolean>;
|
|
678
|
+
readonly expected: Schema.optionalKey<Schema.suspend<Schema.declare<ObjectReference, ObjectReference>>>;
|
|
679
|
+
}>;
|
|
680
|
+
/**
|
|
681
|
+
* Options of `remove`.
|
|
682
|
+
*
|
|
683
|
+
* @category models
|
|
684
|
+
* @since 0.6.0
|
|
685
|
+
*/
|
|
686
|
+
export type RemoveOptions = typeof RemoveOptions.Type;
|
|
687
|
+
/**
|
|
688
|
+
* Schema for the options of `symlink`.
|
|
689
|
+
*
|
|
690
|
+
* @category schemas
|
|
691
|
+
* @since 0.6.0
|
|
692
|
+
*/
|
|
693
|
+
export declare const SymlinkOptions: Schema.Struct<{
|
|
694
|
+
readonly times: Schema.optionalKey<Schema.Struct<{
|
|
695
|
+
readonly access: Schema.Union<readonly [Schema.Struct<{
|
|
696
|
+
readonly kind: Schema.Literal<"now">;
|
|
697
|
+
}>, Schema.Struct<{
|
|
698
|
+
readonly kind: Schema.Literal<"omit">;
|
|
699
|
+
}>, Schema.Struct<{
|
|
700
|
+
readonly kind: Schema.Literal<"value">;
|
|
701
|
+
readonly nanoseconds: Schema.BigInt;
|
|
702
|
+
}>]>;
|
|
703
|
+
readonly modification: Schema.Union<readonly [Schema.Struct<{
|
|
704
|
+
readonly kind: Schema.Literal<"now">;
|
|
705
|
+
}>, Schema.Struct<{
|
|
706
|
+
readonly kind: Schema.Literal<"omit">;
|
|
707
|
+
}>, Schema.Struct<{
|
|
708
|
+
readonly kind: Schema.Literal<"value">;
|
|
709
|
+
readonly nanoseconds: Schema.BigInt;
|
|
710
|
+
}>]>;
|
|
711
|
+
}>>;
|
|
712
|
+
}>;
|
|
713
|
+
/**
|
|
714
|
+
* Options of `symlink`.
|
|
715
|
+
*
|
|
716
|
+
* @category models
|
|
717
|
+
* @since 0.6.0
|
|
718
|
+
*/
|
|
719
|
+
export type SymlinkOptions = typeof SymlinkOptions.Type;
|
|
720
|
+
/**
|
|
721
|
+
* Schema for the attributes `setattr` changes together: a regular file's
|
|
722
|
+
* size, the permission mode, the owner, and the access and modification
|
|
723
|
+
* times. An omitted attribute keeps its current value. `expected` pins the
|
|
724
|
+
* target's revision the caller last observed, checked inside the same change,
|
|
725
|
+
* and fails as `StaleReference` naming `expected` when the target has moved
|
|
726
|
+
* on, so a change decided from that observation never applies to a newer one.
|
|
727
|
+
*
|
|
728
|
+
* @category schemas
|
|
729
|
+
* @since 0.6.0
|
|
730
|
+
*/
|
|
731
|
+
export declare const SetattrOptions: Schema.Struct<{
|
|
732
|
+
readonly size: Schema.optionalKey<Schema.BigInt>;
|
|
733
|
+
readonly mode: Schema.optionalKey<Schema.Natural>;
|
|
734
|
+
readonly owner: Schema.optionalKey<Schema.Struct<{
|
|
735
|
+
readonly uid: Schema.optionalKey<Schema.Natural>;
|
|
736
|
+
readonly gid: Schema.optionalKey<Schema.Natural>;
|
|
737
|
+
}>>;
|
|
738
|
+
readonly times: Schema.optionalKey<Schema.Struct<{
|
|
739
|
+
readonly access: Schema.Union<readonly [Schema.Struct<{
|
|
740
|
+
readonly kind: Schema.Literal<"now">;
|
|
741
|
+
}>, Schema.Struct<{
|
|
742
|
+
readonly kind: Schema.Literal<"omit">;
|
|
743
|
+
}>, Schema.Struct<{
|
|
744
|
+
readonly kind: Schema.Literal<"value">;
|
|
745
|
+
readonly nanoseconds: Schema.BigInt;
|
|
746
|
+
}>]>;
|
|
747
|
+
readonly modification: Schema.Union<readonly [Schema.Struct<{
|
|
748
|
+
readonly kind: Schema.Literal<"now">;
|
|
749
|
+
}>, Schema.Struct<{
|
|
750
|
+
readonly kind: Schema.Literal<"omit">;
|
|
751
|
+
}>, Schema.Struct<{
|
|
752
|
+
readonly kind: Schema.Literal<"value">;
|
|
753
|
+
readonly nanoseconds: Schema.BigInt;
|
|
754
|
+
}>]>;
|
|
755
|
+
}>>;
|
|
756
|
+
readonly expected: Schema.optionalKey<Schema.Struct<{
|
|
757
|
+
readonly revision: Schema.BigInt;
|
|
758
|
+
}>>;
|
|
759
|
+
}>;
|
|
760
|
+
/**
|
|
761
|
+
* Attributes of `setattr`.
|
|
762
|
+
*
|
|
763
|
+
* @category models
|
|
764
|
+
* @since 0.6.0
|
|
765
|
+
*/
|
|
766
|
+
export type SetattrOptions = typeof SetattrOptions.Type;
|
|
767
|
+
/**
|
|
768
|
+
* Schema for an object reference: any value carrying the reference brand. Whether the volume issued it is checked
|
|
769
|
+
* where it is used.
|
|
770
|
+
*
|
|
771
|
+
* @internal
|
|
772
|
+
*/
|
|
773
|
+
export declare const ObjectReferenceSchema: Schema.declare<ObjectReference, ObjectReference>;
|
|
774
|
+
/**
|
|
775
|
+
* Schema for the options of `open` on an entry, a lookup-or-create-and-open in
|
|
776
|
+
* one gate hold. `expected` pins the child the caller last observed under the
|
|
777
|
+
* name (or `null` for none) and fails as `VolumeBusy` when another has
|
|
778
|
+
* appeared; `expectedChild` pins its revision and times as well and fails as
|
|
779
|
+
* `StaleReference` when they moved.
|
|
780
|
+
*
|
|
781
|
+
* @category schemas
|
|
782
|
+
* @since 0.6.0
|
|
783
|
+
*/
|
|
784
|
+
export declare const OpenEntryOptions: Schema.Struct<{
|
|
785
|
+
readonly access: Schema.Literals<readonly ["read", "write", "readWrite"]>;
|
|
786
|
+
readonly create: Schema.optionalKey<Schema.Literals<readonly ["never", "ifMissing", "exclusive"]>>;
|
|
787
|
+
readonly mode: Schema.optionalKey<Schema.Natural>;
|
|
788
|
+
readonly append: Schema.optionalKey<Schema.Boolean>;
|
|
789
|
+
readonly truncate: Schema.optionalKey<Schema.Boolean>;
|
|
790
|
+
readonly followFinalSymlink: Schema.optionalKey<Schema.Boolean>;
|
|
791
|
+
readonly times: Schema.optionalKey<Schema.Struct<{
|
|
792
|
+
readonly access: Schema.Union<readonly [Schema.Struct<{
|
|
793
|
+
readonly kind: Schema.Literal<"now">;
|
|
794
|
+
}>, Schema.Struct<{
|
|
795
|
+
readonly kind: Schema.Literal<"omit">;
|
|
796
|
+
}>, Schema.Struct<{
|
|
797
|
+
readonly kind: Schema.Literal<"value">;
|
|
798
|
+
readonly nanoseconds: Schema.BigInt;
|
|
799
|
+
}>]>;
|
|
800
|
+
readonly modification: Schema.Union<readonly [Schema.Struct<{
|
|
801
|
+
readonly kind: Schema.Literal<"now">;
|
|
802
|
+
}>, Schema.Struct<{
|
|
803
|
+
readonly kind: Schema.Literal<"omit">;
|
|
804
|
+
}>, Schema.Struct<{
|
|
805
|
+
readonly kind: Schema.Literal<"value">;
|
|
806
|
+
readonly nanoseconds: Schema.BigInt;
|
|
807
|
+
}>]>;
|
|
808
|
+
}>>;
|
|
809
|
+
readonly initialSize: Schema.optionalKey<Schema.BigInt>;
|
|
810
|
+
readonly exactMode: Schema.optionalKey<Schema.Boolean>;
|
|
811
|
+
readonly owner: Schema.optionalKey<Schema.Struct<{
|
|
812
|
+
readonly uid: Schema.optionalKey<Schema.Natural>;
|
|
813
|
+
readonly gid: Schema.optionalKey<Schema.Natural>;
|
|
814
|
+
}>>;
|
|
815
|
+
readonly expected: Schema.optionalKey<Schema.NullOr<Schema.declare<ObjectReference, ObjectReference>>>;
|
|
816
|
+
readonly expectedChild: Schema.optionalKey<Schema.NullOr<Schema.Struct<{
|
|
817
|
+
readonly reference: Schema.declare<ObjectReference, ObjectReference>;
|
|
818
|
+
readonly revision: Schema.BigInt;
|
|
819
|
+
readonly atimeNs: Schema.BigInt;
|
|
820
|
+
readonly mtimeNs: Schema.BigInt;
|
|
821
|
+
}>>>;
|
|
822
|
+
}>;
|
|
823
|
+
/**
|
|
824
|
+
* Options of `open` on an entry.
|
|
825
|
+
*
|
|
826
|
+
* @category models
|
|
827
|
+
* @since 0.6.0
|
|
828
|
+
*/
|
|
829
|
+
export type OpenEntryOptions = typeof OpenEntryOptions.Type;
|
|
830
|
+
/** State shared with community codecs through the legacy volumeState view. @internal */
|
|
831
|
+
export declare namespace State {
|
|
832
|
+
/** @internal */
|
|
833
|
+
type Ino = number & Brand.Brand<"@effect-vfs/core/Ino">;
|
|
834
|
+
/** @internal */
|
|
835
|
+
const Ino: Brand.Constructor<Ino>;
|
|
836
|
+
/** @internal */
|
|
837
|
+
const ROOT_INO: Ino;
|
|
838
|
+
/** @internal */
|
|
839
|
+
const MAX_INO: number;
|
|
840
|
+
/** @internal */
|
|
841
|
+
const MAX_FILE_BYTES = 4294967295;
|
|
842
|
+
/** @internal */
|
|
843
|
+
const WALK_YIELD_INTERVAL = 128;
|
|
844
|
+
/** @internal */
|
|
845
|
+
interface Link {
|
|
846
|
+
readonly parent: Ino;
|
|
847
|
+
readonly name: string;
|
|
848
|
+
}
|
|
849
|
+
/** @internal */
|
|
850
|
+
type NodeMetadata = Omit<Metadata, "revision">;
|
|
851
|
+
/** @internal */
|
|
852
|
+
interface Directory {
|
|
853
|
+
readonly kind: "directory";
|
|
854
|
+
readonly ino: Ino;
|
|
855
|
+
readonly parent: Ino;
|
|
856
|
+
readonly name: string;
|
|
857
|
+
readonly entries: ReadonlyMap<string, Ino>;
|
|
858
|
+
readonly metadata: NodeMetadata;
|
|
859
|
+
readonly revision: bigint;
|
|
860
|
+
}
|
|
861
|
+
/** @internal */
|
|
862
|
+
interface RegularFile {
|
|
863
|
+
readonly kind: "file";
|
|
864
|
+
readonly ino: Ino;
|
|
865
|
+
readonly data: Uint8Array;
|
|
866
|
+
readonly links: ReadonlyArray<Link>;
|
|
867
|
+
readonly metadata: NodeMetadata;
|
|
868
|
+
readonly revision: bigint;
|
|
869
|
+
}
|
|
870
|
+
/** @internal */
|
|
871
|
+
interface SymbolicLink {
|
|
872
|
+
readonly kind: "symlink";
|
|
873
|
+
readonly ino: Ino;
|
|
874
|
+
readonly target: Uint8Array;
|
|
875
|
+
readonly links: ReadonlyArray<Link>;
|
|
876
|
+
readonly metadata: NodeMetadata;
|
|
877
|
+
readonly revision: bigint;
|
|
878
|
+
}
|
|
879
|
+
/** @internal */
|
|
880
|
+
type Node = Directory | RegularFile | SymbolicLink;
|
|
881
|
+
/** @internal */
|
|
882
|
+
interface VolumeState {
|
|
883
|
+
readonly inodes: HashMap.HashMap<Ino, Node>;
|
|
884
|
+
readonly open: ReadonlyMap<Ino, number>;
|
|
885
|
+
readonly nextInode: Ino;
|
|
886
|
+
readonly revision: bigint;
|
|
887
|
+
readonly entries: number;
|
|
888
|
+
readonly usedBytes: bigint;
|
|
889
|
+
}
|
|
890
|
+
/** @internal */
|
|
891
|
+
const getNode: (state: VolumeState, ino: Ino) => Node | undefined;
|
|
892
|
+
/** @internal */
|
|
893
|
+
const setNode: (inodes: HashMap.HashMap<Ino, Node>, node: Node) => HashMap.HashMap<Ino, Node>;
|
|
894
|
+
/** @internal */
|
|
895
|
+
const byIno: Order.Order<Node>;
|
|
896
|
+
/** @internal */
|
|
897
|
+
const byEntryName: Order.Order<readonly [string, Ino]>;
|
|
898
|
+
const inEntryOrder: (directory: Directory) => Directory;
|
|
899
|
+
/** @internal */
|
|
900
|
+
const payloadOf: (node: Node) => Uint8Array | undefined;
|
|
901
|
+
/** @internal */
|
|
902
|
+
const directoryMetadata: (ino: bigint, uid: number, gid: number, mode: number, now: bigint) => NodeMetadata;
|
|
903
|
+
/** @internal */
|
|
904
|
+
const pathOf: (get: (ino: Ino) => Node | undefined, ino: Ino) => string | undefined;
|
|
905
|
+
/** @internal */
|
|
906
|
+
const entryPath: (prefix: string, name: string) => BytePath;
|
|
907
|
+
/** @internal */
|
|
908
|
+
const emptyRoot: (now: bigint) => Directory;
|
|
909
|
+
/** @internal */
|
|
910
|
+
const emptyState: (now: bigint) => VolumeState;
|
|
911
|
+
}
|
|
912
|
+
declare const Ino: Brand.Constructor<State.Ino>;
|
|
913
|
+
type Ino = State.Ino;
|
|
914
|
+
type Link = State.Link;
|
|
915
|
+
type Directory = State.Directory;
|
|
916
|
+
type Node = State.Node;
|
|
917
|
+
type VolumeState = State.VolumeState;
|
|
918
|
+
/** @internal */
|
|
919
|
+
export declare namespace TokenRegistry {
|
|
920
|
+
/** @internal */
|
|
921
|
+
type HandleLifecycle = {
|
|
922
|
+
readonly kind: "acquiring";
|
|
923
|
+
} | {
|
|
924
|
+
readonly kind: "open";
|
|
925
|
+
readonly ino: Ino;
|
|
926
|
+
} | {
|
|
927
|
+
readonly kind: "releasedPendingCommit";
|
|
928
|
+
readonly ino: Ino | undefined;
|
|
929
|
+
} | {
|
|
930
|
+
readonly kind: "closed";
|
|
931
|
+
};
|
|
932
|
+
/** @internal */
|
|
933
|
+
interface HandleReference {
|
|
934
|
+
readonly volume: symbol;
|
|
935
|
+
lifecycle: HandleLifecycle;
|
|
936
|
+
namespaceRoots?: ReadonlyArray<Ino> | undefined;
|
|
937
|
+
boundaries?: ReadonlyArray<ReadonlyArray<Ino>> | undefined;
|
|
938
|
+
authority?: ((node: Node, op: OpContext) => Effect.Effect<void, FsFailure>) | undefined;
|
|
939
|
+
scope: Scope.Closeable | undefined;
|
|
940
|
+
}
|
|
941
|
+
/** @internal */
|
|
942
|
+
interface FileReference extends HandleReference {
|
|
943
|
+
offset: bigint;
|
|
944
|
+
readonly access: "read" | "write" | "readWrite";
|
|
945
|
+
readonly append: boolean;
|
|
946
|
+
}
|
|
947
|
+
/** @internal */
|
|
948
|
+
type DirectoryReference = HandleReference;
|
|
949
|
+
/** @internal */
|
|
950
|
+
type Token = ObjectReference | FileHandle | DirectoryHandle;
|
|
951
|
+
/** @internal */
|
|
952
|
+
type Resolution = {
|
|
953
|
+
readonly kind: "unknown";
|
|
954
|
+
} | {
|
|
955
|
+
readonly kind: "foreign";
|
|
956
|
+
} | {
|
|
957
|
+
readonly kind: "stale";
|
|
958
|
+
} | {
|
|
959
|
+
readonly kind: "live";
|
|
960
|
+
readonly node: Node;
|
|
961
|
+
};
|
|
962
|
+
/** @internal */
|
|
963
|
+
const inode: (reference: HandleReference) => Ino | undefined;
|
|
964
|
+
/** @internal */
|
|
965
|
+
const isOpen: (reference: HandleReference) => boolean;
|
|
966
|
+
/** @internal */
|
|
967
|
+
const publish: (reference: HandleReference, ino: Ino) => void;
|
|
968
|
+
/** @internal */
|
|
969
|
+
const released: (reference: HandleReference) => void;
|
|
970
|
+
/** @internal */
|
|
971
|
+
const release: <E, R>(reference: HandleReference, releaseInode: (ino: Ino) => Effect.Effect<void, E, R>, afterRelease: (action: () => void) => Effect.Effect<void, never, R>) => Effect.Effect<void, E, R>;
|
|
972
|
+
/** @internal */
|
|
973
|
+
const closeReleasedScope: (reference: HandleReference) => Effect.Effect<void, never, never>;
|
|
974
|
+
/** @internal */
|
|
975
|
+
const finalize: (reference: HandleReference, close: Effect.Effect<unknown, FsFailure>, fallback: Effect.Effect<void>) => Effect.Effect<void, never, never>;
|
|
976
|
+
/** @internal */
|
|
977
|
+
const acquire: <A, E, R, ReleaseR, CoordinateR>(reference: HandleReference, coordinate: (acquire: Effect.Effect<A, E, R | ReleaseR>) => Effect.Effect<A, E | FsFailure, CoordinateR>, acquisition: Effect.Effect<A, E, R>, releaseAcquired: () => Effect.Effect<void, never, ReleaseR>, finalizer: Effect.Effect<void, never, never>) => Effect.Effect<A, E | FsFailure, CoordinateR | Scope.Scope>;
|
|
978
|
+
/** @internal */
|
|
979
|
+
const nodeOrFail: (result: Resolution, addressing: "reference" | "handle", op: OpContext) => Effect.Effect<never, FsFailure, never> | Effect.Effect<State.Node, never, never>;
|
|
980
|
+
/** @internal */
|
|
981
|
+
const make: (volume: symbol, get: (ino: Ino) => Effect.Effect<Node | undefined>) => {
|
|
982
|
+
referenceIdentity: (token: ObjectReference, op: OpContext) => Effect.Effect<Ino, FsFailure>;
|
|
983
|
+
handleBoundaries: (token: Token) => readonly (readonly State.Ino[])[];
|
|
984
|
+
authorizeHandle: (token: Token, node: Node, op: OpContext) => Effect.Effect<void, FsFailure, never>;
|
|
985
|
+
resolve: (token: Token, addressing: "reference" | "handle" | "directory") => Effect.Effect<Resolution, never, never>;
|
|
986
|
+
resolveInode: (ino: Ino) => Effect.Effect<Resolution>;
|
|
987
|
+
referenceFor: (ino: Ino) => ObjectReference;
|
|
988
|
+
forget: (ino: Ino) => boolean;
|
|
989
|
+
file: (access: FileReference["access"], append: boolean) => FileReference;
|
|
990
|
+
directory: (ino?: Ino) => DirectoryReference;
|
|
991
|
+
registerFile: (handle: FileHandle, reference: FileReference) => WeakMap<object, FileReference>;
|
|
992
|
+
registerDirectory: (handle: DirectoryHandle, reference: DirectoryReference) => WeakMap<object, HandleReference>;
|
|
993
|
+
};
|
|
994
|
+
/** @internal */
|
|
995
|
+
type TokenRegistry = ReturnType<typeof make>;
|
|
996
|
+
}
|
|
997
|
+
/** @internal */
|
|
998
|
+
declare namespace Confinement {
|
|
999
|
+
/** @internal */
|
|
1000
|
+
const make: (view: Effect.Effect<(ino: Ino) => Node | undefined>, roots: ReadonlyArray<Ino>) => {
|
|
1001
|
+
roots: readonly State.Ino[];
|
|
1002
|
+
root: State.Ino;
|
|
1003
|
+
alive: (op: OpContext, handle?: boolean) => Effect.Effect<undefined, FsFailure, never>;
|
|
1004
|
+
contains: (node: Node) => Effect.Effect<boolean, never, never>;
|
|
1005
|
+
check: (node: State.Node, op: Errors.OpContext, handle?: boolean | undefined) => Effect.Effect<void, FsFailure, never>;
|
|
1006
|
+
path: (ino: State.Ino) => Effect.Effect<string | undefined, never, never>;
|
|
1007
|
+
};
|
|
1008
|
+
/** @internal */
|
|
1009
|
+
type Confinement = ReturnType<typeof make>;
|
|
1010
|
+
}
|
|
1011
|
+
/** @internal */
|
|
1012
|
+
export declare namespace Resolution {
|
|
1013
|
+
/** @internal */
|
|
1014
|
+
export type PreparedEntry = {
|
|
1015
|
+
readonly kind: "path";
|
|
1016
|
+
readonly path: PreparedPath;
|
|
1017
|
+
readonly base: DirectoryHandle | undefined;
|
|
1018
|
+
} | {
|
|
1019
|
+
readonly kind: "entry";
|
|
1020
|
+
readonly directory: Target;
|
|
1021
|
+
readonly name: string;
|
|
1022
|
+
};
|
|
1023
|
+
/** @internal */
|
|
1024
|
+
export interface NodeMode<R = never> {
|
|
1025
|
+
readonly kind: "Node";
|
|
1026
|
+
readonly followFinalSymlink?: boolean;
|
|
1027
|
+
readonly final?: boolean;
|
|
1028
|
+
readonly createMissing?: (parent: Directory, name: string, final: boolean) => Effect.Effect<Directory, FsFailure, R>;
|
|
1029
|
+
}
|
|
1030
|
+
/** @internal */
|
|
1031
|
+
export interface ParentMode {
|
|
1032
|
+
readonly kind: "Parent";
|
|
1033
|
+
}
|
|
1034
|
+
/** @internal */
|
|
1035
|
+
export interface OrCreateMode<R = never> {
|
|
1036
|
+
readonly kind: "OrCreate";
|
|
1037
|
+
readonly create: "never" | "ifMissing" | "exclusive";
|
|
1038
|
+
readonly finalSymlink: "follow" | "preserve";
|
|
1039
|
+
readonly entryExclusive?: "afterSymlink";
|
|
1040
|
+
readonly beforeFollow?: (parent: Directory, child: Node | undefined) => Effect.Effect<void, FsFailure, R>;
|
|
1041
|
+
}
|
|
1042
|
+
/** @internal */
|
|
1043
|
+
export type NodeResult = {
|
|
1044
|
+
readonly kind: "node";
|
|
1045
|
+
readonly node: Node;
|
|
1046
|
+
readonly op: OpContext;
|
|
1047
|
+
} | {
|
|
1048
|
+
readonly kind: "entry";
|
|
1049
|
+
readonly node: Node;
|
|
1050
|
+
readonly parent: Directory;
|
|
1051
|
+
readonly name: string;
|
|
1052
|
+
readonly op: OpContext;
|
|
1053
|
+
};
|
|
1054
|
+
/** @internal */
|
|
1055
|
+
export interface ParentResult {
|
|
1056
|
+
readonly kind: "parent";
|
|
1057
|
+
readonly parent: Ino;
|
|
1058
|
+
readonly name: string | undefined;
|
|
1059
|
+
readonly trailingSlash: boolean;
|
|
1060
|
+
readonly addressing: "path" | "entry";
|
|
1061
|
+
readonly op: OpContext;
|
|
1062
|
+
}
|
|
1063
|
+
interface CreateEntry {
|
|
1064
|
+
readonly parent: Directory;
|
|
1065
|
+
readonly name: string;
|
|
1066
|
+
readonly trailingSlash: boolean;
|
|
1067
|
+
readonly addressing: "path" | "entry";
|
|
1068
|
+
readonly op: OpContext;
|
|
1069
|
+
readonly origin: {
|
|
1070
|
+
readonly parent: Directory;
|
|
1071
|
+
readonly name: string;
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
/** @internal */
|
|
1075
|
+
export type CreateResult = (CreateEntry & {
|
|
1076
|
+
readonly kind: "existing";
|
|
1077
|
+
readonly node: Node;
|
|
1078
|
+
}) | (CreateEntry & {
|
|
1079
|
+
readonly kind: "missing";
|
|
1080
|
+
});
|
|
1081
|
+
/** @internal */
|
|
1082
|
+
export const inGroup: (identity: Identity, gid: number) => boolean;
|
|
1083
|
+
/** @internal */
|
|
1084
|
+
export const permitted: (node: Node, identity: Identity) => number;
|
|
1085
|
+
/** @internal */
|
|
1086
|
+
export const authorize: (node: Node, identity: Identity, bits: number, op: OpContext) => Effect.Effect<void, never, never> | Effect.Effect<never, FsFailure, never>;
|
|
1087
|
+
/** @internal */
|
|
1088
|
+
export const entryName: (input: NameInput, op: OpContext) => Result.Result<string, FsFailure>;
|
|
1089
|
+
/** @internal */
|
|
1090
|
+
export const make: ({ caller, get, identity, maxPathBytes, registry, confinement, additional, authorityView }: {
|
|
1091
|
+
readonly additional?: ReadonlyArray<Confinement.Confinement> | undefined;
|
|
1092
|
+
readonly authorityView: Effect.Effect<(ino: Ino) => Node | undefined>;
|
|
1093
|
+
readonly confinement?: Confinement.Confinement | undefined;
|
|
1094
|
+
readonly caller: TokenRegistry.DirectoryReference;
|
|
1095
|
+
readonly get: (ino: Ino) => Effect.Effect<Node | undefined>;
|
|
1096
|
+
readonly identity: Identity;
|
|
1097
|
+
readonly maxPathBytes: ByteSize.ByteSize | undefined;
|
|
1098
|
+
readonly registry: TokenRegistry.TokenRegistry;
|
|
1099
|
+
}) => {
|
|
1100
|
+
prepare: (input: PathInput, op: OpContext) => Result.Result<Paths.PreparedPath, FsFailure>;
|
|
1101
|
+
prepareEntry: (input: EntryInput, op: OpContext) => Result.Result<PreparedEntry, FsFailure>;
|
|
1102
|
+
resolve: {
|
|
1103
|
+
<R = never>(target: Target, mode: NodeMode<R>, op: OpContext): Effect.Effect<NodeResult, FsFailure, R>;
|
|
1104
|
+
(prepared: PreparedEntry, mode: ParentMode, op: OpContext): Effect.Effect<ParentResult, FsFailure>;
|
|
1105
|
+
<R = never>(prepared: PreparedEntry, mode: OrCreateMode<R>, op: OpContext): Effect.Effect<CreateResult, FsFailure, R>;
|
|
1106
|
+
};
|
|
1107
|
+
directory: (target: {
|
|
1108
|
+
readonly _tag: "Handle";
|
|
1109
|
+
readonly handle: FileHandle | DirectoryHandle;
|
|
1110
|
+
} | {
|
|
1111
|
+
readonly _tag: "Path";
|
|
1112
|
+
readonly path: PathInput;
|
|
1113
|
+
readonly relativeTo?: DirectoryHandle;
|
|
1114
|
+
readonly followFinalSymlink?: boolean;
|
|
1115
|
+
} | {
|
|
1116
|
+
readonly _tag: "Reference";
|
|
1117
|
+
readonly reference: ObjectReference;
|
|
1118
|
+
}, op: Errors.OpContext) => Effect.Effect<{
|
|
1119
|
+
node: State.Directory;
|
|
1120
|
+
op: Errors.OpContext;
|
|
1121
|
+
}, FsFailure, never>;
|
|
1122
|
+
entryDirectory: (target: {
|
|
1123
|
+
readonly _tag: "Handle";
|
|
1124
|
+
readonly handle: FileHandle | DirectoryHandle;
|
|
1125
|
+
} | {
|
|
1126
|
+
readonly _tag: "Path";
|
|
1127
|
+
readonly path: PathInput;
|
|
1128
|
+
readonly relativeTo?: DirectoryHandle;
|
|
1129
|
+
readonly followFinalSymlink?: boolean;
|
|
1130
|
+
} | {
|
|
1131
|
+
readonly _tag: "Reference";
|
|
1132
|
+
readonly reference: ObjectReference;
|
|
1133
|
+
}, op: Errors.OpContext) => Effect.Effect<{
|
|
1134
|
+
node: State.Directory;
|
|
1135
|
+
op: Errors.OpContext;
|
|
1136
|
+
}, FsFailure, never>;
|
|
1137
|
+
};
|
|
1138
|
+
export {};
|
|
1139
|
+
}
|
|
1140
|
+
/** @internal */
|
|
1141
|
+
export interface EngineOptions {
|
|
1142
|
+
readonly execution?: "cooperative" | "sync" | undefined;
|
|
1143
|
+
readonly limits?: BasicLimits | undefined;
|
|
1144
|
+
readonly initialTime?: bigint | undefined;
|
|
1145
|
+
readonly initialState?: VolumeState | undefined;
|
|
1146
|
+
readonly commitProvider?: CommitProvider<VolumeState> | undefined;
|
|
1147
|
+
readonly installed?: ((events: () => Iterable<WatchEvent>, installation: Installation) => void) | undefined;
|
|
1148
|
+
}
|
|
1149
|
+
/** @internal */
|
|
1150
|
+
export declare const BasicLimits: Schema.Struct<{
|
|
1151
|
+
readonly maxEntries: Schema.optional<Schema.Natural>;
|
|
1152
|
+
readonly maxBytes: Schema.optional<Schema.ByteSize>;
|
|
1153
|
+
readonly maxFileBytes: Schema.optional<Schema.ByteSize>;
|
|
1154
|
+
readonly maxPathBytes: Schema.optional<Schema.ByteSize>;
|
|
1155
|
+
readonly maxPendingOperations: Schema.optional<Schema.Int>;
|
|
1156
|
+
}>;
|
|
1157
|
+
/** @internal */
|
|
1158
|
+
export type BasicLimits = typeof BasicLimits.Type;
|
|
1159
|
+
/** @internal */
|
|
1160
|
+
export interface Rename {
|
|
1161
|
+
readonly ino: Ino;
|
|
1162
|
+
readonly from: Link;
|
|
1163
|
+
readonly to: Link;
|
|
1164
|
+
}
|
|
1165
|
+
/** @internal */
|
|
1166
|
+
export interface Installation {
|
|
1167
|
+
readonly before: VolumeState;
|
|
1168
|
+
readonly after: VolumeState;
|
|
1169
|
+
readonly renames?: ReadonlyArray<Rename>;
|
|
1170
|
+
}
|
|
1171
|
+
/** @internal */
|
|
1172
|
+
export interface WatchEvent {
|
|
1173
|
+
readonly change: {
|
|
1174
|
+
readonly _tag: "Create" | "Update" | "Remove";
|
|
1175
|
+
readonly path: BytePath;
|
|
1176
|
+
};
|
|
1177
|
+
readonly parent: Ino;
|
|
1178
|
+
readonly ino: Ino;
|
|
1179
|
+
readonly name?: string;
|
|
1180
|
+
}
|
|
1181
|
+
/** @internal */
|
|
1182
|
+
export interface WatchTarget {
|
|
1183
|
+
readonly roots: ReadonlyArray<Ino>;
|
|
1184
|
+
readonly additionalRoots: ReadonlyArray<ReadonlyArray<Ino>>;
|
|
1185
|
+
readonly target: Ino;
|
|
1186
|
+
readonly recursive: boolean;
|
|
1187
|
+
readonly selected?: Link;
|
|
1188
|
+
}
|
|
1189
|
+
/** @internal */
|
|
1190
|
+
export interface EngineOperations {
|
|
1191
|
+
readonly limits: EngineLimits;
|
|
1192
|
+
readonly root: Effect.Effect<ObjectReference, FsFailure>;
|
|
1193
|
+
readonly lookup: (entry: EntryInput) => Effect.Effect<ObjectReference, FsFailure>;
|
|
1194
|
+
readonly parent: (directory: TargetInput) => Effect.Effect<ObjectReference, FsFailure>;
|
|
1195
|
+
readonly stat: (target: TargetInput) => Effect.Effect<Metadata, FsFailure>;
|
|
1196
|
+
readonly readDirectory: (directory: TargetInput) => Effect.Effect<ObjectObservation<ReadonlyArray<DirectoryEntry>>, FsFailure>;
|
|
1197
|
+
readonly walk: (directory: TargetInput, options?: WalkOptions) => Stream.Stream<WalkEntry, WalkFailure>;
|
|
1198
|
+
readonly readLink: (target: TargetInput) => Effect.Effect<Uint8Array, FsFailure>;
|
|
1199
|
+
readonly realPath: (target: TargetInput) => Effect.Effect<BytePath, FsFailure>;
|
|
1200
|
+
readonly access: (target: TargetInput, bits?: number) => Effect.Effect<number, FsFailure>;
|
|
1201
|
+
readonly readFile: (target: TargetInput) => Effect.Effect<Uint8Array, FsFailure>;
|
|
1202
|
+
readonly writeFile: {
|
|
1203
|
+
(bytes: Uint8Array, options: WriteFileOptions): (entry: EntryInput) => Effect.Effect<ObjectReference, FsFailure>;
|
|
1204
|
+
(entry: EntryInput, bytes: Uint8Array, options: WriteFileOptions): Effect.Effect<ObjectReference, FsFailure>;
|
|
1205
|
+
};
|
|
1206
|
+
readonly open: {
|
|
1207
|
+
(target: Target | PathInput | ObjectReference | FileHandle, options: OpenOptions): Effect.Effect<FileHandle, FsFailure, Scope.Scope>;
|
|
1208
|
+
(entry: Entry, options: OpenEntryOptions): Effect.Effect<OpenEntryResult, FsFailure, Scope.Scope>;
|
|
1209
|
+
};
|
|
1210
|
+
readonly mkdir: (entry: EntryInput, options?: MkdirOptions) => Effect.Effect<ReferenceEntryResult, FsFailure>;
|
|
1211
|
+
readonly symlink: (target: PathInput, entry: EntryInput, options?: SymlinkOptions) => Effect.Effect<ReferenceEntryResult, FsFailure>;
|
|
1212
|
+
readonly link: {
|
|
1213
|
+
(entry: EntryInput): (source: TargetInput) => Effect.Effect<ReferenceEntryResult, FsFailure>;
|
|
1214
|
+
(source: TargetInput, entry: EntryInput): Effect.Effect<ReferenceEntryResult, FsFailure>;
|
|
1215
|
+
};
|
|
1216
|
+
readonly unlink: (entry: EntryInput) => Effect.Effect<DirectoryChange, FsFailure>;
|
|
1217
|
+
readonly rmdir: (entry: EntryInput) => Effect.Effect<DirectoryChange, FsFailure>;
|
|
1218
|
+
readonly remove: {
|
|
1219
|
+
(entry: EntryInput, options?: RemoveOptions & {
|
|
1220
|
+
readonly force?: false;
|
|
1221
|
+
}): Effect.Effect<DirectoryChange, FsFailure>;
|
|
1222
|
+
(entry: EntryInput, options: RemoveOptions): Effect.Effect<DirectoryChange | undefined, FsFailure>;
|
|
1223
|
+
};
|
|
1224
|
+
readonly rename: {
|
|
1225
|
+
(to: EntryInput): (from: EntryInput) => Effect.Effect<RenameReferenceResult, FsFailure>;
|
|
1226
|
+
(from: EntryInput, to: EntryInput): Effect.Effect<RenameReferenceResult, FsFailure>;
|
|
1227
|
+
};
|
|
1228
|
+
readonly chmod: {
|
|
1229
|
+
(mode: number): (target: TargetInput) => Effect.Effect<void, FsFailure>;
|
|
1230
|
+
(target: TargetInput, mode: number): Effect.Effect<void, FsFailure>;
|
|
1231
|
+
};
|
|
1232
|
+
readonly chown: {
|
|
1233
|
+
(owner: OwnerUpdate): (target: TargetInput) => Effect.Effect<void, FsFailure>;
|
|
1234
|
+
(target: TargetInput, owner: OwnerUpdate): Effect.Effect<void, FsFailure>;
|
|
1235
|
+
};
|
|
1236
|
+
readonly utimes: {
|
|
1237
|
+
(times: Times): (target: TargetInput) => Effect.Effect<void, FsFailure>;
|
|
1238
|
+
(target: TargetInput, times: Times): Effect.Effect<void, FsFailure>;
|
|
1239
|
+
};
|
|
1240
|
+
readonly truncate: {
|
|
1241
|
+
(length: bigint): (target: TargetInput) => Effect.Effect<void, FsFailure>;
|
|
1242
|
+
(target: TargetInput, length: bigint): Effect.Effect<void, FsFailure>;
|
|
1243
|
+
};
|
|
1244
|
+
readonly setattr: {
|
|
1245
|
+
(attributes: SetattrOptions): (target: TargetInput) => Effect.Effect<void, FsFailure>;
|
|
1246
|
+
(target: TargetInput, attributes: SetattrOptions): Effect.Effect<void, FsFailure>;
|
|
1247
|
+
};
|
|
1248
|
+
readonly openDirectory: (directory: TargetInput) => Effect.Effect<DirectoryHandle, FsFailure, Scope.Scope>;
|
|
1249
|
+
}
|
|
1250
|
+
/** @internal */
|
|
1251
|
+
export interface EngineContext {
|
|
1252
|
+
readonly operations: EngineOperations;
|
|
1253
|
+
readonly selectWatch: (input: TargetInput, options: {
|
|
1254
|
+
readonly recursive?: boolean | undefined;
|
|
1255
|
+
readonly alias?: "all" | "resolved" | undefined;
|
|
1256
|
+
}) => Effect.Effect<WatchTarget, FsFailure>;
|
|
1257
|
+
readonly withRoot: (input: TargetInput) => Effect.Effect<EngineContext, FsFailure, Scope.Scope>;
|
|
1258
|
+
readonly withDirectory: (input: TargetInput) => Effect.Effect<EngineContext, FsFailure, Scope.Scope>;
|
|
1259
|
+
}
|
|
1260
|
+
/** @internal */
|
|
1261
|
+
export interface CommitProvider<State> {
|
|
1262
|
+
readonly mode: "memory" | "durable";
|
|
1263
|
+
readonly commit: (candidate: State) => Effect.Effect<CommitOutcome, FsFailure & {
|
|
1264
|
+
readonly code: "StorageRejected";
|
|
1265
|
+
}>;
|
|
1266
|
+
readonly shutdown: Effect.Effect<void>;
|
|
1267
|
+
}
|
|
1268
|
+
/** @internal */
|
|
1269
|
+
export declare const memoryCommitProvider: CommitProvider<VolumeState>;
|
|
1270
|
+
/** @internal */
|
|
1271
|
+
export declare const makeEngine: (options?: EngineOptions | undefined) => Effect.Effect<Readonly<{
|
|
1272
|
+
limits: Readonly<{
|
|
1273
|
+
maxEntries: number | undefined;
|
|
1274
|
+
maxBytes: ByteSize.ByteSize | undefined;
|
|
1275
|
+
maxPathBytes: ByteSize.ByteSize | undefined;
|
|
1276
|
+
maxFileBytes: ByteSize.ByteSize;
|
|
1277
|
+
maxPendingOperations: number;
|
|
1278
|
+
}>;
|
|
1279
|
+
shutdown: Effect.Effect<void, never, never>;
|
|
1280
|
+
usage: Effect.Effect<VolumeUsage, FsFailure, never>;
|
|
1281
|
+
context: (options?: {
|
|
1282
|
+
readonly identity?: {
|
|
1283
|
+
readonly uid: number;
|
|
1284
|
+
readonly gid: number;
|
|
1285
|
+
readonly groups: readonly number[];
|
|
1286
|
+
readonly privileged: boolean;
|
|
1287
|
+
};
|
|
1288
|
+
readonly umask?: number;
|
|
1289
|
+
} | undefined) => Effect.Effect<EngineContext, FsFailure, never>;
|
|
1290
|
+
coordinate: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | FsFailure, R>;
|
|
1291
|
+
admit: <A, E, R>(op: OpContext, effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | FsFailure, R>;
|
|
1292
|
+
checkAvailable: (operation: string) => Effect.Effect<void, FsFailure, never>;
|
|
1293
|
+
execution: "cooperative" | "sync";
|
|
1294
|
+
syncBinding: Readonly<{
|
|
1295
|
+
check: (operation: string) => Result.Result<void, FsFailure>;
|
|
1296
|
+
}> | undefined;
|
|
1297
|
+
preflight: (op: OpContext) => Effect.Effect<void, FsFailure>;
|
|
1298
|
+
capture: (operation: string) => Effect.Effect<State.VolumeState, FsFailure, never>;
|
|
1299
|
+
cooperativeCapture: (<A, E, R>(operation: string, read: (state: VolumeState) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | FsFailure, R>) | undefined;
|
|
1300
|
+
referenceInode: (reference: ObjectReference, op: OpContext) => Effect.Effect<State.Ino, FsFailure, never>;
|
|
1301
|
+
objectFor: (resolveInode: Effect.Effect<Ino, FsFailure>, op: OpContext) => Effect.Effect<ObjectReference, FsFailure, never>;
|
|
1302
|
+
watchRoot: (reference: ObjectReference, op: Errors.OpContext) => Effect.Effect<State.Ino, FsFailure, never>;
|
|
1303
|
+
}>, ArgumentFailure, never>;
|
|
1304
|
+
export {};
|
|
1305
|
+
//# sourceMappingURL=engine.d.ts.map
|