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

Option to not use sync cache with Async(FileSystem) #64

Closed
atty303 opened this issue May 19, 2024 · 6 comments
Closed

Option to not use sync cache with Async(FileSystem) #64

atty303 opened this issue May 19, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@atty303
Copy link
Contributor

atty303 commented May 19, 2024

I've decided to use only the Async API in my integration with Emscripten, so I no longer need crossCopy when using Async(FileSystem).
I thought it would be nice to have an option to not use crossCopy or the memory mirror itself in such cases.

@dr-vortex dr-vortex added the enhancement New feature or request label May 19, 2024
@dr-vortex
Copy link
Member

The idea behind having all async file systems use Async, and the sync. cache, is that fs.*Sync work no matter what. Perhaps a top-level configuration option would be best:

await configure({
	disableAsyncCache: true,
	mounts: {
		...
	}
})

What do you think?

@dr-vortex dr-vortex self-assigned this May 19, 2024
@dr-vortex dr-vortex added this to the 1.0 milestone May 19, 2024
@dr-vortex
Copy link
Member

Like zen-fs/dom#12, this could be done using FileSystemMetadata. That would be more flexible.

@dr-vortex
Copy link
Member

@atty303 Does v0.12.1 resolve the issue?

You should be able to set disableAsyncCache per backend and overall:

await configure({
	disableAsyncCache: true,
	mounts: {
		// this mount will have the sync cache
		'/mnt/net/example': {
			backend: Fetch,
			index: 'https://example.com/index.json',
			disableAsyncCache: false, 
		},
		// this mount will not have the sync cache
		'/mnt/emscripten': { backend: Emscripten, /* Should be published soon */ },
		// this mount will not have the sync cache
		'/mnt/worker/0': { backend: Port, port: worker0 },
		// this mount will not have the sync cache
		'/mnt/worker/1': { backend: Port, port: worker1 },
	}
});

@dr-vortex dr-vortex changed the title I want an option to not crossCopy when ready with FS that inherits Async(FileSystem) Option to not use sync cache with Async(FileSystem) May 19, 2024
@dr-vortex
Copy link
Member

Unit tests confirm that this is working correctly, so I am closing the issue.

@atty303
Copy link
Contributor Author

atty303 commented May 21, 2024

Sorry for the delay.
My app requires ZipFS to start and ZipFS is not yet synced with 0.12.1 so I cannot check. So we will wait for the ZipFS update.
Thank you in advance for your help.

@dr-vortex
Copy link
Member

@atty303 My apologies, I had not released the Zip updates yet. @zenfs/zip v0.4.0 should be up to date.

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

No branches or pull requests

2 participants