Skip to content

Commit b3dd34d

Browse files
committed
Rewrite to use "live" structs (#210)
1 parent 71d0c68 commit b3dd34d

27 files changed

+822
-697
lines changed

package-lock.json

Lines changed: 355 additions & 383 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"buffer": "^6.0.3",
7272
"eventemitter3": "^5.0.1",
7373
"kerium": "^1.3.2",
74+
"memium": "^0.1.10",
7475
"readable-stream": "^4.5.2",
7576
"utilium": "^2.2.3"
7677
},

scripts/typedoc-plugin.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/backends/port.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { Backend, FilesystemOf } from './backend.js';
99

1010
import { Errno, Exception, withErrno } from 'kerium';
1111
import { err, info } from 'kerium/log';
12-
import { pick, serialize } from 'utilium';
12+
import { pick } from 'utilium';
1313
import { resolveMountConfig } from '../config.js';
1414
import { FileSystem } from '../internal/filesystem.js';
1515
import { Inode } from '../internal/inode.js';
@@ -255,7 +255,8 @@ export class PortFS extends Async(FileSystem) {
255255
}
256256

257257
public async touch(path: string, metadata: InodeLike | Inode): Promise<void> {
258-
await this.rpc('touch', path, serialize(metadata instanceof Inode ? metadata : new Inode(metadata)));
258+
const inode = metadata instanceof Inode ? metadata : new Inode(metadata);
259+
await this.rpc('touch', path, new Uint8Array(inode.buffer, inode.byteOffset, inode.byteLength));
259260
}
260261

261262
public sync(path: string): Promise<void> {
@@ -320,8 +321,9 @@ export async function handleRequest(port: RPCPort, fs: FileSystem & { _descripto
320321
case 'mkdir': {
321322
__requestMethod<'stat' | 'createFile' | 'mkdir'>(request);
322323
// @ts-expect-error 2556
323-
const inode = await fs[request.method](...request.args);
324-
value = serialize(inode instanceof Inode ? inode : new Inode(inode));
324+
const md = await fs[request.method](...request.args);
325+
const inode = md instanceof Inode ? md : new Inode(md);
326+
value = new Uint8Array(inode.buffer, inode.byteOffset, inode.byteLength);
325327
break;
326328
}
327329
case 'touch': {

0 commit comments

Comments
 (0)