mirror of
https://github.com/Nystik-gh/ignis.git
synced 2026-06-17 04:35:53 +00:00
minor refactor, cleanup
This commit is contained in:
@@ -1,17 +1,10 @@
|
||||
// Filesystem shim - the core piece
|
||||
// Returned for both require('original-fs') and require('fs')
|
||||
//
|
||||
// Strategy: metadata cache + on-demand content fetch + write-through
|
||||
// Server sync mechanism (REST vs WebSocket) is TBD - abstracted behind
|
||||
// the transport layer in ./transport.js
|
||||
|
||||
import { MetadataCache } from './metadata-cache.js';
|
||||
import { ContentCache } from './content-cache.js';
|
||||
import { transport } from './transport.js';
|
||||
import { createFsPromises } from './promises.js';
|
||||
import { createFsSync } from './sync.js';
|
||||
import { createFsWatch } from './watch.js';
|
||||
import { constants } from './constants.js';
|
||||
import { MetadataCache } from "./metadata-cache.js";
|
||||
import { ContentCache } from "./content-cache.js";
|
||||
import { transport } from "./transport.js";
|
||||
import { createFsPromises } from "./promises.js";
|
||||
import { createFsSync } from "./sync.js";
|
||||
import { createFsWatch } from "./watch.js";
|
||||
import { constants } from "./constants.js";
|
||||
|
||||
const metadataCache = new MetadataCache();
|
||||
const contentCache = new ContentCache();
|
||||
@@ -21,10 +14,8 @@ const fsSync = createFsSync(metadataCache, contentCache, transport);
|
||||
const fsWatch = createFsWatch(transport);
|
||||
|
||||
export const fsShim = {
|
||||
// Async promise-based API (this.fsPromises = this.fs.promises)
|
||||
promises: fsPromises,
|
||||
|
||||
// Sync methods
|
||||
existsSync: fsSync.existsSync,
|
||||
readFileSync: fsSync.readFileSync,
|
||||
writeFileSync: fsSync.writeFileSync,
|
||||
@@ -33,17 +24,12 @@ export const fsShim = {
|
||||
statSync: fsSync.statSync,
|
||||
readdirSync: fsSync.readdirSync,
|
||||
|
||||
// Watch
|
||||
watch: fsWatch.watch,
|
||||
|
||||
// Constants
|
||||
constants,
|
||||
|
||||
// Internal: for initialization
|
||||
_metadataCache: metadataCache,
|
||||
_contentCache: contentCache,
|
||||
|
||||
// Initialize the caches by fetching the full tree from server
|
||||
async _init(basePath) {
|
||||
const tree = await transport.fetchTree(basePath);
|
||||
metadataCache.populate(tree);
|
||||
|
||||
Reference in New Issue
Block a user