Releases: zen-fs/core
1.9.0
Important
This release includes some big changes and has had over 100 hours of work.
Please read carefully, as changes to internal APIs could impact your use case(s).
Logging
Modeling after various Linux logging interfaces, the new log API is very useful. It uses the same log levels as syslog, and is designed to be flexible and work well with any use case. There are a few built-in formats.
The majority of internal errors are logged. Errors that should be handled by the user (e.g. ENOENT
when reading a file) are not logged. Additionally, deprecated functions and classes will log a deprecation warning.
The log is enabled by default. If you are working with resource constraints, you may want to disable logging since all entries are kept in memory. You could also periodically run log.entries.clear()
.
When using zenfs-test
, you can set the level needed for logs to be displayed using the --log
/-l
options. The default is CRIT
.
You can read more about logging in the documentation.
FileSystem
metadata
FileSystemMetadata
has been difficult to work with. It is computed every time it is fetched, damaging performance. This also has lead to numerous workarounds for its perceived immutability (e.g. _disableSync
).
This release deprecates FileSystemMetadata
, and introduces better designed and more intuitive ways to work with metadata:
-
attributes
is designed to keep track of simple values. This is analogous to options in /etc/fstab. At the moment, the built-in attributes are all booleans, which is indicated by avoid
type onFileSystemAttributes
. This is because the presence of the key is used rather than the value. For non-boolean types, you can useattributes
like a normalMap
. -
usage
returnsUsageInfo
, which is a subset ofFileSystemMetadata
. While the only file systems that return usable information for this are from@zenfs/archives
, there are plans to introduce usage information for many others. -
name
is for the name of the file system type. For example,tmpfs
is the name ofInMemory
. This is modeled afterfile_system_type->name
in Linux -
id
is a unique 32-bit unsigned integer for the type of file system. It is currently unused internally but may in the future (one compelling use case is to resolve collisions ofname
). This is primarily designed for users, for example it could be used for partition tables. -
label
is an optional field that is designed to be used with instances. This is the same as labels in the context of normal partitions and file systems.
Fetch
Fetch
received some much needed improvements. You can now use HTTP range requests (#53) and update the remote (#181). Note if your server supports being updated, you will almost certainly want to perform lots of authentication and value checking. Additionally, Fetch
is now tested with disableAsyncCache
, to make sure it will still work. Along with these change to Fetch
, IndexFS
has been refactored.
StoreFS
, Store
s, and Transaction
s
As many of you know, StoreFS
is used by many ZenFS backends (e.g. InMemory
and IndexedDB
). This release cleans up StoreFS
and the underlying stores and transactions.
StoreFS
now builds an ino lookup table when initialized.- This significantly improves performance after initialization, especially for stores that are slow (e.g.
IndexedDB
). - The old behavior is no longer available, but could be in a future release if desirable
- This significantly improves performance after initialization, especially for stores that are slow (e.g.
- Fixed
write
failing if the file didn't already exist read
will no longer read data when the requested length is0
- It still checks for file existence and gets metadata
StoreFS
can now allocate new IDs for inodes and data in constant time instead of the previous O(n)- Removed the
type
parameter fromcommitNew
andcommitNewSync
For stores and transactions:
- Renamed
Simple*
toMap*
(e.g.SimpleTransaction
toMapTransaction
) for clarification - Added caching to
AsyncTransaction
, which makes implementing an async backend even easier- Implementors: You will need to make sure you update the cache properly.
- This also includes a new interface,
AsyncStore
- Extracted the transaction rollback capabilities into
WrappedTransaction
, a new internal class used to abstract the "raw" transaction.- Removed the
commit
,abort
, and[Symbol.dispose]
properties fromTransaction
, along with their synchronous variants
- Removed the
- Removed
keysSync
fromTransaction
, since it isn't used internally. - The
Transaction
methodsget
andgetSync
can now returnundefined
- This should happen when no data is available, rather than throwing an
ENOENT
/ENODATA
- Error throwing for missing data is now done by
StoreFS
- This should happen when no data is available, rather than throwing an
- Deprecated the
Store
methodsclear
andclearSync
since they aren't used
Miscellaneous
- Move raw test data from being inlined into files
- Cleaned up
fs.promises.watch
- Fixed
FSWatcher
not respecting context when added towatchers
- Fixed
emitChange
from within context (#167) - Correctly labeled
emitChange
as internal and hidden - Moved the
FileContents
type to vfs/types.ts zenfs-test
setup files can now be skipped.- You can prefix the filename with
_
- You can prefix the filename with
- Added a deadlock canary to context test
- Fixed
PassthroughFS.readSync
- Consolidated
Port
test suites into a single file - Added
copySync
andcopyAsync
functions for tests
Internal API organization
The various internal APIs have all been moved into the src/internal
directory. Please make sure to update any imports you have.
1.8.8
1.8.7
1.8.6
1.8.5
1.8.4
1.8.3
1.8.2
1.8.1
Note
This release includes a bug fix that is a breaking change
- Moved over
LazyFile
OverlayFS
no longer uses a mutex- Improved
FSRequest
types inPort
- Fixed
PortFS.read
buffer transfer issues - Implemented
readSync
andwriteSync
onAsync
- Added
growBuffer
- Changed from
ArrayBuffer.slice
toArrayBuffer.subarray
(performance) - Fixed
LazyFile.write
and.writeSync
using an incorrect position - Added
DeviceDriver.readD
andDeviceDriver.writeD
- Deprecated
DeviceDriver.read
and.write
- Added documentation to new
FileSystem
methods - Fixed
FileSystem.read
and.readSync
not having a buffer parameter (breaking) Passthrough.sync
and.syncSync
now sync some stats- The
Inode
constructor now accepts a partialInodeLike
Readonly
now throwsEROFS
onwrite
and `writeSync
1.8.0
- Added
LazyFile
- This is not used at the moment by any backends, though it will in a future release
- Added
FileSystem.read
andFileSystem.write
- Added
StatsCommon.toJSON
- Reduce default max byte length to 1 MiB (#168)
- Added
FileReadResult
type that uses built-inArrayBufferView
- Removed
PortFile
,file
RPC, and RPC scopes - Fixed
StoreFS.loadIndex
(+Sync
) not committing the transaction - Fixed files trying to call
FileSystem.sync
on read-only file systems - Reworked
Port
error passing - Changed the default value of
length
inFile.read
andFile.write
(+Sync
)- From
this.stats.size
tobuffer.byteLength - offset
- This now has the same behavior as the relevant Node.js APIs
- From
- Fixed
PreloadFile
's handling of a buffer and stats size mismatch PortFS.sync
now converts metadata to a plain object- Fixed
PortFile.read
not copying to buffer - Changed
utimes
to use numbers internally - Tweaked
Fetch.baseUrl
trailing slash behavior - Fixed backend options type checking
- Changed
FetchFS
to extendStoreFS
- Added
StoreFS
methods for working withIndex
:loadIndex
loadIndexSync
toIndex
toIndexSync
- Deprecated
IndexFS
- You can use
StoreFS
and callloadIndex
/loadIndexSync
with your index
- You can use
- Changed inode and data IDs from
bigint
tonumber
- Rewrote
Index
andIndexFS
to be read/write - Added
while
canaries- This should prevent any infinite locks due to
while
loops
- This should prevent any infinite locks due to
- Fixed
StoreFS
not using creation options - Improved internal
_open
options - Added directory file type checks
- Added
PureCreationOptions
Testing:
- Updated the
npm test
script - Improved
Fetch
testing StoreFS
usingIndex
is now run through the full FS test suitePort
(includingAsync
) is now run through the full FS test suite- Removed
Async
-specific common test suite - Simplified temporary coverage directory removal
- Failing tests will now give an exit code of 1
- Reduced tests
wait
times zenfs-test
s output is now much prettier. It has colors and fancy formatting and such.- Added
zenfs-test
flags:--clean
will remove cached coverage data--report
will report any cached coverage data, then remove it--preserve
will run tests but will not remove the coverage data or report on it
- Deprecated APIs are no longer considered when calculating coverage
- CI/CD tests now display output about test suites