Liking cljdoc? Tell your friends :D

eva.v2.transaction-pipeline.resolve.ids

Contains the logic for three major chunks of work in the transaction pipeline:

  1. Resolve the unique-attribute-merging problem that arises from unique identity semantics.
  2. Resolve temporary ids into permanent ids.
  3. Eliminate redundant Adds or Retracts in tx-data.
Contains the logic for three major chunks of work in the transaction pipeline:
1. Resolve the unique-attribute-merging problem that arises from unique identity semantics.
2. Resolve temporary ids into permanent ids.
3. Eliminate redundant Adds or Retracts in tx-data.
raw docstring

->aliases-functionclj

(->aliases-function db aliases-atom)
source

batch-prune-superfluousclj

(batch-prune-superfluous db tx-data)
source

build-required-equivalencesclj

(build-required-equivalences db name-ccs)
(build-required-equivalences db res name-cc)
source

derive-aliasesclj

(derive-aliases db tx-data)

Given the TxData, derive the entity ids that must be equivalent to yield a valid database state. Returns a map: {:equivalences [#{ent-ids-that-must-be-merged}] :aliases {ent-id --> exemplar-id-under-equivalences}}

Given the TxData, derive the entity ids that must
be equivalent to yield a valid database state.
Returns a map:
{:equivalences [#{ent-ids-that-must-be-merged}]
 :aliases      {ent-id --> exemplar-id-under-equivalences}}
sourceraw docstring

eliminate-redundancyclj

(eliminate-redundancy report)

Eliminate all tx-data that are redundant with the current state of the database. Will also add any implicit retractions required on cardinality one attributes.

Eliminate all tx-data that are redundant with the current state of
the database. Will also add any implicit retractions required on
cardinality one attributes.
sourceraw docstring

prune-cardinality-manyclj

(prune-cardinality-many db tx-data)

Given the subset of tx-data where every Add or Retract is on a card many attribute, returns a new collection of tx-data where commands redundant with the current state of the database have been replaced with nil.

Commands that are not spurious are wrapped in a vector to match the contract for prune-cardinality-one.

Given the subset of tx-data where every Add or Retract is on a card many
attribute, returns a new collection of tx-data where commands redundant with
the current state of the database have been replaced with nil.

Commands that are *not* spurious are wrapped in a vector to match the
contract for prune-cardinality-one.
sourceraw docstring

prune-cardinality-oneclj

(prune-cardinality-one db tx-data)

Given the subset of tx-data where every Add or Retract is on a card one attribute, returns a new collection of tx-data where commands redundant with the current state of the database have been replaced with nil and makes the set of implicit retractions on extant entity+attributes explicit.

Returns a collection of nils and vectors of commands: [nil [[:db/add ...]] [[:db/add e a v1] [:db/retract e a v0]]]

Given the subset of tx-data where every Add or Retract is on a card one
attribute, returns a new collection of tx-data where commands redundant with
the current state of the database have been replaced with nil and makes the
set of implicit retractions on extant entity+attributes explicit.

Returns a collection of nils and vectors of commands:
[nil [[:db/add ...]] [[:db/add e a v1] [:db/retract e a v0]]]
sourceraw docstring

resolve-idsclj

(resolve-ids report)
source

resolve-lookup-refsclj

(resolve-lookup-refs db tx-report)

Finds all entities in (:tx-data report) which are lookup refs (i.e. pairs [uniq-attr-id value]) and resolves them to entity id. Returns modified report with all lookup refs resolved: {:tx-data [... {:e [uniq-attr-1 value-1] :a a1 :v v1} {:e e2 :a a2 :v [uniq-attr-2 value-2]} ....]} replaced with resolved entity ids: {:tx-data [... {:e e1 :a a1 :v v1} {:e e2 :a a2 :v v2} ....]} Note: Replacements happen either at entities position or values position, and do not happen in attribute position. The are couple reasons for this: Datomic doc is not consistent about lookup refs at attribute position - they are allowed for list commands and are not allowed for maps. Also making attribute dependent on some value is kind of 'dispatching' attribute by value which is (advanced?) technique with not very clear purpose.

Finds all entities in (:tx-data report) which are lookup refs (i.e. pairs [uniq-attr-id value])
and resolves them to entity id.
Returns modified report with all lookup refs resolved:
{:tx-data [...
          {:e [uniq-attr-1 value-1] :a a1 :v v1}
          {:e e2 :a a2 :v [uniq-attr-2 value-2]}
          ....]}
replaced with resolved entity ids:
{:tx-data [...
          {:e e1 :a a1 :v v1}
          {:e e2 :a a2 :v v2}
          ....]}
Note: Replacements happen either at entities position or values position, and do not happen in attribute position.
      The are couple reasons for this: Datomic doc is not consistent about lookup refs at attribute position - they
      are allowed for list commands and are not allowed for maps. Also making attribute dependent on some value
      is kind of 'dispatching' attribute by value which is (advanced?) technique with not very clear purpose.
sourceraw docstring

transform-idsclj

(transform-ids resolve-aliases cmd)
source

validate-unique-value-semanticsclj

(validate-unique-value-semantics name-cc)

Attempts to assert a new tempid with a unique value already in the database will cause an Exception instead of merging.

Attempts to assert a new tempid with a unique value already in the database will cause an Exception instead of merging.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close