From 2728761d3cc19b31f902c82158bee641b71b919f Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Mon, 30 Dec 2024 15:52:10 -0500 Subject: [PATCH] dev: remove unnecessary filesystem methods These used to serve a purpose but now they only cause a dependency loop between LL*/HL* operations and FilesystemService itself, making it difficult to strategize filesystem behavior. --- .../src/filesystem/FilesystemService.js | 31 ------------------- .../src/filesystem/hl_operations/hl_copy.js | 3 +- .../src/filesystem/hl_operations/hl_mkdir.js | 10 ++++-- .../src/filesystem/hl_operations/hl_write.js | 7 +++-- 4 files changed, 14 insertions(+), 37 deletions(-) diff --git a/src/backend/src/filesystem/FilesystemService.js b/src/backend/src/filesystem/FilesystemService.js index 11ea3f11..e6e2cdf4 100644 --- a/src/backend/src/filesystem/FilesystemService.js +++ b/src/backend/src/filesystem/FilesystemService.js @@ -174,32 +174,6 @@ class FilesystemService extends BaseService { return this.systemfs_; } - // NOTE: these are the parameters being passed - // (assuming this comment is up-to-date) - // { - // node, actor, immutable, - // file, tmp, fsentry_tmp, - // message, - // } - async owrite (parameters) { - const ll_owrite = new LLOWrite(); - return await ll_owrite.run(parameters); - } - - // REMINDER: There was an idea that FilesystemService implements - // an interface, and if that ever happens these arguments are - // important: - // parent, name, user, immutable, file, message - async cwrite (parameters) { - const ll_cwrite = new LLCWrite(); - return await ll_cwrite.run(parameters); - } - - async mkdir_2 ({parent, name, actor, immutable}) { - const ll_mkdir = new LLMkdir(); - return await ll_mkdir.run({ parent, name, actor, immutable }); - } - async mkshortcut ({ parent, name, user, target }) { // Access Control @@ -335,11 +309,6 @@ class FilesystemService extends BaseService { return node; } - async copy_2 (...a) { - const ll_copy = new LLCopy(); - return await ll_copy.run(...a); - } - async update_child_paths (old_path, new_path, user_id) { const svc_performanceMonitor = this.services.get('performance-monitor'); const monitor = svc_performanceMonitor.createContext('update_child_paths'); diff --git a/src/backend/src/filesystem/hl_operations/hl_copy.js b/src/backend/src/filesystem/hl_operations/hl_copy.js index d882e62f..a32b1ecf 100644 --- a/src/backend/src/filesystem/hl_operations/hl_copy.js +++ b/src/backend/src/filesystem/hl_operations/hl_copy.js @@ -206,7 +206,8 @@ class HLCopy extends HLFilesystemOperation { } } - this.copied = await fs.copy_2({ + const ll_copy = new LLCopy(); + this.copied = await ll_copy.run({ source, parent, user: values.user, diff --git a/src/backend/src/filesystem/hl_operations/hl_mkdir.js b/src/backend/src/filesystem/hl_operations/hl_mkdir.js index 7f3e4877..e978e103 100644 --- a/src/backend/src/filesystem/hl_operations/hl_mkdir.js +++ b/src/backend/src/filesystem/hl_operations/hl_mkdir.js @@ -31,6 +31,7 @@ const { OtelFeature } = require('../../traits/OtelFeature'); const { HLFilesystemOperation } = require('./definitions'); const { is_valid_path } = require('../validation'); const { HLRemove } = require('./hl_remove'); +const { LLMkdir } = require('../ll_operations/ll_mkdir'); class MkTree extends HLFilesystemOperation { static DESCRIPTION = ` @@ -142,7 +143,8 @@ class MkTree extends HLFilesystemOperation { const currentParent = current; current = new NodeChildSelector(current, dir); - const node = await fs.mkdir_2({ + const ll_mkdir = new LLMkdir(); + const node = await ll_mkdir.run({ parent: await fs.node(currentParent), name: current.name, actor, @@ -201,7 +203,8 @@ class QuickMkdir extends HLFilesystemOperation { const currentParent = current; current = new NodeChildSelector(current, dir); - const node = await fs.mkdir_2({ + const ll_mkdir = new LLMkdir(); + const node = await ll_mkdir.run({ parent: await fs.node(currentParent), name: current.name, actor, @@ -358,7 +361,8 @@ class HLMkdir extends HLFilesystemOperation { return await this.created.getSafeEntry(); } - this.created = await fs.mkdir_2({ + const ll_mkdir = new LLMkdir(); + this.created = await ll_mkdir.run({ parent: parent_node, name: target_basename, actor: values.actor, diff --git a/src/backend/src/filesystem/hl_operations/hl_write.js b/src/backend/src/filesystem/hl_operations/hl_write.js index 2801580c..cef28d2e 100644 --- a/src/backend/src/filesystem/hl_operations/hl_write.js +++ b/src/backend/src/filesystem/hl_operations/hl_write.js @@ -32,6 +32,7 @@ const { is_valid_node_name } = require("../validation"); const { HLFilesystemOperation } = require("./definitions"); const { MkTree } = require("./hl_mkdir"); const { Actor } = require("../../services/auth/Actor"); +const { LLCWrite, LLOWrite } = require("../ll_operations/ll_write"); class WriteCommonFeature { install_in_instance (instance) { @@ -381,7 +382,8 @@ class HLWrite extends HLFilesystemOperation { } if ( is_overwrite ) { - this.written = await fs.owrite({ + const ll_owrite = new LLOWrite(); + this.written = await ll_owrite.run({ node: destination, actor: values.actor, file: values.file, @@ -396,7 +398,8 @@ class HLWrite extends HLFilesystemOperation { message: values.message, }); } else { - this.written = await fs.cwrite({ + const ll_cwrite = new LLCWrite(); + this.written = await ll_cwrite.run({ parent, name: target_name, actor: values.actor,