Fork me on GitHub
#onyx
<
2019-11-01
>
Quest23:11:22

Question on onyx-datomic: I wrote a transactor function that asserts the stored version of an entity matches the input version directly before writing it. In case of race conditions on the same piece of data, this guarantees that only one write will occur. However, the onyx-datomic :write-datoms task will only allow a sequence of entity maps. Attempting to put [transactor-fn ...] in the transaction causes an Unfreezable type: exception to be thrown from nippy. My question: anyone see a way to still achieve this protection against race conditions? I could run the validation separately before emitting the entity map, but it still leaves a gap open. I'm sure there's also some way to modify onyx-datomic or write my own plugin, though I'm not currently familiar with its internals.