-
Notifications
You must be signed in to change notification settings - Fork 157
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
Persistence API: add CurrentLastSequenceNumberByPersistenceIdQuery #1773
base: main
Are you sure you want to change the base?
Changes from 3 commits
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,36 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.pekko.persistence.query.javadsl | ||
|
||
import java.util.Optional | ||
import java.util.concurrent.CompletionStage | ||
|
||
/** | ||
* A trait that enables querying the current last known sequence number for a given `persistenceId`. | ||
* @since 1.2.0 | ||
*/ | ||
trait CurrentLastKnownSequenceNumberByPersistenceIdQuery extends ReadJournal { | ||
|
||
/** | ||
* Returns the last known sequence number for the given `persistenceId`. Empty if the `persistenceId` is unknown. | ||
* | ||
* @param persistenceId The `persistenceId` for which the last known sequence number should be returned. | ||
* @return Some sequence number or None if the `persistenceId` is unknown. | ||
*/ | ||
def currentLastKnownSequenceNumberByPersistenceId(persistenceId: String): CompletionStage[Optional[java.lang.Long]] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.pekko.persistence.query.scaladsl | ||
|
||
import scala.concurrent.Future | ||
|
||
/** | ||
* A trait that enables querying the current last known sequence number for a given `persistenceId`. | ||
* @since 1.2.0 | ||
*/ | ||
trait CurrentLastKnownSequenceNumberByPersistenceIdQuery extends ReadJournal { | ||
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.
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. Just to highlight the intent behind the 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. I just think the name is too long, maybe 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. How about dropping the 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. Would CurrentLastSequenceNumberQuery work? 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. I think |
||
|
||
/** | ||
* Returns the last known sequence number for the given `persistenceId`. Empty if the `persistenceId` is unknown. | ||
* | ||
* @param persistenceId The `persistenceId` for which the last known sequence number should be returned. | ||
* @return Some sequence number or None if the `persistenceId` is unknown. | ||
*/ | ||
def currentLastKnownSequenceNumberByPersistenceId(persistenceId: String): Future[Option[Long]] | ||
} |
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.
Optional should use
the value is absent
instead ofEmpty
?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 think 'empty' makes since this is the terminology used by scala.Option and java Optional.