This breaks down reading and writing into low-level and high level sagas.
Opening now takes a lock on the file so that it can only have one writer
or have multiple readers. The low-level read and write sagas use the
file descriptor to determine if the file is still open before actually
performing the action.
Since we are using the web locks api, these locks should work across
browser tabs/windows.
The high-level read/write sagas perform the low-level open, read/write,
close operations in a single call.
The high-level delete and rename sagas are also updated to take locks
on the files while performing the respective operations and will fail
if the file is already being used somewhere else.
This changes how files work. There is now an open function that
translates a path to a file handle (id). Then this handle is used
to perform other actions on the file. The file contents are moved
to a separate table so that the actual file storage is independent
of the database (e.g. in the future, we may use File Access API).
We store a hash of the file contents in the metadata file so we can
detect file changes without having to compare file contents.
We also separate the change and add actions.
This will crash tests sooner and give a stack track at the crash point
instead of waiting the default 5 seconds for the entire test to timeout
(which doesn't give a stack trace of where the test was when it timed
out).
This uses the real rootReducer to populate the initial state in the test
AsyncSaga. This way we don't have to populate default values. Since it
isn't used often, we can omit the parameter and just call the updateState()
method after creating the object if modifications are needed.