Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not possible to implement custom FS due to lack of public FS API #481

Open
vitonsky opened this issue Dec 24, 2024 · 0 comments
Open

Not possible to implement custom FS due to lack of public FS API #481

vitonsky opened this issue Dec 24, 2024 · 0 comments

Comments

@vitonsky
Copy link

The problem

I trying to implement my own storage to keep data in RAM and efficient synchronization with encrypted file system.

I checked NodeFS implementation as reference for my own, but when i trying to implement it i have problem - some API has not been published.

For example, reference implementation have next code:

import { EmscriptenBuiltinFilesystem, PGDATA } from './base.js'
import type { PostgresMod } from '../postgresMod.js'

I trying to use PGDATA in my code too, but i can't found it as and some other API like EmscriptenBuiltinFilesystem or BaseFilesystem, since they are not public available.

See this example of nodefs.d.ts file from bundle:

image

Here import from chunk file with generated name, so end users can't guess this filename and entities names that are transformed too. Every new release such names may be changed and they have no types.

The solution

My proposal is to make FS API are public available for end users.

Specifically, import all entities that may be useful for implement custom FS. Also, add a minimal docs to explain some basic concepts end users need to know to implement custom FS well.

Use cases

My use case is i looking for an embedded DB that will keep all data in RAM, and will provide a ways to sync this data with encrypted FS that implemented by my application code.

I tried to use dumpDataDir + loadDataDir approach, but it does not work for me, since my application requires frequent synchronization for every single change in database, and in my tests this way with dumpDataDir + loadDataDir takes a seconds (2.3 seconds) that is unacceptable. The acceptable time for single sync is 10-100ms, but not more.

If you think i can improve performance with no custom FS, please tell about it. But keep in mind that we can't save any data directly at user file system, since it would be a security failure. We may interact only with virtual file system implemented by application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant