-
Notifications
You must be signed in to change notification settings - Fork 105
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
Event and Records Subscriptions #607
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #607 +/- ##
==========================================
- Coverage 98.83% 98.54% -0.29%
==========================================
Files 71 78 +7
Lines 9255 10253 +998
Branches 1391 1506 +115
==========================================
+ Hits 9147 10104 +957
- Misses 100 140 +40
- Partials 8 9 +1 ☔ View full report in Codecov by Sentry. |
61dac9b
to
5d3671c
Compare
7df607b
to
eab1545
Compare
abb43b3
to
4da1a3c
Compare
Co-authored-by: Liran Cohen <[email protected]> Co-authored-by: Andor Kesselman <[email protected]> Date: Thu Dec 21 12:34:36 2023 -0500
…et becomes a thing
2b23061
to
f49e516
Compare
"type": "object", | ||
"additionalProperties": false, | ||
"required": [ | ||
"descriptor" |
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.
Sanity: authorization
is required also no?
"type": "object", | ||
"additionalProperties": false, | ||
"required": [ | ||
"descriptor" |
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.
Sanity: authorization
is required also no?
Working off of the work @andorsk put in for Subscriptions, #508.
I re-worked it to match our current scopes and the way we handle permissions.
This PR adds 2 new interfaces
EventsSubscribe
andRecordsSubscribe
.EventsSubscribe
will follow the current authorization forEventsGet
and the one that is coming forEventsQuery
, that is only tenant is currently authorized for it, without any grants/delegation. This will come in a separate PR.RecordsSubscribe
follows the authorization/delegation rules fromRecordsQuery
at the moment, and builds up match filters for theEventStream
in the same way that it builds up filters for theMessageStore
when retrieving messages.There are still many missing tests, I am considering moving some of the tests from
RecordsQuery
into scenario testing where we can test both Query and Subscribe together.Some things to note:
Current approach for re-authorization are TTL based to re-authorize the original subscription message, in a future PR we could purge the subscription upon receipt of a
PermissionsRevoke
or aRecordsDelete
associated with a protocol role. I am open to ripping out re-authorization completely from this PR in favor of doing that approach in a subsequent PR.Also I overloaded the the
subscribe
method on the interface in order to be able to have more defined behaviors and objects around the individual types of subscriptions. I'm personally 50/50 on keeping this abstraction as they are very similar. The only difference currently is that theRecordsSubscribe
handler will type the messages it produces as eitherRecordsWriteMessage
orRecordsDeleteMessage
where as theEventsSubscribe
will emit aGenericMessage
.