mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-08 08:01:05 -05:00
dev(puterfs): move get_recursive_size to extension
This commit is contained in:
@@ -531,15 +531,13 @@ module.exports = class FSNodeContext {
|
||||
* already fetched.
|
||||
*/
|
||||
async fetchSize() {
|
||||
const { fsEntryService } = Context.get('services').values;
|
||||
|
||||
// we already have the size for files
|
||||
if ( ! this.entry.is_dir ) {
|
||||
await this.fetchEntry();
|
||||
return this.entry.size;
|
||||
}
|
||||
|
||||
this.entry.size = await fsEntryService.get_recursive_size(this.entry.uuid);
|
||||
this.entry.size = await this.provider.get_recursive_size({ node: this });
|
||||
|
||||
return this.entry.size;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2024-present Puter Technologies Inc.
|
||||
*
|
||||
*
|
||||
* This file is part of Puter.
|
||||
*
|
||||
*
|
||||
* Puter is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@@ -35,6 +35,7 @@ const capabilityNames = [
|
||||
'copy-tree',
|
||||
'move-tree',
|
||||
'remove-tree',
|
||||
'get-recursive-size',
|
||||
|
||||
// Behavior Capabilities
|
||||
'case-sensitive',
|
||||
|
||||
@@ -108,7 +108,7 @@ class SizeService extends BaseService {
|
||||
let sz;
|
||||
if ( node.entry.is_dir ) {
|
||||
if ( node.entry.uuid ) {
|
||||
sz = await fsEntryService.get_recursive_size(node.entry.uuid);
|
||||
sz = await node.fetchSize();
|
||||
} else {
|
||||
// very unlikely, but a warning is better than a throw right now
|
||||
// TODO: remove this once we're sure this is never hit
|
||||
|
||||
Reference in New Issue
Block a user