Skip to content

Commit

Permalink
chore: update todos
Browse files Browse the repository at this point in the history
  • Loading branch information
divyenduz committed Nov 10, 2023
1 parent 53fe09d commit 6c67416
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 15 deletions.
1 change: 0 additions & 1 deletion packages/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type Result<T, K extends string = "file"> =
// TODO: bump this based on the latest state of the actual backend!

export interface Backend {
// TODO: use resule
getLinks: (dir: string) => Promise<Link[]>;
getLink: (dir: string) => Promise<Result<Link, "link">>;
getFile: (filepath: string) => Promise<Result<File>>;
Expand Down
9 changes: 4 additions & 5 deletions packages/fuse-client/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { SQLiteBackend } from "@zoid-fs/sqlite-backend";
// TODO: inline source as a package https://github.com/direktspeed/node-fuse-bindings
import fuse from "@zoid-fs/node-fuse-bindings";
import { rename } from "./syscalls/rename";
import { unlink } from "./syscalls/unlink";
Expand Down Expand Up @@ -83,14 +82,14 @@ export class FuseClient {
fsync: fsync(this.backend),
fsyncdir: fsyncdir(this.backend),
flush: flush(this.backend),
// lock: lock(this.backend), // TODO: implement in bindings
// bmap: bmap(this.backend), // TODO: implement in bindings
// lock: lock(this.backend), // Note: not implemented in bindings
// bmap: bmap(this.backend), // Note: not implemented in bindings
setxattr: setxattr(this.backend),
getxattr: getxattr(this.backend),
listxattr: listxattr(this.backend),
removexattr: removexattr(this.backend),
// ioctl: ioctl(this.backend), // TODO: implement in bindings
// poll: poll(this.backend), // TODO: implement in bindings
// ioctl: ioctl(this.backend), // Note: not implemented in bindings
// poll: poll(this.backend), // Note: not implemented in bindings
},
(err) => {
if (err) {
Expand Down
1 change: 0 additions & 1 deletion packages/fuse-client/syscalls/fgetattr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const fgetattr: (backend: SQLiteBackend) => MountOptions["fgetattr"] = (
return async (path, fd, cb) => {
console.info("fgetattr -> getattr(%s, %d)", path, fd);
//@ts-expect-error fix types
// TODO: implement fgetattr properly
getattr(backend)?.(path, cb);
};
};
10 changes: 6 additions & 4 deletions packages/fuse-client/syscalls/fsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ import { SQLiteBackend } from "@zoid-fs/sqlite-backend";
import { MountOptions } from "@zoid-fs/node-fuse-bindings";
import { flush } from "./flush";

/**
* We do buffered writes and flush flushes the buffer!
* A program may not call flush but fsync without relenquishing fd (like SQLite)
* In our case currently, the implementation of fsync and flush is same!
*/
export const fsync: (backend: SQLiteBackend) => MountOptions["fsync"] = (
backend
) => {
return async (path, fd, datasync, cb) => {
console.info("fsync -> flush(%s, %d, %d)", path, fd, datasync);
// @ts-expect-error TODO: implement fsync properly
// We do buffered writes and flush flushes the buffer!
// A program may not call flush but fsync without relenquishing fd (like SQLite)
// In our case currently, the implementation of fsync and flush is same!
// @ts-expect-error fix types
flush(backend)(path, fd, cb);
};
};
1 change: 0 additions & 1 deletion packages/fuse-client/syscalls/ftruncate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const ftruncate: (
return async (path, fd, size, cb) => {
console.info("ftruncate -> truncate(%s, %d, %d)", path, fd, size);
//@ts-expect-error fix types
// TODO: implement ftruncate properly
truncate(backend)(path, size, cb);
};
};
1 change: 0 additions & 1 deletion packages/fuse-client/syscalls/mknod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const mknod: (backend: SQLiteBackend) => MountOptions["mknod"] = (
return async (path, mode, dev, cb) => {
console.info("mknod -> create(%s, %d, %d)", path, mode, dev);
//@ts-expect-error fix types
// TODO: implement mknod properly
create(backend)(path, mode, cb);
};
};
2 changes: 0 additions & 2 deletions packages/fuse-client/syscalls/symlink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ export const symlink: (backend: SQLiteBackend) => MountOptions["symlink"] = (
const context = fuse.context();
const { uid, gid } = context;

// TODO: double check if mode for symlink is correct
// https://unix.stackexchange.com/questions/193465/what-file-mode-is-a-symlink
const r = await backend.createFile(
destPath,
"symlink",
Expand Down

0 comments on commit 6c67416

Please sign in to comment.