google/jimfs

Allow creation of Links from other File Systems

wodencafe opened this issue · 8 comments

Hi all, we are trying to use JimFS as a Virtual File System, using it to create a directory structure, and store Symbolic Links to Files that reside on other File Systems.

We work with very large files and don't have the memory capacity to store these files in memory unfortunately.

Trying to do this, we receive the error "path is not associated with a Jimfs file system"
at com.google.common.jimfs.JimfsFileSystemProvider.checkPath(JimfsFileSystemProvider.java:130)
at com.google.common.jimfs.JimfsFileSystemProvider.createLink(JimfsFileSystemProvider.java:231)
at java.nio.file.Files.createLink(Files.java:1086)

It's not terribly clear to me what it is you're asking here or what it is you expect jimfs to be doing in this situation. Do you expect it to throw an OutOfMemoryError, or to store the files on-disk of it overflows?

Oh apologies, I just reread your question/issue and I better understand now what you're requesting. :P

You want to be able to link from paths on a jimfs filesystem to paths on other filesystems, am I right?

@jbduncan Yes sir that is exactly what we want to be able to do.

We are storing large files, like multiple Gigabytes, and we want them to be accessible from JimFS with a Symbolic Link, but really reside on a Physical File System, in a different path.

Thank you for looking into this so quickly :)

While I think it could be interesting to create a FileSystem implementation that allows you to "mount" other file systems, or specific files/directories from other file systems, in its directory structure, that's not what Jimfs is and my feeling is that it wouldn't make sense to try to change it to support that.

Minor note: Files.createLink isn't for creating symbolic links (that's createSymbolicLink) but for creating hard links to other files in the same file system.

@cgdecker, are you the right person to ask questions regarding jimfs, and/or are you still acting as the de facto maintainer the project? If so, what do you think of this feature request?

Oops, ninja'd!

Ok thanks anyway, we will look for this functionality elsewhere.