-
Notifications
You must be signed in to change notification settings - Fork 36
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
feat: Offset validation observer #1014
base: main
Are you sure you want to change the base?
Changes from all commits
3410fc0
6079852
b0ca096
5f54fc5
9bc647d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (C) 2023 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package akka.projection.r2dbc.internal | ||
|
||
import akka.annotation.DoNotInherit | ||
import akka.annotation.InternalStableApi | ||
|
||
@InternalStableApi | ||
object R2dbcOffsetValidationObserver { | ||
// effectively sealed, but to avoid translation the R2dbcOffsetStore.Validation extend this | ||
@DoNotInherit | ||
trait OffsetValidation | ||
|
||
object OffsetValidation { | ||
@DoNotInherit trait Accepted extends OffsetValidation | ||
@DoNotInherit trait Duplicate extends OffsetValidation | ||
@DoNotInherit trait Rejected extends OffsetValidation | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A thought: these could be public do-not-extend traits with the internal validation concrete adt types extending them so that no translation step is actually needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed in b0ca096 |
||
} | ||
|
||
/** | ||
* [[akka.projection.internal.Telemetry]] may implement this trait for offset validation progress tracking. | ||
*/ | ||
@InternalStableApi | ||
trait R2dbcOffsetValidationObserver { | ||
import R2dbcOffsetValidationObserver._ | ||
|
||
def onOffsetValidated[Envelope](envelope: Envelope, result: OffsetValidation): Unit | ||
|
||
} |
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.
Doesn't it need to be volatile or an atomic (or a copy method of some kind)?
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.
it's set once at startup, and as far as I can see it's not important if we would miss a few notifications. The purpose is not to track each and every offset, but see overall progress or what is going on. I can add a comment.