You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, the new package only supports read-only filesystems, so a straight implementation of those interfaces won't necessarily make a lot of sense. However, I think that it does make sense to try to get the interfaces to match those in io/fs as much as possible. For example, Remote should probably implement fs.File, and possibly fs.FS as well. Similarly, while it will probably be a bit more awkward, it would be nice if FileSystem, Attachment, and File got changed to embed fs.FS and fs.File, with additions as necessary. Renaming some of them might make sense, too.
The text was updated successfully, but these errors were encountered:
Remote will implement fs.FS, fs.File, and fs.ReadDirFile. Walking will be handled entirely by Open(), and actually opening the file through 9P will be done lazily when Read() or Write() are called. Open() will have to be changed to return an fs.File instead of a *Remote directly, but it'll document that it's just a *Remote underneath, so anyone who's using it directly can just do an assertion.
On top of these changes, DirEntry will be changed to implement both fs.FileInfo and fs.DirEntry. It already mostly implements fs.FileInfo, so this change is fairly minor, but it will require the removal of FileMode in favor of fs.FileMode. This will probably have a couple of annoying edge-cases, but it should simplify things in the long-run.
This is slightly trickier. FileSystem is going to stay as it is, but be renamed to Attacher. Auth will become optional to implement via a second interface, Auther. Attacher.Attach(), meanwhile, will be changed to return an fs.FS. File and Attachment will be replaced with fs.File and fs.FS, respectively, with other functionality, such as writing, being relegated to optional interfaces.
An alternative is to provide a function which takes an fs.FS and returns a Attachment, making it relatively easy to just do this manually on the client's end and requiring far fewer changes internally.
See golang/go#41190 and the documentation.
Unfortunately, the new package only supports read-only filesystems, so a straight implementation of those interfaces won't necessarily make a lot of sense. However, I think that it does make sense to try to get the interfaces to match those in
io/fs
as much as possible. For example,Remote
should probably implementfs.File
, and possiblyfs.FS
as well. Similarly, while it will probably be a bit more awkward, it would be nice ifFileSystem
,Attachment
, andFile
got changed to embedfs.FS
andfs.File
, with additions as necessary. Renaming some of them might make sense, too.The text was updated successfully, but these errors were encountered: