blaze
blaze copied to clipboard
Implement Conditional References
Conditional references are relevant in #359 and #361. Especially since #361 currently only works if no other resource refers to a conditional created resource in the same transaction bundle.
For resources that contain conditional references, that references have to be resolved at transaction processing time. However in Blaze, resource contents are put in the resource store before the transaction processing occurs. Because resource contents are immutable, we can't update them with resolved references. Instead we have to store the resolved references in the index database and replace them every time a resource is used.
In addition to that reference resolution, we have to add index entries for the resolved references. That also means that the index process will have three phases instead of the current two phases. Currently we index the resource content that is independent of the transaction in the first phase followed by the transaction dependent indices. With this issue we will add a third index phase that indexes resolved references.
Transaction Handling
On Receiving Node
Transaction Bundle
|
V
Node x
|
V
ID genration for all POST Requests
|
V
Static Reference Resolution
|
V
Calculate Resource Content Hashes
|
V
Store Resource Contents into Resource Store
|
V
Put Transaction Commands into TX-Log
On All Nodes
Receive Transaction Data (List of Transaction Commands, T) | V Index all Resources according to enabled search params in parallel -> Index Entries with Hashes | V Transaction Processing -> Index Entries with T
On All Nodes - New
Receive Transaction Data (List of Transaction Commands, T) | V Transaction Processing -> Index Entries with T + Reference Mapping | V Resource Content Update according to Reference Mapping + Deletion of Non-Used Resources | V Calculate Resource Content Hashes of Updated Resources | V Store Updated Resource Contents into Resource Store | V Update Hashes in Index Entries with T | V Index all Resources according to enabled search params in parallel -> Index Entries with Hashes
Static Reference Resolution
- takes place before the tranaction processing
- looks only at the transaction bundle and not into the DB