Fork me on GitHub
#datomic
<
2018-04-20
>
caleb.macdonaldblack00:04:52

@brnbraga95 You make updates using database functions. For example if you had a like counter you would read the current like count, increment its value and then set the new value. During the time that you read the value, 10 other clients may have as well and they all right the outdated value plus 1. That means you’re not guaranteed to get all 10 increments. If you use a database function though, you are asking datomic to stop processing any new transactions for a sec. During this time you read the like count, increment it and transact it. If 10 clients try to do this at the same time the must wait their turn as there is only one write transactor and it will only process one transaction at a time.

brunobraga01:04:01

correct me if I am wrong but, is not that just a lock?

chris_johnson03:04:40

Take a look at https://docs.datomic.com/cloud/best.html#optimistic-concurrency to see what (I believe) Caleb means by > You make updates using database functions

stuarthalloway17:04:30

@brnbraga95 no lock is needed. Datomic is a single writer system, so there is nobody else to lock out https://docs.datomic.com/cloud/transactions/acid.html#sec-3