Skip to content

Commit 3f7c0d4

Browse files
committed
chore: console.log to console.info
1 parent 7a2f2f1 commit 3f7c0d4

31 files changed

+46
-33
lines changed

packages/fuse-client/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,20 @@ export class FuseClient {
9797
this.unmountFS(mountPath);
9898
throw err;
9999
}
100-
console.log("filesystem mounted on " + mountPath);
100+
console.info("filesystem mounted on " + mountPath);
101101
}
102102
);
103103
}
104104

105105
unmountFS(mountPath: string) {
106106
fuse.unmount(mountPath, (err) => {
107107
if (err) {
108-
console.log(
108+
console.info(
109109
"filesystem at " + mountPath + " not unmounted",
110110
err.toString()
111111
);
112112
} else {
113-
console.log("filesystem at " + mountPath + " unmounted");
113+
console.info("filesystem at " + mountPath + " unmounted");
114114
}
115115
});
116116
}

packages/fuse-client/syscalls/access.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const access: (backend: SQLiteBackend) => MountOptions["access"] = (
55
backend
66
) => {
77
return async (path, mode, cb) => {
8-
console.log("access(%s, %d)", path, mode);
8+
console.info("access(%s, %d)", path, mode);
99
cb(0);
1010
};
1111
};

packages/fuse-client/syscalls/chmod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const chmod: (backend: SQLiteBackend) => MountOptions["chmod"] = (
77
backend
88
) => {
99
return async (path, mode, cb) => {
10-
console.log("chmod(%s, %d)", path, mode);
10+
console.info("chmod(%s, %d)", path, mode);
1111
const r = await backend.updateMode(path, mode);
1212
match(r)
1313
.with({ status: "ok" }, () => {

packages/fuse-client/syscalls/chown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const chown: (backend: SQLiteBackend) => MountOptions["chown"] = (
55
backend
66
) => {
77
return async (path, uid, gid, cb) => {
8-
console.log("chown(%s, %d, %d)", path, uid, gid);
8+
console.info("chown(%s, %d, %d)", path, uid, gid);
99
cb(0);
1010
};
1111
};

packages/fuse-client/syscalls/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const create: (backend: SQLiteBackend) => MountOptions["create"] = (
55
backend
66
) => {
77
return async (path, mode, cb) => {
8-
console.log("create(%s, %d)", path, mode);
8+
console.info("create(%s, %d)", path, mode);
99

1010
//@ts-expect-error fix types
1111
const context = fuse.context();

packages/fuse-client/syscalls/destroy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const destroy: (backend: SQLiteBackend) => MountOptions["destroy"] = (
55
backend
66
) => {
77
return async (cb) => {
8-
console.log("destroy");
8+
console.info("destroy");
99
cb(0);
1010
};
1111
};

packages/fuse-client/syscalls/fgetattr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const fgetattr: (backend: SQLiteBackend) => MountOptions["fgetattr"] = (
66
backend
77
) => {
88
return async (path, fd, cb) => {
9-
console.log("fgetattr(%s, %d)", path, fd);
9+
console.info("fgetattr -> getattr(%s, %d)", path, fd);
1010
//@ts-expect-error fix types
1111
// TODO: implement fgetattr properly
1212
getattr(backend)?.(path, cb);

packages/fuse-client/syscalls/flush.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const flush: (backend: SQLiteBackend) => MountOptions["flush"] = (
55
backend
66
) => {
77
return async (path, fd, cb) => {
8-
console.log("flush(%s, %d)", path, fd);
8+
console.info("flush(%s, %d)", path, fd);
99
await backend.flush(path);
1010
cb(0);
1111
};

packages/fuse-client/syscalls/fsync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const fsync: (backend: SQLiteBackend) => MountOptions["fsync"] = (
66
backend
77
) => {
88
return async (path, fd, datasync, cb) => {
9-
console.log("fsync(%s, %d, %d)", path, fd, datasync);
9+
console.info("fsync -> flush(%s, %d, %d)", path, fd, datasync);
1010
// @ts-expect-error TODO: implement fsync properly
1111
// We do buffered writes and flush flushes the buffer!
1212
// A program may not call flush but fsync without relenquishing fd (like SQLite)

packages/fuse-client/syscalls/fsyncdir.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const fsyncdir: (backend: SQLiteBackend) => MountOptions["fsyncdir"] = (
55
backend
66
) => {
77
return async (path, fd, datasync, cb) => {
8-
console.log("fsyncdir(%s, %d, %d)", path, fd, datasync);
8+
console.info("fsyncdir(%s, %d, %d)", path, fd, datasync);
99
cb(0);
1010
};
1111
};

packages/fuse-client/syscalls/ftruncate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const ftruncate: (
66
backend: SQLiteBackend
77
) => MountOptions["ftruncate"] = (backend) => {
88
return async (path, fd, size, cb) => {
9-
console.log("ftruncate(%s, %d, %d)", path, fd, size);
9+
console.info("ftruncate -> truncate(%s, %d, %d)", path, fd, size);
1010
//@ts-expect-error fix types
1111
// TODO: implement ftruncate properly
1212
truncate(backend)(path, size, cb);

packages/fuse-client/syscalls/getxattr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const getxattr: (backend: SQLiteBackend) => MountOptions["getxattr"] = (
55
backend
66
) => {
77
return async (path, name, buffer, length, offset, cb) => {
8-
console.log(
8+
console.info(
99
"getxattr(%s, %s, %o, %d, %d)",
1010
path,
1111
name,

packages/fuse-client/syscalls/listxattr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const listxattr: (
55
backend: SQLiteBackend
66
) => MountOptions["listxattr"] = (backend) => {
77
return async (path, buffer, length, cb) => {
8-
console.log("listxattr(%s, %d, %d)", path, buffer, length);
8+
console.info("listxattr(%s, %d, %d)", path, buffer, length);
99
cb(0, 0);
1010
};
1111
};

packages/fuse-client/syscalls/mkdir.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const mkdir: (backend: SQLiteBackend) => MountOptions["mkdir"] = (
55
backend
66
) => {
77
return async (filepath, mode, cb) => {
8-
console.log("mkdir(%s, %s)", filepath, mode);
8+
console.info("mkdir(%s, %s)", filepath, mode);
99
const filename = path.parse(filepath).base;
1010

1111
if (filename.length > 255) {

packages/fuse-client/syscalls/mknod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const mknod: (backend: SQLiteBackend) => MountOptions["mknod"] = (
66
backend
77
) => {
88
return async (path, mode, dev, cb) => {
9-
console.log("mknod(%s, %d, %d)", path, mode, dev);
9+
console.info("mknod -> create(%s, %d, %d)", path, mode, dev);
1010
//@ts-expect-error fix types
1111
// TODO: implement mknod properly
1212
create(backend)(path, mode, cb);

packages/fuse-client/syscalls/read.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const read: (backend: SQLiteBackend) => MountOptions["read"] = (
66
backend
77
) => {
88
return async (path, fd, buf, len, pos, cb) => {
9-
console.log("read(%s, %d, %d, %d)", path, fd, len, pos);
9+
console.info("read(%s, %d, %d, %d)", path, fd, len, pos);
1010
const r = await backend.getFileChunks(fd, pos, len);
1111
await match(r)
1212
.with({ status: "ok" }, async (r) => {

packages/fuse-client/syscalls/readdir.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const readdir: (backend: SQLiteBackend) => MountOptions["readdir"] = (
55
backend
66
) => {
77
return async (path, cb) => {
8-
console.log("readdir(%s)", path);
8+
console.info("readdir(%s)", path);
99

1010
// TODO: figure out how are these directories in output of ls -la
1111
const dotDirs = [".", ".."];

packages/fuse-client/syscalls/release.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const release: (backend: SQLiteBackend) => MountOptions["release"] = (
55
backend
66
) => {
77
return async (path, fd, cb) => {
8-
console.log("release(%s, %d)", path, fd);
8+
console.info("release(%s, %d)", path, fd);
99
cb(0);
1010
};
1111
};

packages/fuse-client/syscalls/releasedir.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const releasedir: (
55
backend: SQLiteBackend
66
) => MountOptions["releasedir"] = (backend) => {
77
return async (path, fd, cb) => {
8-
console.log("releasedir(%s, %d)", path, fd);
8+
console.info("releasedir(%s, %d)", path, fd);
99
cb(0);
1010
};
1111
};

packages/fuse-client/syscalls/removexattr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const removexattr: (
55
backend: SQLiteBackend
66
) => MountOptions["removexattr"] = (backend) => {
77
return async (path, name, cb) => {
8-
console.log("removexattr(%s, %s)", path, name);
8+
console.info("removexattr(%s, %s)", path, name);
99
cb(0);
1010
};
1111
};

packages/fuse-client/syscalls/rename.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ export const rename: (backend: SQLiteBackend) => MountOptions["rename"] = (
55
backend
66
) => {
77
return async (srcPath, destPath, cb) => {
8-
console.log("rename(%s, %s)", srcPath, destPath);
8+
console.info("rename(%s, %s)", srcPath, destPath);
99
const r = await backend.renameFile(srcPath, destPath);
1010
if (r.status === "ok") {
11-
console.log("rename(%s, %s)", srcPath, destPath);
1211
cb(0);
1312
} else {
1413
// TODO: can move fail, if yes, when?

packages/fuse-client/syscalls/rmdir.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const rmdir: (backend: SQLiteBackend) => MountOptions["rmdir"] = (
55
backend
66
) => {
77
return async (path, cb) => {
8-
console.log("rmdir(%s)", path);
8+
console.info("rmdir(%s)", path);
99
const r = await backend.deleteFile(path);
1010
match(r)
1111
.with({ status: "ok" }, (r) => {

packages/fuse-client/syscalls/setxattr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const setxattr: (backend: SQLiteBackend) => MountOptions["setxattr"] = (
55
backend
66
) => {
77
return async (path, name, buffer, length, offset, flags, cb) => {
8-
console.log(
8+
console.info(
99
"setxattr(%s, %s, %s, %d, %d, %d)",
1010
path,
1111
name,

packages/fuse-client/syscalls/statfs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const statfs: (backend: SQLiteBackend) => MountOptions["statfs"] = (
55
backend
66
) => {
77
return (path, cb) => {
8-
console.log("statfs(%s)", path);
8+
console.info("statfs(%s)", path);
99
// TODO: fill actual values, these are just placeholders
1010
cb(0, {
1111
bsize: 1000000, // Block size

packages/fuse-client/syscalls/truncate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const truncate: (backend: SQLiteBackend) => MountOptions["truncate"] = (
66
backend
77
) => {
88
return async (path, size, cb) => {
9-
console.log("truncate(%s, %d)", path, size);
9+
console.info("truncate(%s, %d)", path, size);
1010
const r = await backend.truncateFile(path, size);
1111
await match(r)
1212
.with({ status: "ok" }, async (r) => {

packages/fuse-client/syscalls/unlink.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const unlink: (backend: SQLiteBackend) => MountOptions["unlink"] = (
55
backend
66
) => {
77
return async (path, cb) => {
8-
console.log("unlink(%s)", path);
8+
console.info("unlink(%s)", path);
99
const r = await backend.deleteFile(path);
1010
if (r.status === "ok") {
1111
cb(0);

packages/fuse-client/syscalls/utimens.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const utimens: (backend: SQLiteBackend) => MountOptions["utimens"] = (
55
backend
66
) => {
77
return async (path, atime, mtime, cb) => {
8-
console.log("utimens(%s, %s, %s)", path, atime, mtime);
8+
console.info("utimens(%s, %s, %s)", path, atime, mtime);
99
try {
1010
await backend.updateTimes(path, atime, mtime);
1111
} catch (e) {

packages/fuse-client/syscalls/write.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const write: (backend: SQLiteBackend) => MountOptions["write"] = (
55
backend
66
) => {
77
return async (path, fd, buf, len, pos, cb) => {
8-
console.log("write(%s, %d, %d, %d)", path, fd, len, pos);
8+
console.info("write(%s, %d, %d, %d)", path, fd, len, pos);
99
const chunk = Buffer.from(buf, pos, len);
1010
// TODO: This may throw (because of flush!, what should happen then?)
1111
await backend.write(path, { content: chunk, offset: pos, size: len });

packages/sqlite-backend/WriteBuffer.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export class WriteBuffer<T> {
88
async write(item: T): Promise<void> {
99
this.buffer.push(item);
1010
if (this.buffer.length >= this.size) {
11+
console.info(
12+
`WriteBuffer.write: Flushing because buffer size exceeded the set limit of ${this.size}`
13+
);
1114
await this.flush();
1215
}
1316
// TODO: implement a time based flush, like, if there are no writes for 100ms
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
-- CreateTable
2+
DROP TABLE IF EXISTS "File";
23
CREATE TABLE "File" (
34
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
45
"type" TEXT NOT NULL,
@@ -7,14 +8,24 @@ CREATE TABLE "File" (
78
"name" TEXT NOT NULL,
89
"dir" TEXT NOT NULL,
910
"path" TEXT NOT NULL,
10-
"content" BLOB NOT NULL,
1111
"uid" INTEGER NOT NULL,
1212
"gid" INTEGER NOT NULL,
1313
"atime" DATETIME NOT NULL,
1414
"mtime" DATETIME NOT NULL,
1515
"ctime" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
1616
);
1717

18+
DROP TABLE IF EXISTS "Content";
19+
-- CreateTable
20+
CREATE TABLE "Content" (
21+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
22+
"content" BLOB NOT NULL,
23+
"offset" INTEGER NOT NULL,
24+
"size" INTEGER NOT NULL,
25+
"fileId" INTEGER NOT NULL,
26+
CONSTRAINT "Content_fileId_fkey" FOREIGN KEY ("fileId") REFERENCES "File" ("id") ON DELETE CASCADE ON UPDATE CASCADE
27+
);
28+
1829
-- CreateIndex
1930
CREATE UNIQUE INDEX "File_path_key" ON "File"("path");
2031

packages/zoid-fs-client/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const backend = await match(backendArg)
3636

3737
const fuseClient = new FuseClient(backend);
3838
setTimeout(async () => {
39-
console.log("mounting: fuse mount points");
39+
console.info("mounting: fuse mount points");
4040
fuseClient.mountFS(mountPathArg);
4141
}, 1000);
4242

0 commit comments

Comments
 (0)