democracyworks / datomic-toolbox

Datomic Utility Library
19 stars 0 forks source link

Datomic transaction function #8

Closed danielglauser closed 9 years ago

danielglauser commented 9 years ago

In support of this research story we offer to you, the reader, our proof that Datomic transaction functions can be created that will change things atomically.

:transact:

Generally useful for setting values of all types and cardinalities using compare-and-swap semantics.

There are tests for the following:

:assert-empty:

Generally useful for asserting that something still doesn't exist. For instance, assuring the uniqueness of a particular entity. See election-notification-works, where we want at most one subscription per user.

:assert-not-empty:

Similarly useful for assuring that something still exists.

:assert-equal:

Assert that a constant value is equal to the value of an entities property.

All of the above functions were used to make election-notification-works subscriptions atomic.

Please have a look and @ericnormand and I know what you think.

You can install this branch locally (it has a unique version name) using lein install.

The transaction functions are installed generally after migrations are run during the initialize command.

ericnormand commented 9 years ago

Ping @tie-rack for suggestions.

ericnormand commented 9 years ago

Ping @tie-rack I updated the README. Anything else?

ericnormand commented 9 years ago

Ping @tie-rack . Anything left on this one?

tie-rack commented 9 years ago

You've got a LGTM (as long as you've seen this successfully work from within WildFly-deployed projects).

ericnormand commented 9 years ago

Thanks @tie-rack. It's now been tested in a kraken project using docker-compose up and krakenstein. It revealed bugs that were fixed.