mirror of
https://github.com/appy-one/acebase.git
synced 2026-05-24 22:01:13 -06:00
[PR #199] [CLOSED] Feature: db file locking #163
Labels
No labels
IndexedDB
browser
bug
dependencies
documentation
duplicate
enhancement
feature request
indexes
indexes
invalid
pull-request
query
question
transaction logging
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/acebase#163
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/appy-one/acebase/pull/199
Author: @appy-one
Created: 1/1/2023
Status: ❌ Closed
Base:
master← Head:feature/db-file-locking📝 Commits (8)
2bfedb0implemented file locking to battle #48f0082a7use newretryutility functiona63ab71Useassertfunction instead ofconsole.assert211b092using new Api event emitter instead of callbackb09cad1fix compile error0867f6fuse new api event emitter instead of callbackc8f5fa5Implemented db file locking for #486c32671added file locking unit test📊 Changes
10 files changed (+661 additions, -166 deletions)
View changed files
📝
src/acebase-local.ts(+3 -3)📝
src/api-local.ts(+4 -3)📝
src/data-index/data-index.ts(+8 -17)📝
src/promise-fs/index.ts(+15 -0)➕
src/retry.ts(+57 -0)➕
src/storage/binary/error.ts(+5 -0)📝
src/storage/binary/index.ts(+147 -142)➕
src/storage/binary/lockfile.LICENSE(+23 -0)➕
src/storage/binary/lockfile.ts(+371 -0)📝
src/test/constructor.spec.ts(+28 -1)📄 Description
(H)appy new year! 🍾🥂
This PR helps preventing database corruption #48 by disallowing multiple processes to access the same database file simultaneously, unless they are using IPC for inter-process communication. This means that forked processes with pm2 or NodeJS clustering, or servers using acebase-ipc-server can still all access the database simultaneously, but all other processes that try to open an already open db will be denied access.
For its implementation I have modified proper-lockfile instead of adding it as a dependency for the following reasons:
I changed the following:
signal-exitdependency (not needed)retrydependency (using own simple implementation)graceful-fsdependency (using own pfs)requires
acebase-core #29to be merged, dependency updated🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.