-
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
Refactor replication API #184
Conversation
Codecov Report
@@ Coverage Diff @@
## main #184 +/- ##
==========================================
+ Coverage 90.58% 93.60% +3.01%
==========================================
Files 43 42 -1
Lines 2986 3142 +156
==========================================
+ Hits 2705 2941 +236
+ Misses 281 201 -80
Continue to review full report at Codecov.
|
7ac6ab4
to
aa89e56
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.
This looks great to me, nice refactoring 🌟
I like entry_encoded
=> entry
and operation_encoded
=> operation
a LOT!
I had a couple of comments, one of which I have fix with a commit. I'll raise issues for the other two.
.map(|entry_and_operation| { | ||
// Unwrap as the entry was already validated before it entered the database | ||
// | ||
// @TODO: Is there a more efficient way than decoding the entry to access |
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.
Yes! You can use entry_and_operation.seq_num()
;-p
Right now, that actually just decodes the entry under-the-hood... but that is because we have a rather inefficient implementation of AsStorageEntry
which we can improve later with a small amount of effort.
// The test runner creates a test entry for us, we can retreive the public key from the | ||
// author | ||
let public_key: Author = db | ||
.test_data | ||
.key_pairs | ||
.first() | ||
.unwrap() | ||
.public_key() | ||
.to_owned() | ||
.try_into() | ||
.unwrap(); |
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.
This is so ugly... 🤣 I think we need some more conversion traits for Author
.
1da94dc
to
464716f
Compare
* main: Update CHANGELOG.md Refactor replication API (#184) GraphQL replication client (#137) Update aquadoggo to v0.3.0 in aquadoggo_cli v0.3.0 Prepare CHANGELOG for v0.3.0 release Commit Cargo.lock p2panda-rs v0.4.0 Remove unused import Update naming in `publishEntry` query and `nextEntryArgs` response (#181) Fix bug when materialising documents containing (non-existent) pinned relations (#177) Logging in reduce task (#175) Refactor test db creation (#176)
* schema-provider: Minor clean ups Move to unreleased section in CHANGELOG Update CHANGELOG.md Refactor replication API (#184) GraphQL replication client (#137) Update aquadoggo to v0.3.0 in aquadoggo_cli v0.3.0 Prepare CHANGELOG for v0.3.0 release Commit Cargo.lock p2panda-rs v0.4.0 Remove unused import Update naming in `publishEntry` query and `nextEntryArgs` response (#181) Fix bug when materialising documents containing (non-existent) pinned relations (#177)
This PR refactors the Replication API:
EntryArgsRequest
andPublishEntryRequest
intodb
module as it is more a struct used to query the database than an actual GraphQL thingContext
:ReplicationContext
has been removed in favor of accessing already existingSqlStorage
graphql-client
with simplergql-client
, removes need of external.graphql
files,bin
generator and auto-generated typesautomock
by replacing it withrstest
mocking approachreplication
as they should be used both byclient
andreplication
LogId
andSeqNum
as strings are moved directly next to the regarding scalar implementationsDepends on #137
Closing #180 and #182 and #120
📋 Checklist
CHANGELOG.md