Skip to content

Commit

Permalink
add some logging
Browse files Browse the repository at this point in the history
  • Loading branch information
williamstein committed Nov 15, 2023
1 parent 59c86ac commit ec88a3f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion websocketfs/lib/mount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ interface Options {
// Here all of mtime, atime, blocks, size are decimal numbers, which may have a fractional part,
// and mode is a string like in ls. E.g., this find command does it (ignoring hidden files)::
//
// find * -printf "%p\0%T@ %A@ %b %s %M\0\0" | lz4 > .meta.lz4 && mv .meta.lz4 > meta.lz4
// mkdir -p /tmp/meta; find * -printf "%p\0%T@ %A@ %b %s %M\0\0" | lz4 > .meta.lz4 && mv .meta.lz4 /tmp/meta/meta.lz4
//
// If metadataFile ends in .lz4 it is assumed to be lz4 compressed and gets automatically decompressed.
// If there are files metadataFile.patch.[n] (with n an integer), then they are diff-match-patch patches
Expand Down
4 changes: 3 additions & 1 deletion websocketfs/lib/sftp-fuse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ export default class SftpFuse {
// it hasn't changed so nothing to do
return;
}
const start = Date.now();
lastMtimeMs = mtimeMs;
let content = await readFile(metadataFile);
if (metadataFile.endsWith(".lz4")) {
Expand All @@ -185,6 +186,7 @@ export default class SftpFuse {
this.metadataFileContents = content.toString().split("\0\0");
this.metadataFileContents.sort();
lastSuccess = Date.now();
log("metadataFile: updated in ", Date.now() - start, "ms");
} catch (err) {
log(
"metadataFile: not reading -- ",
Expand Down Expand Up @@ -437,7 +439,6 @@ export default class SftpFuse {
) {
// we are using the metadata file cache instead of sftp to
// compute all file metadata.
const t = Date.now();
try {
let i = binarySearch(this.metadataFileContents, path, (value, find) => {
const path = "/" + value.split("\0")[0];
Expand All @@ -450,6 +451,7 @@ export default class SftpFuse {
return 0;
});
if (i != -1) {
log("readdir", path, " -- using metadataFile data");
const filenames: string[] = [];
const pathDir = path == "/" ? path : path + "/";
i += 1;
Expand Down
2 changes: 1 addition & 1 deletion websocketfs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "websocketfs",
"version": "0.11.0",
"version": "0.12.1",
"description": "Like sshfs, but over a WebSocket",
"main": "./dist/lib/index.js",
"scripts": {
Expand Down

0 comments on commit ec88a3f

Please sign in to comment.