ioxiocom / firedantic

Database models for Firestore using Pydantic base models.
BSD 3-Clause "New" or "Revised" License
45 stars 13 forks source link

Integrated support for locking #19

Closed joakimnordling closed 1 year ago

joakimnordling commented 3 years ago

Would be nice to have support for locking to prevent race conditions when loading and modifying models.

This could likely be done somewhat similar to how it's done in arangodantic, that implements lock_and_load, lock_and_reload, reload and get_lock methods on the model class.

Arangodantic uses Shylock for managing the locks. It does not yet have support for firedantic, but could easily be extended with support for it.

lietu commented 1 year ago

In case of Firestore the common practice is using transactions as requested in https://github.com/ioxiocom/firedantic/issues/36 - closing this in favor of that one.