Closed Ambrevar closed 1 year ago
Actually I wonder what the problem is with having multiple virtual-files share the same cache. I can't recall. Any idea @aartaka ?
The only application for virtual files that I can remember is user scripts. And in this scenario, file caching is actually useful, so it's bad it was turned off.
File paths are useful indeed, but why not use a regular nfiles:file
for that, not using it for anything else?
Beyond this use-case, I haven't used virtual files much, so not sure I have any stance on any question here (ノ ̄ー ̄)ノ
File paths are useful indeed, but why not use a regular
nfiles:file
for that, not using it for anything else?
The point of virtual files is to guarantee that no disk read / write will be done.
Can you explain how user scripts would benefit from caching? If they are virtual, means they don't need a path, right?
File paths are useful indeed, but why not use a regular
nfiles:file
for that, not using it for anything else?The point of virtual files is to guarantee that no disk read / write will be done.
Hmmmmmmm...
Can you explain how user scripts would benefit from caching? If they are virtual, means they don't need a path, right?
Use scripts that are virtual need to be fetched from the remote URL every time. If we cached them, that'd make for a much more stable and offline-friendly user script usage.
But then, yeah, if virtual-file
is for no read/write at all, then we should have some other thing for this use-case...
Use scripts that are virtual need to be fetched from the remote URL every time. If we cached them, that'd make for a much more stable and offline-friendly user script usage.
Wait, don't we also provide a file name for user scripts with URL so that they are saved to disk, to avoid re-fetching them next time?
Also I just checked the code:
(define-class user-script (renderer-user-script files:data-file nyxt-remote-file)
User scripts don't seem to be virtual.
Oh right, then it's irrelevant.
Just remembered why I made virtual-profile
return #p""
in https://github.com/atlas-engineer/nfiles/commit/bb3c5e67ca85921e9c9da807d5957363b8a276e8 : it's for files that use nfiles:expand
but for which reading and writing is done by a third party (like the WebKit files in Nyxt).
virtual-profile
, not for virtual-file
. The point was to have a single knob to disable reads and writes for the whole application.So the question is, how do we disable reads and writes for the whole application, even for files that use a third party? Maybe there is no good answer to this... @aartaka @aadcg @jmercouris
The functionality of emptying paths seems to belong to a profile, yes. And it seems to be the best way to disable writes at the level of application too.
We can resolve the file against another profile to find the actual path, no? Doesn't seems like a problem here. And third-party is third-party, we'll be writing wrappers for it anyway.
We can resolve the file against another profile to find the actual path, no?
Not directly, because the profile belongs to the nfile profile
slot. So nfile:expand
would not work.
But one could call nfile:resolve MY-PROFILE MY-FILE
where MY-FILE has a profile different from MY-PROFILE. That should work.
Fixed with #16.
In commit bb3c5e67ca85921e9c9da807d5957363b8a276e8 we've made viritual-files resolve to the empty path so that they don't use the cache.
Indeed, being in-memory data, there is no need for caching. Caching virtual files would mean that multiple instances would share the same data, which is not always wanted.
However, what's the point of virtual files, now? Previously, there were used solely for the dynamic path expansion capability of Nfiles (like Nyxt's config file). But now it seems that they have no feature at all!
I suggest we revert bb3c5e67ca85921e9c9da807d5957363b8a276e8 and find another way to (optionally?) disable the cache.
@aartaka ?