@effect-vfs/nfs 0.1.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/LICENSE +22 -0
- package/README.md +93 -0
- package/dist/NfsServer.d.ts +693 -0
- package/dist/NfsServer.d.ts.map +1 -0
- package/dist/NfsServer.js +439 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/internal/export.d.ts +77 -0
- package/dist/internal/export.d.ts.map +1 -0
- package/dist/internal/export.js +224 -0
- package/dist/internal/lockRanges.d.ts +16 -0
- package/dist/internal/lockRanges.d.ts.map +1 -0
- package/dist/internal/lockRanges.js +12 -0
- package/dist/internal/nfs4.d.ts +194 -0
- package/dist/internal/nfs4.d.ts.map +1 -0
- package/dist/internal/nfs4.js +3561 -0
- package/dist/internal/recordMarking.d.ts +29 -0
- package/dist/internal/recordMarking.d.ts.map +1 -0
- package/dist/internal/recordMarking.js +127 -0
- package/dist/internal/rpc.d.ts +73 -0
- package/dist/internal/rpc.d.ts.map +1 -0
- package/dist/internal/rpc.js +161 -0
- package/dist/internal/server.d.ts +17 -0
- package/dist/internal/server.d.ts.map +1 -0
- package/dist/internal/server.js +78 -0
- package/dist/internal/xdr.d.ts +51 -0
- package/dist/internal/xdr.d.ts.map +1 -0
- package/dist/internal/xdr.js +178 -0
- package/package.json +54 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NfsServer.d.ts","sourceRoot":"","sources":["../src/NfsServer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,iBAAiB,IAAI,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,KAAK,MAAM,MAAM,eAAe,CA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+
* Models and constructors for the experimental read-only NFSv4.1 server.
|
|
3
|
+
*
|
|
4
|
+
* The server exports one live `@effect-vfs/core` volume over NFSv4.1 so that
|
|
5
|
+
* ordinary NFS clients can mount a virtual filesystem. It implements the
|
|
6
|
+
* required read-only operation set and answers every other operation with
|
|
7
|
+
* `NFS4ERR_NOTSUPP`.
|
|
8
|
+
*
|
|
9
|
+
* @since 0.1.0
|
|
10
|
+
*/
|
|
11
|
+
import { VirtualFileSystem as Vfs } from "@effect-vfs/core";
|
|
12
|
+
import * as ByteSize from "effect/ByteSize";
|
|
13
|
+
import * as Context from "effect/Context";
|
|
14
|
+
import * as Crypto from "effect/Crypto";
|
|
15
|
+
import * as Data from "effect/Data";
|
|
16
|
+
import * as Duration from "effect/Duration";
|
|
17
|
+
import * as Effect from "effect/Effect";
|
|
18
|
+
import * as Encoding from "effect/Encoding";
|
|
19
|
+
import * as Layer from "effect/Layer";
|
|
20
|
+
import * as Predicate from "effect/Predicate";
|
|
21
|
+
import * as Result from "effect/Result";
|
|
22
|
+
import * as Schema from "effect/Schema";
|
|
23
|
+
import * as SocketServer from "effect/unstable/socket/SocketServer";
|
|
24
|
+
import { makeExport } from "./internal/export.js";
|
|
25
|
+
import { makeNfs4Handler } from "./internal/nfs4.js";
|
|
26
|
+
import { startServer } from "./internal/server.js";
|
|
27
|
+
const PositiveSafeInteger = Schema.Finite.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER));
|
|
28
|
+
const Uint32 = Schema.Finite.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(0xffff_ffff));
|
|
29
|
+
const PositiveUint32 = Uint32.check(Schema.isGreaterThanOrEqualTo(1));
|
|
30
|
+
const PositiveByteSize = Schema.ByteSize.check(Schema.makeFilter((size) => size > 0n ? undefined : "must be at least 1 byte"), Schema.makeFilter((size) => size <= 0xffffffffn ? undefined : "must be at most 4294967295 bytes"));
|
|
31
|
+
const FragmentByteSize = PositiveByteSize.check(Schema.makeFilter((size) => size <= 0x7fffffffn ? undefined : "must be at most 2147483647 bytes"));
|
|
32
|
+
const NameByteSize = PositiveByteSize.check(Schema.makeFilter((size) => size <= 255n ? undefined : "must be at most 255 bytes"));
|
|
33
|
+
/**
|
|
34
|
+
* Schema for a literal IPv4 or IPv6 loopback address.
|
|
35
|
+
*
|
|
36
|
+
* @category schemas
|
|
37
|
+
* @since 0.1.0
|
|
38
|
+
*/
|
|
39
|
+
export const LoopbackHost = Schema.Literals(["127.0.0.1", "::1"]);
|
|
40
|
+
/**
|
|
41
|
+
* Schema for a TCP port, including `0` for an ephemeral port.
|
|
42
|
+
*
|
|
43
|
+
* @category schemas
|
|
44
|
+
* @since 0.1.0
|
|
45
|
+
*/
|
|
46
|
+
export const Port = Uint32.check(Schema.isLessThanOrEqualTo(65_535));
|
|
47
|
+
const NfsServerLimitsSchema = Schema.Struct({
|
|
48
|
+
maxConnections: PositiveSafeInteger,
|
|
49
|
+
maxFragmentBytes: FragmentByteSize,
|
|
50
|
+
maxRecordBytes: PositiveByteSize,
|
|
51
|
+
maxFragmentsPerRecord: PositiveSafeInteger,
|
|
52
|
+
maxOpaqueBytes: PositiveByteSize,
|
|
53
|
+
maxStringBytes: PositiveByteSize,
|
|
54
|
+
maxArrayElements: PositiveSafeInteger,
|
|
55
|
+
maxAuthBytes: PositiveByteSize,
|
|
56
|
+
maxMachineNameBytes: PositiveByteSize,
|
|
57
|
+
maxSupplementaryGroups: PositiveSafeInteger,
|
|
58
|
+
maxCompoundBytes: PositiveByteSize,
|
|
59
|
+
maxOperations: PositiveSafeInteger,
|
|
60
|
+
maxBitmapWords: PositiveSafeInteger,
|
|
61
|
+
maxClients: PositiveSafeInteger,
|
|
62
|
+
maxIdentities: PositiveSafeInteger,
|
|
63
|
+
maxPendingClientReplacements: PositiveSafeInteger,
|
|
64
|
+
maxSessions: PositiveSafeInteger,
|
|
65
|
+
maxSlotsPerSession: PositiveSafeInteger,
|
|
66
|
+
maxReplayBytes: PositiveByteSize,
|
|
67
|
+
maxOpens: PositiveSafeInteger,
|
|
68
|
+
maxLockOwners: PositiveSafeInteger,
|
|
69
|
+
maxLocks: PositiveSafeInteger,
|
|
70
|
+
maxOwnerBytes: PositiveByteSize,
|
|
71
|
+
maxReadBytes: PositiveByteSize,
|
|
72
|
+
maxWriteBytes: PositiveByteSize,
|
|
73
|
+
maxReaddirEntries: PositiveSafeInteger,
|
|
74
|
+
maxReaddirReplyBytes: PositiveByteSize,
|
|
75
|
+
maxNameBytes: NameByteSize,
|
|
76
|
+
maxFilehandles: PositiveSafeInteger
|
|
77
|
+
});
|
|
78
|
+
const makeNfsServerLimits = (limits) => Object.freeze({ ...limits });
|
|
79
|
+
const constrained = makeNfsServerLimits({
|
|
80
|
+
maxConnections: 4,
|
|
81
|
+
maxFragmentBytes: ByteSize.kibibytes(64),
|
|
82
|
+
maxRecordBytes: ByteSize.kibibytes(128),
|
|
83
|
+
maxFragmentsPerRecord: 8,
|
|
84
|
+
maxOpaqueBytes: ByteSize.kibibytes(64),
|
|
85
|
+
maxStringBytes: ByteSize.kibibytes(4),
|
|
86
|
+
maxArrayElements: 64,
|
|
87
|
+
maxAuthBytes: ByteSize.bytes(400),
|
|
88
|
+
maxMachineNameBytes: ByteSize.bytes(255),
|
|
89
|
+
maxSupplementaryGroups: 16,
|
|
90
|
+
maxCompoundBytes: ByteSize.kibibytes(128),
|
|
91
|
+
maxOperations: 16,
|
|
92
|
+
maxBitmapWords: 4,
|
|
93
|
+
maxClients: 8,
|
|
94
|
+
maxIdentities: 8,
|
|
95
|
+
maxPendingClientReplacements: 1,
|
|
96
|
+
maxSessions: 8,
|
|
97
|
+
maxSlotsPerSession: 4,
|
|
98
|
+
maxReplayBytes: ByteSize.kibibytes(256),
|
|
99
|
+
maxOpens: 64,
|
|
100
|
+
maxLockOwners: 64,
|
|
101
|
+
maxLocks: 256,
|
|
102
|
+
maxOwnerBytes: ByteSize.bytes(256),
|
|
103
|
+
maxReadBytes: ByteSize.kibibytes(64),
|
|
104
|
+
maxWriteBytes: ByteSize.kibibytes(64),
|
|
105
|
+
maxReaddirEntries: 64,
|
|
106
|
+
maxReaddirReplyBytes: ByteSize.kibibytes(64),
|
|
107
|
+
maxNameBytes: ByteSize.bytes(255),
|
|
108
|
+
maxFilehandles: 512
|
|
109
|
+
});
|
|
110
|
+
const defaultLimits = makeNfsServerLimits({
|
|
111
|
+
maxConnections: 16,
|
|
112
|
+
maxFragmentBytes: ByteSize.mebibytes(1),
|
|
113
|
+
maxRecordBytes: ByteSize.mebibytes(1),
|
|
114
|
+
maxFragmentsPerRecord: 64,
|
|
115
|
+
maxOpaqueBytes: ByteSize.mebibytes(1),
|
|
116
|
+
maxStringBytes: ByteSize.kibibytes(4),
|
|
117
|
+
maxArrayElements: 1_024,
|
|
118
|
+
maxAuthBytes: ByteSize.bytes(400),
|
|
119
|
+
maxMachineNameBytes: ByteSize.bytes(255),
|
|
120
|
+
maxSupplementaryGroups: 32,
|
|
121
|
+
maxCompoundBytes: ByteSize.mebibytes(1),
|
|
122
|
+
maxOperations: 64,
|
|
123
|
+
maxBitmapWords: 4,
|
|
124
|
+
maxClients: 16,
|
|
125
|
+
maxIdentities: 64,
|
|
126
|
+
maxPendingClientReplacements: 1,
|
|
127
|
+
maxSessions: 16,
|
|
128
|
+
maxSlotsPerSession: 16,
|
|
129
|
+
maxReplayBytes: ByteSize.mebibytes(4),
|
|
130
|
+
maxOpens: 1_024,
|
|
131
|
+
maxLockOwners: 1_024,
|
|
132
|
+
maxLocks: 4_096,
|
|
133
|
+
maxOwnerBytes: ByteSize.kibibytes(1),
|
|
134
|
+
maxReadBytes: ByteSize.mebibytes(1),
|
|
135
|
+
maxWriteBytes: ByteSize.mebibytes(1),
|
|
136
|
+
maxReaddirEntries: 1_024,
|
|
137
|
+
maxReaddirReplyBytes: ByteSize.mebibytes(1),
|
|
138
|
+
maxNameBytes: ByteSize.bytes(255),
|
|
139
|
+
maxFilehandles: 8_192
|
|
140
|
+
});
|
|
141
|
+
/**
|
|
142
|
+
* Schema for every resource bound enforced by the preview server, with frozen presets.
|
|
143
|
+
*
|
|
144
|
+
* @category schemas
|
|
145
|
+
* @since 0.1.0
|
|
146
|
+
*/
|
|
147
|
+
export const NfsServerLimits = Object.assign(NfsServerLimitsSchema, {
|
|
148
|
+
constrained,
|
|
149
|
+
default: defaultLimits
|
|
150
|
+
});
|
|
151
|
+
/**
|
|
152
|
+
* Schema for selectively overriding the default NFS server resource policy.
|
|
153
|
+
*
|
|
154
|
+
* @category schemas
|
|
155
|
+
* @since 0.1.0
|
|
156
|
+
*/
|
|
157
|
+
export const NfsServerLimitOverrides = Schema.Struct({
|
|
158
|
+
maxConnections: Schema.optionalKey(NfsServerLimits.fields.maxConnections),
|
|
159
|
+
maxFragmentBytes: Schema.optionalKey(NfsServerLimits.fields.maxFragmentBytes),
|
|
160
|
+
maxRecordBytes: Schema.optionalKey(NfsServerLimits.fields.maxRecordBytes),
|
|
161
|
+
maxFragmentsPerRecord: Schema.optionalKey(NfsServerLimits.fields.maxFragmentsPerRecord),
|
|
162
|
+
maxOpaqueBytes: Schema.optionalKey(NfsServerLimits.fields.maxOpaqueBytes),
|
|
163
|
+
maxStringBytes: Schema.optionalKey(NfsServerLimits.fields.maxStringBytes),
|
|
164
|
+
maxArrayElements: Schema.optionalKey(NfsServerLimits.fields.maxArrayElements),
|
|
165
|
+
maxAuthBytes: Schema.optionalKey(NfsServerLimits.fields.maxAuthBytes),
|
|
166
|
+
maxMachineNameBytes: Schema.optionalKey(NfsServerLimits.fields.maxMachineNameBytes),
|
|
167
|
+
maxSupplementaryGroups: Schema.optionalKey(NfsServerLimits.fields.maxSupplementaryGroups),
|
|
168
|
+
maxCompoundBytes: Schema.optionalKey(NfsServerLimits.fields.maxCompoundBytes),
|
|
169
|
+
maxOperations: Schema.optionalKey(NfsServerLimits.fields.maxOperations),
|
|
170
|
+
maxBitmapWords: Schema.optionalKey(NfsServerLimits.fields.maxBitmapWords),
|
|
171
|
+
maxClients: Schema.optionalKey(NfsServerLimits.fields.maxClients),
|
|
172
|
+
maxIdentities: Schema.optionalKey(NfsServerLimits.fields.maxIdentities),
|
|
173
|
+
maxPendingClientReplacements: Schema.optionalKey(NfsServerLimits.fields.maxPendingClientReplacements),
|
|
174
|
+
maxSessions: Schema.optionalKey(NfsServerLimits.fields.maxSessions),
|
|
175
|
+
maxSlotsPerSession: Schema.optionalKey(NfsServerLimits.fields.maxSlotsPerSession),
|
|
176
|
+
maxReplayBytes: Schema.optionalKey(NfsServerLimits.fields.maxReplayBytes),
|
|
177
|
+
maxOpens: Schema.optionalKey(NfsServerLimits.fields.maxOpens),
|
|
178
|
+
maxLockOwners: Schema.optionalKey(NfsServerLimits.fields.maxLockOwners),
|
|
179
|
+
maxLocks: Schema.optionalKey(NfsServerLimits.fields.maxLocks),
|
|
180
|
+
maxOwnerBytes: Schema.optionalKey(NfsServerLimits.fields.maxOwnerBytes),
|
|
181
|
+
maxReadBytes: Schema.optionalKey(NfsServerLimits.fields.maxReadBytes),
|
|
182
|
+
maxWriteBytes: Schema.optionalKey(NfsServerLimits.fields.maxWriteBytes),
|
|
183
|
+
maxReaddirEntries: Schema.optionalKey(NfsServerLimits.fields.maxReaddirEntries),
|
|
184
|
+
maxReaddirReplyBytes: Schema.optionalKey(NfsServerLimits.fields.maxReaddirReplyBytes),
|
|
185
|
+
maxNameBytes: Schema.optionalKey(NfsServerLimits.fields.maxNameBytes),
|
|
186
|
+
maxFilehandles: Schema.optionalKey(NfsServerLimits.fields.maxFilehandles)
|
|
187
|
+
});
|
|
188
|
+
/** Schema for configuration that can be validated without opening runtime capabilities. */
|
|
189
|
+
const NfsServerConfigSchema = Schema.Struct({
|
|
190
|
+
leaseDurationSeconds: PositiveUint32,
|
|
191
|
+
/** How long a backchannel callback waits for the client before the path is treated as down. */
|
|
192
|
+
callbackTimeoutSeconds: PositiveUint32,
|
|
193
|
+
limits: NfsServerLimits
|
|
194
|
+
});
|
|
195
|
+
const defaultConfig = Object.freeze({
|
|
196
|
+
leaseDurationSeconds: 30,
|
|
197
|
+
callbackTimeoutSeconds: 30,
|
|
198
|
+
limits: NfsServerLimits.default
|
|
199
|
+
});
|
|
200
|
+
/**
|
|
201
|
+
* Complete server configuration schema with a frozen default policy.
|
|
202
|
+
*
|
|
203
|
+
* @category schemas
|
|
204
|
+
* @since 0.1.0
|
|
205
|
+
*/
|
|
206
|
+
export const NfsServerConfig = Object.assign(NfsServerConfigSchema, {
|
|
207
|
+
default: defaultConfig
|
|
208
|
+
});
|
|
209
|
+
/**
|
|
210
|
+
* Optional configuration accepted when constructing an NFS server.
|
|
211
|
+
*
|
|
212
|
+
* @category schemas
|
|
213
|
+
* @since 0.1.0
|
|
214
|
+
*/
|
|
215
|
+
export const NfsServerConfigOverrides = Schema.Struct({
|
|
216
|
+
leaseDurationSeconds: Schema.optionalKey(PositiveUint32),
|
|
217
|
+
callbackTimeoutSeconds: Schema.optionalKey(PositiveUint32),
|
|
218
|
+
limits: Schema.optionalKey(NfsServerLimitOverrides)
|
|
219
|
+
});
|
|
220
|
+
/**
|
|
221
|
+
* Schema for a bound loopback TCP address.
|
|
222
|
+
*
|
|
223
|
+
* @category schemas
|
|
224
|
+
* @since 0.1.0
|
|
225
|
+
*/
|
|
226
|
+
export const NfsServerTcpAddress = Schema.Struct({
|
|
227
|
+
host: LoopbackHost,
|
|
228
|
+
port: Port
|
|
229
|
+
});
|
|
230
|
+
/**
|
|
231
|
+
* Schema for a TCP address that may be reachable beyond the local host.
|
|
232
|
+
*
|
|
233
|
+
* @category schemas
|
|
234
|
+
* @since 0.1.0
|
|
235
|
+
*/
|
|
236
|
+
export const NfsServerNetworkTcpAddress = Schema.Struct({ host: Schema.NonEmptyString, port: Port });
|
|
237
|
+
/**
|
|
238
|
+
* Schema for a bound UNIX-domain socket path. A filesystem socket is reachable only from the
|
|
239
|
+
* same host, so it counts as a local address alongside loopback TCP.
|
|
240
|
+
*
|
|
241
|
+
* @category schemas
|
|
242
|
+
* @since 0.1.0
|
|
243
|
+
*/
|
|
244
|
+
export const NfsServerUnixAddress = Schema.Struct({
|
|
245
|
+
path: Schema.NonEmptyString
|
|
246
|
+
});
|
|
247
|
+
/**
|
|
248
|
+
* Schema for the bound server address: TCP or a UNIX-domain socket path.
|
|
249
|
+
*
|
|
250
|
+
* @category schemas
|
|
251
|
+
* @since 0.1.0
|
|
252
|
+
*/
|
|
253
|
+
export const NfsServerAddress = Schema.Union([NfsServerNetworkTcpAddress, NfsServerUnixAddress]);
|
|
254
|
+
/**
|
|
255
|
+
* Raised when a server option fails validation before the server starts.
|
|
256
|
+
*
|
|
257
|
+
* The `option` field names the rejected configuration key.
|
|
258
|
+
*
|
|
259
|
+
* @category errors
|
|
260
|
+
* @since 0.1.0
|
|
261
|
+
*/
|
|
262
|
+
export class ConfigurationError extends Data.TaggedError("ConfigurationError") {
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Raised when the NFS server cannot start or cannot continue listening.
|
|
266
|
+
*
|
|
267
|
+
* @category errors
|
|
268
|
+
* @since 0.1.0
|
|
269
|
+
*/
|
|
270
|
+
export class NfsServerError extends Data.TaggedError("NfsServerError") {
|
|
271
|
+
get message() {
|
|
272
|
+
return "The NFS server could not start or continue listening";
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
const configurationError = (option, message) => new ConfigurationError({ option, message });
|
|
276
|
+
const configurationPath = (issue) => {
|
|
277
|
+
if (Predicate.isTagged(issue, "Pointer")) {
|
|
278
|
+
return [...issue.path, ...configurationPath(issue.issue)];
|
|
279
|
+
}
|
|
280
|
+
if (Predicate.isTagged(issue, "Composite") || Predicate.isTagged(issue, "AnyOf")) {
|
|
281
|
+
return issue.issues.length === 0 ? [] : configurationPath(issue.issues[0]);
|
|
282
|
+
}
|
|
283
|
+
if (Predicate.isTagged(issue, "Filter") || Predicate.isTagged(issue, "Encoding")) {
|
|
284
|
+
return configurationPath(issue.issue);
|
|
285
|
+
}
|
|
286
|
+
return [];
|
|
287
|
+
};
|
|
288
|
+
const configurationField = (issue) => {
|
|
289
|
+
const path = configurationPath(issue);
|
|
290
|
+
return path.length === 0 ? "options" : path.map(String).join(".");
|
|
291
|
+
};
|
|
292
|
+
const decodeConfig = (options) => Effect.suspend(() => {
|
|
293
|
+
const { caller: _caller, volume: _volume, policy: _policy, peer: _peer, allowNonLoopback: _allowNonLoopback, acceptedFlavors: _acceptedFlavors, ...supplied } = options;
|
|
294
|
+
const suppliedLimits = supplied.limits;
|
|
295
|
+
const limits = suppliedLimits === undefined
|
|
296
|
+
? NfsServerLimits.default
|
|
297
|
+
: Predicate.isObject(suppliedLimits)
|
|
298
|
+
? { ...NfsServerLimits.default, ...suppliedLimits }
|
|
299
|
+
: suppliedLimits;
|
|
300
|
+
return Schema.decodeUnknownResult(NfsServerConfig, { onExcessProperty: "error" })({
|
|
301
|
+
...supplied,
|
|
302
|
+
leaseDurationSeconds: supplied.leaseDurationSeconds === undefined
|
|
303
|
+
? NfsServerConfig.default.leaseDurationSeconds
|
|
304
|
+
: supplied.leaseDurationSeconds,
|
|
305
|
+
callbackTimeoutSeconds: supplied.callbackTimeoutSeconds === undefined
|
|
306
|
+
? NfsServerConfig.default.callbackTimeoutSeconds
|
|
307
|
+
: supplied.callbackTimeoutSeconds,
|
|
308
|
+
limits
|
|
309
|
+
}).pipe(Result.mapError((error) => {
|
|
310
|
+
const option = configurationField(error.issue);
|
|
311
|
+
return configurationError(option, `Invalid NFS server configuration at ${option}`);
|
|
312
|
+
}), Result.match({ onFailure: Effect.fail, onSuccess: Effect.succeed }));
|
|
313
|
+
});
|
|
314
|
+
const make = (options) => Effect.gen(function* () {
|
|
315
|
+
const config = yield* decodeConfig(options);
|
|
316
|
+
const limits = config.limits;
|
|
317
|
+
const policy = options.policy;
|
|
318
|
+
const networked = policy !== undefined;
|
|
319
|
+
if (networked && !Predicate.isFunction(policy)) {
|
|
320
|
+
return yield* configurationError("policy", "policy must be a function");
|
|
321
|
+
}
|
|
322
|
+
if (networked === (options.caller !== undefined)) {
|
|
323
|
+
return yield* configurationError("options", "supply either caller or policy");
|
|
324
|
+
}
|
|
325
|
+
if (networked && !Effect.isEffect(options.peer)) {
|
|
326
|
+
return yield* configurationError("peer", "networked mode requires a peer resolver Effect");
|
|
327
|
+
}
|
|
328
|
+
if (!networked && (options.peer !== undefined || options.allowNonLoopback !== undefined || options.acceptedFlavors !== undefined)) {
|
|
329
|
+
return yield* configurationError("options", "networked options require a policy");
|
|
330
|
+
}
|
|
331
|
+
if (options.allowNonLoopback !== undefined && !options.allowNonLoopback) {
|
|
332
|
+
return yield* configurationError("allowNonLoopback", "expected true or omission");
|
|
333
|
+
}
|
|
334
|
+
const suppliedFlavors = networked ? options.acceptedFlavors ?? ["sys"] : ["sys", "none"];
|
|
335
|
+
if (!Array.isArray(suppliedFlavors) || suppliedFlavors.length === 0 ||
|
|
336
|
+
suppliedFlavors.some((flavor) => flavor !== "sys" && flavor !== "none") ||
|
|
337
|
+
new Set(suppliedFlavors).size !== suppliedFlavors.length)
|
|
338
|
+
return yield* configurationError("acceptedFlavors", "expected distinct sys or none flavors");
|
|
339
|
+
const acceptedFlavors = Object.freeze([...suppliedFlavors]);
|
|
340
|
+
const socketServer = yield* SocketServer.SocketServer;
|
|
341
|
+
const socketAddress = socketServer.address;
|
|
342
|
+
const address = yield* Schema.decodeEffect(NfsServerAddress)(Predicate.isTagged(socketAddress, "UnixPathAddress")
|
|
343
|
+
? { path: socketAddress.path }
|
|
344
|
+
: {
|
|
345
|
+
host: socketAddress.address.toString(),
|
|
346
|
+
port: socketAddress.port
|
|
347
|
+
}).pipe(Effect.mapError(() => configurationError("socketServer.address", "socket server must bind a TCP address or a UNIX-domain socket path")));
|
|
348
|
+
if ("host" in address && address.host !== "127.0.0.1" && address.host !== "::1") {
|
|
349
|
+
if (!networked)
|
|
350
|
+
return yield* configurationError("policy", "non-loopback binding requires a policy");
|
|
351
|
+
if (options.allowNonLoopback !== true) {
|
|
352
|
+
return yield* configurationError("allowNonLoopback", "non-loopback binding requires explicit opt-in");
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
const volumeCaller = yield* options.volume
|
|
356
|
+
.caller()
|
|
357
|
+
.pipe(Effect.mapError(() => configurationError("volume", "volume could not create a caller")));
|
|
358
|
+
if (options.caller !== undefined) {
|
|
359
|
+
const [volumeRoot, callerRoot] = yield* Effect.all([
|
|
360
|
+
volumeCaller.rootReference,
|
|
361
|
+
options.caller.rootReference
|
|
362
|
+
]).pipe(Effect.mapError(() => configurationError("caller", "caller must be open and belong to volume")));
|
|
363
|
+
if (volumeRoot !== callerRoot) {
|
|
364
|
+
return yield* configurationError("caller", "caller must belong to volume");
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
const crypto = yield* Crypto.Crypto;
|
|
368
|
+
const generation = yield* crypto.randomBytes(16).pipe(Effect.mapError((cause) => new NfsServerError({ cause })));
|
|
369
|
+
const identity = Result.getOrThrow(Encoding.decodeHex(options.volume.identity));
|
|
370
|
+
const storageGeneration = Result.getOrThrow(Encoding.decodeHex(options.volume.incarnation));
|
|
371
|
+
const export_ = makeExport(options.caller ?? volumeCaller, storageGeneration, limits, identity, options.volume);
|
|
372
|
+
const callers = new Map();
|
|
373
|
+
const callerFor = policy === undefined ?
|
|
374
|
+
undefined :
|
|
375
|
+
(call) => Effect.gen(function* () {
|
|
376
|
+
const peer = call.connection.peer;
|
|
377
|
+
if (peer === undefined)
|
|
378
|
+
return null;
|
|
379
|
+
const credential = Predicate.isTagged(call.credentials, "Sys")
|
|
380
|
+
? {
|
|
381
|
+
flavor: "sys",
|
|
382
|
+
uid: call.credentials.uid,
|
|
383
|
+
gid: call.credentials.gid,
|
|
384
|
+
groups: call.credentials.supplementaryGroups,
|
|
385
|
+
machineName: call.credentials.machineName
|
|
386
|
+
}
|
|
387
|
+
: { flavor: "none" };
|
|
388
|
+
if (!acceptedFlavors.includes(credential.flavor))
|
|
389
|
+
return null;
|
|
390
|
+
const mapped = yield* Effect.sync(() => {
|
|
391
|
+
try {
|
|
392
|
+
return policy({ credential, peer });
|
|
393
|
+
}
|
|
394
|
+
catch {
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
if (mapped === null || !Schema.is(Vfs.Identity)(mapped))
|
|
399
|
+
return null;
|
|
400
|
+
const key = [
|
|
401
|
+
mapped.uid,
|
|
402
|
+
mapped.gid,
|
|
403
|
+
mapped.privileged ? 1 : 0,
|
|
404
|
+
mapped.groups.length,
|
|
405
|
+
[...mapped.groups].sort((a, b) => a - b)
|
|
406
|
+
].flat().join(":");
|
|
407
|
+
const existing = callers.get(key);
|
|
408
|
+
if (existing !== undefined)
|
|
409
|
+
return existing;
|
|
410
|
+
if (callers.size >= limits.maxIdentities)
|
|
411
|
+
return null;
|
|
412
|
+
const created = yield* options.volume.caller({ identity: mapped }).pipe(Effect.orElseSucceed(() => null));
|
|
413
|
+
if (created !== null)
|
|
414
|
+
callers.set(key, created);
|
|
415
|
+
return created;
|
|
416
|
+
});
|
|
417
|
+
const handlerOptions = {
|
|
418
|
+
generation,
|
|
419
|
+
storageGeneration,
|
|
420
|
+
leaseDurationSeconds: config.leaseDurationSeconds,
|
|
421
|
+
callbackTimeout: Duration.seconds(config.callbackTimeoutSeconds),
|
|
422
|
+
limits,
|
|
423
|
+
securityFlavors: acceptedFlavors.map((flavor) => flavor === "sys" ? 1 : 0),
|
|
424
|
+
now: Date.now
|
|
425
|
+
};
|
|
426
|
+
const handler = yield* makeNfs4Handler(export_, callerFor === undefined ? handlerOptions : { ...handlerOptions, callerFor }).pipe(Effect.mapError((cause) => new NfsServerError({ cause })));
|
|
427
|
+
yield* startServer(socketServer, networked ? { limits, peer: options.peer } : { limits }, handler).pipe(Effect.mapError((cause) => new NfsServerError({ cause })));
|
|
428
|
+
return { address };
|
|
429
|
+
});
|
|
430
|
+
/**
|
|
431
|
+
* The running NFS server, exposing the address it bound to.
|
|
432
|
+
*
|
|
433
|
+
* @category services
|
|
434
|
+
* @since 0.1.0
|
|
435
|
+
*/
|
|
436
|
+
export class NfsServer extends Context.Service()("@effect-vfs/nfs/NfsServer") {
|
|
437
|
+
static make = make;
|
|
438
|
+
static layer = (options) => Layer.effect(this, make(options));
|
|
439
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,cAAc,gBAAgB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { VirtualFileSystem as Vfs } from "@effect-vfs/core";
|
|
2
|
+
import * as ByteSize from "effect/ByteSize";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
/** @internal */
|
|
5
|
+
export interface ExportLimits {
|
|
6
|
+
readonly maxFilehandles: number;
|
|
7
|
+
readonly maxNameBytes: ByteSize.ByteSize;
|
|
8
|
+
}
|
|
9
|
+
/** @internal */
|
|
10
|
+
export interface OpenedFile {
|
|
11
|
+
readonly handle: Vfs.FileHandle;
|
|
12
|
+
readonly close: Effect.Effect<void>;
|
|
13
|
+
}
|
|
14
|
+
/** @internal */
|
|
15
|
+
export interface NfsExport {
|
|
16
|
+
readonly capacity: Pick<Vfs.Volume, "limits" | "usage"> | undefined;
|
|
17
|
+
/** Selects a caller for one compound while retaining the export's filehandle registry. */
|
|
18
|
+
readonly withCaller: (caller: Vfs.Caller) => NfsExport;
|
|
19
|
+
readonly root: Effect.Effect<Vfs.ObjectReference, Vfs.FsError>;
|
|
20
|
+
readonly handleFor: (reference: Vfs.ObjectReference) => Effect.Effect<Uint8Array, ExportCapacityError>;
|
|
21
|
+
readonly resolve: (handle: Uint8Array) => Effect.Effect<Vfs.ObjectReference, InvalidFilehandleError>;
|
|
22
|
+
readonly observeMetadata: (reference: Vfs.ObjectReference) => Effect.Effect<Vfs.ObjectObservation<Vfs.Metadata>, Vfs.FsError>;
|
|
23
|
+
readonly observeDirectory: (reference: Vfs.ObjectReference) => Effect.Effect<Vfs.ObjectObservation<ReadonlyArray<Vfs.DirectoryEntry>>, Vfs.FsError>;
|
|
24
|
+
readonly lookup: (directory: Vfs.ObjectReference, name: Uint8Array) => Effect.Effect<Vfs.ObjectReference, Vfs.FsError | InvalidNameError>;
|
|
25
|
+
readonly parent: (directory: Vfs.ObjectReference) => Effect.Effect<Vfs.ObjectReference, Vfs.FsError>;
|
|
26
|
+
readonly readLink: (reference: Vfs.ObjectReference) => Effect.Effect<Uint8Array, Vfs.FsError>;
|
|
27
|
+
readonly mkdir: (directory: Vfs.ObjectReference, name: Uint8Array, settings?: Vfs.MkdirReferenceSettings) => Effect.Effect<Vfs.ReferenceEntryResult, Vfs.FsError | InvalidNameError | ExportCapacityError>;
|
|
28
|
+
readonly symlink: (target: Vfs.PathInput, directory: Vfs.ObjectReference, name: Uint8Array, settings?: Vfs.SymlinkReferenceSettings) => Effect.Effect<Vfs.ReferenceEntryResult, Vfs.FsError | InvalidNameError | ExportCapacityError>;
|
|
29
|
+
readonly link: Vfs.Caller["linkReference"];
|
|
30
|
+
readonly remove: Vfs.Caller["removeReference"];
|
|
31
|
+
readonly rename: Vfs.Caller["renameReference"];
|
|
32
|
+
readonly chmod: Vfs.Caller["chmodReference"];
|
|
33
|
+
readonly chown: Vfs.Caller["chownReference"];
|
|
34
|
+
readonly utimes: Vfs.Caller["utimesReference"];
|
|
35
|
+
readonly truncate: Vfs.Caller["truncateReference"];
|
|
36
|
+
readonly open: (reference: Vfs.ObjectReference, access?: Vfs.OpenReferenceSettings["access"]) => Effect.Effect<OpenedFile, Vfs.FsError>;
|
|
37
|
+
readonly openChild: (directory: Vfs.ObjectReference, name: Uint8Array, settings: Vfs.OpenChildReferenceSettings) => Effect.Effect<Vfs.OpenChildReferenceResult & {
|
|
38
|
+
readonly close: Effect.Effect<void>;
|
|
39
|
+
}, Vfs.FsError | InvalidNameError | ExportCapacityError>;
|
|
40
|
+
readonly fsid: readonly [bigint, bigint];
|
|
41
|
+
}
|
|
42
|
+
declare const ExportCapacityError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
43
|
+
readonly _tag: "ExportCapacityError";
|
|
44
|
+
} & Readonly<A>;
|
|
45
|
+
/** @internal */
|
|
46
|
+
export declare class ExportCapacityError extends ExportCapacityError_base<{
|
|
47
|
+
readonly detail: string;
|
|
48
|
+
}> {
|
|
49
|
+
constructor(message: string);
|
|
50
|
+
}
|
|
51
|
+
declare const InvalidFilehandleError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
52
|
+
readonly _tag: "InvalidFilehandleError";
|
|
53
|
+
} & Readonly<A>;
|
|
54
|
+
/** @internal */
|
|
55
|
+
export declare class InvalidFilehandleError extends InvalidFilehandleError_base<{
|
|
56
|
+
readonly reason: "Malformed" | "WrongGeneration" | "Stale" | "Unknown" | "Unavailable";
|
|
57
|
+
}> {
|
|
58
|
+
constructor(reason: "Malformed" | "WrongGeneration" | "Stale" | "Unknown" | "Unavailable");
|
|
59
|
+
}
|
|
60
|
+
/** @internal */
|
|
61
|
+
export type InvalidNameReason = "Empty" | "TooLong" | "ForbiddenByte" | "Encoding" | "Reserved";
|
|
62
|
+
declare const InvalidNameError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
63
|
+
readonly _tag: "InvalidNameError";
|
|
64
|
+
} & Readonly<A>;
|
|
65
|
+
/** @internal */
|
|
66
|
+
export declare class InvalidNameError extends InvalidNameError_base<{
|
|
67
|
+
readonly detail: string;
|
|
68
|
+
readonly reason: InvalidNameReason;
|
|
69
|
+
}> {
|
|
70
|
+
constructor(message: string, reason: InvalidNameReason);
|
|
71
|
+
}
|
|
72
|
+
/** @internal */
|
|
73
|
+
export declare const validateName: (bytes: Uint8Array, maxNameBytes: ByteSize.ByteSize) => string;
|
|
74
|
+
/** @internal */
|
|
75
|
+
export declare const makeExport: (caller: Vfs.Caller, generation: Uint8Array, limits: ExportLimits, identity?: Uint8Array, capacity?: Pick<Vfs.Volume, "limits" | "usage">) => NfsExport;
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/internal/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,IAAI,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAE3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAUvC,gBAAgB;AAChB,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAA;CACzC;AAED,gBAAgB;AAChB,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;CACpC;AAED,gBAAgB;AAChB,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,SAAS,CAAA;IACnE,0FAA0F;IAC1F,QAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,KAAK,SAAS,CAAA;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,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