-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement reduce
and dependency
task logic
#144
Conversation
reduce_task
reduce_task
reduce_task
Codecov Report
@@ Coverage Diff @@
## development #144 +/- ##
===============================================
+ Coverage 87.63% 88.59% +0.95%
===============================================
Files 42 42
Lines 2055 2280 +225
===============================================
+ Hits 1801 2020 +219
- Misses 254 260 +6
Continue to review full report at Codecov.
|
reduce_task
reduce
and dependency
task logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just writing some comments while we're going as I was very curious 🤩
This is really really really beautiful, the tasks are so small and powerful!
The error handling is funny as we probably end up only having one critical error type or There could be two approaches to the semantics of the return values:
.. or:
|
Thanks for all the comments @adzialocha! I will make those changes. When you have time, you can also look over the dependency task logic. It seems a little more nuanced than I originally imagined. The current logic is:
"parent dependency" = a document relating to the document being processed by the task |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't reflected yet on the new schema store in this context but I think we currently don't need a schema task with this db layout.
I'd add it as soon as we build the service 👍
For now we can build the schema through schema store on every request. That's naive of course but it will be fine for now!
Later we can add the schema service which will be used to query schema instances in memory (as a caching layer), it will be populated during node startup and filled with new schemas in a schema task (only if the wanted schema was missing during startup). Later we can deprecate / delete schemas in the task when the related document got deleted.
Yep, that makes sense.
Cool, this is what I imagined we'd be doing as well 👍 |
This looks really close to the specification we have in the Whimsical 👍 except of this one point where I would expect this to dispatch a |
5ce599f
to
a1e0e16
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some documentation for the dependency task, I think the same could be very helpful for the reducer (but dinner is ready so I stop now ;) ). The control flow is quite deeply nested with multiple matches. Flattening that out would probably help make this maintainable.
Overall this is good to go though :)
Thanks for the review @cafca, I improved the docs and did a little flattening, I like it! Think I covered everything now. |
c94379d
to
ba3d649
Compare
Alright! I did some crazy rebase-kung-fu and now this is ready for merging into |
Thanks! That's great 👍 for some reason I thought @cafca 's comment was about the dependency task.... |
* development: (42 commits) Implement `reduce` and `dependency` task logic (#144) Send published entries to materializer (#161) Updates for use of `VerifiedOperation` (#158) A backlink is not a skiplink (#163) Update README.md Remove clippy warnings Update `p2panda-rs` API & refactor tests (#147) fmt Rename `ES` generic type param to `EntryStore` Add better instructions for regenerating the schema file. Rename `skiplinks` to `certificate_pool` and regen schema Use cafca's wording for error message. Fix typo Target p2panda main (#142) Fix a clipp warn clippy --fix Add rt-multi-thread tokio feature to fix build of dump_schema Fix naming of param in SingleEntryAndPayload Add docstring to the `AliasedAuthor` type. Fix import order of tests ...
reduce
document_id
document_view_id
dependency
retrieve relation graph from db (including parent and children)check child pinned relations are materialisedreduce
tasks for every missing child dependency📋 Checklist
CHANGELOG.md