mimblewimble / grin-wallet

Grin Wallet
Apache License 2.0
182 stars 133 forks source link

Storage: implement read/write locks for calls to the LMDB backend #148

Open chisa0a opened 5 years ago

chisa0a commented 5 years ago

Possibly related to grin/issue#2868, only one caller should have write access to the wallet db at once. If possible, multiple readers can be allowed with a read-write lock.

This would eliminate implementer/users needing to be concerned with the warning about single-access during check_restore. With a read-write lock, write calls will need to wait on the lock, but multiple reader calls can be made simultaneously.

Another possibility (discussed with @bladedoyle and @DavidBurkett on gitter) is to implement a file-based lock that is acquired by check_restore, disallowing access by any other callers.

bladedoyle commented 5 years ago

This may be related to wallet (non)locking: https://github.com/mimblewimble/grin/issues/2868

yeastplume commented 5 years ago

I think this may be desirable to do as part of #244, however there isn't currently any clean delineation in the code between what operations update and what operations just read. (All operations do a mix of both) I think it might be better to consider update/send/restore etc as atomic operations and put all other attempts to perform operations on hold until each is complete.

lehnberg commented 4 years ago

This has been de-scoped of 3.0.0 following dev meeting today.