2.0.0 #209
james-pre
announced in
Announcements
2.0.0
#209
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
2.0 is finally here! The main reason for a semver-major release is that a lot of cleanup was needed that involved breaking changes (like removing deprecated APIs). This release does include some big features though!
How many downloads?
Before getting into the details of this release, I wanted to thank the users of ZenFS. ZenFS and Utilium have now received over 1,000,000 downloads (yes, one million). I'm proud of what ZenFS has matured into, and I couldn't have done this without the community. So, thank you all for supporting the project, even if just by downloading it.
Extended attributes / xattr
This release adds full support for extended attributes (a.k.a xattr), which behave the same as on Linux. Node.js doesn't even have an API for this yet! This allows you to store arbitrary metadata on files, though a limit of 1 KiB per attribute value is imposed for performance and sanity. Like Linux, xattr names are namespaced— you will need to use the
usernamespace. See #189 for the initial issue.ioctland inode flagsWith the new
ioctlandioctlSyncfunctions, you can do a few cool things:1. Inode flags
Using the
IOC.GetFlagsandIOC.SetFlagscommands, the flags on an file can be changed. At the moment, these are the flags that affect VFS behavior:NoAtime: When set, theatimeof files will not be updated. This replaces the experimentaldisableUpdateOnReadconfiguration flag.Sync: When set, files will be synced to the file system immediately following any changes. This is off by default, meaning any changes will only be synced once the file is closed. This replaces the experimentalonlySyncOnCloseconfiguration flag.These flags are currently only available on a per-file basis, though support for FS-wide flags will likely be added to
mountin a minor release in the near future.2. File "versions"
IOC.GetVersionandIOC.SetVersionmanipulate theversionfield of inodes. While this field isn't used internally, it could be useful for some use cases— go crazy!3. File system commands
Note
Other than
IOC.GetLabel/IOC.SetLabel, the FS-levelioctlcommands only exist for completeness and should not be used.IOC.GetLabelandIOC.SetLabelcan be used to read and write the label of a file system.IOC.GetUUIDwill retrieve the UUID of a file system. At the moment, each file system instance is assigned a random UUID when instantiated. OnlySingleBufferpersists the UUID.IOC.GetSysfsPathjust gives you/sys/fs/${fs.name}/${fs.uuid}.sysfsis very complicated and has not be implemented.IOC.GetXattr/IOC.SetXattrare not related to extend attributes. These are for working with astruct fsxattr. This structure has not been fully implemented, you should not use it.As of this release, there is not mechanism for file systems to register
ioctlcommand handlers. This is planned for a future minor release.Contexts
This release makes contexts more powerful by introducing context
ids,parent/childrentracking, context-dependent working directories, and context-dependent file descriptors. The exportedboundContextsMapcan be used to access all of the bound contexts (a notable use case is /proc). You can create a child of aBoundContextusing itsbindmethod.Also, this release fixed
CredentialsInitnot being plural, improves the types ofBoundContext, and changeschrootto always be in-place and perform more anti-escape checks.mountsis no longer accessible on thefsnamespace export, since this could be used to escape a context.Internally, a "default" context is used for unbound operations. This absorbs the old "default"/unbound credentials.
Internal API changes: metadata, synchronization, and files
This release significantly improves how metadata and synchronization is handled internally.
Fileclass has been completely absorbed into the VFS. This comes with some nice performance and maintainability benefits. You can look atSyncHandlefor the synchronous logic fromFile.idproperty ofFileSystemhas been renamed totype, since it is used to identify the class rather than the instance, which was ambiguous.touchmethod has been added toFileSystem.touchonly updates metadata. All of the internal metadata updates now go through this new method.FileSystem.syncno longer takes any parameters. It is a no-op for current backends, though it can likely be used as a barrier for asynchronous operations in the future.InodeLikeorInodeinstead ofStatsLike.ctimeis now changed automatically.createFileandmkdirmethods ofFileSystemhave had theirmodeparameter merged intoCreationOptions. (PureCreationOptionshas been removed).hasAccessfunction, so permissions can be checked without copying an inode and creating a newStatsinstance, significantly improving performance.Configuration and logging
typeof an option is now supported.MountConfigurationused for a backend is now passed to that backend'sisAvailablefunction. (resolveMountConfigdoesn't pass configuration toisAvailable#196)type.Configuration.logis no longer experimental.log.fancyfor more information.Other changes
readLinesmethod ofFileHandlehas finally been implemented. This actually involved implementing most of thenode:readlinemodule, which can be imported from@zenfs/core/readline.js.src/vfs/path.tshas been moved tosrc/path.ts. You can import from@zenfs/core/path.js.s).Deviceinode data can now be customized by the device driver.ReadStream. (Fix: _read method is now only called by Readable class #193)Portbackend has been consolidated intosrc/backends/port.ts.Passthroughis no longer normalized. (PassthroughFSpath resolution incorrect on Windows #203)vfs/config.tsfor performance.SingleBuffer. (SingleBuffer: Add missing offset toMetadataBlockconstuctor #205, thanks @tbrockman)symlinkSyncnot closing the file it opened.statSync.Porthas been refactored.encode/decode``UTF8/Rawfunctions andConcretetype have been moved to Utilium.This discussion was created from the release 2.0.0.
Beta Was this translation helpful? Give feedback.
All reactions