+str Add isEnqueued method to QueueOfferResult. (#31242)

This commit is contained in:
kerr 2022-03-17 18:24:02 +08:00 committed by GitHub
parent 00745b30e3
commit 15c9cc0543
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 5 deletions

View file

@ -0,0 +1 @@
ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.stream.QueueOfferResult.isEnqueued")

View file

@ -10,7 +10,13 @@ import akka.annotation.DoNotInherit
* Not for user extension * Not for user extension
*/ */
@DoNotInherit @DoNotInherit
sealed abstract class QueueOfferResult sealed abstract class QueueOfferResult {
/**
* Return ture if the element was already enqueued, otherwise false.
* */
def isEnqueued: Boolean
}
/** /**
* Not for user extension * Not for user extension
@ -26,7 +32,9 @@ object QueueOfferResult {
/** /**
* Type is used to indicate that stream is successfully enqueued an element * Type is used to indicate that stream is successfully enqueued an element
*/ */
case object Enqueued extends QueueOfferResult case object Enqueued extends QueueOfferResult {
override def isEnqueued: Boolean = true
}
/** /**
* Java API: The `Enqueued` singleton instance * Java API: The `Enqueued` singleton instance
@ -36,7 +44,9 @@ object QueueOfferResult {
/** /**
* Type is used to indicate that stream is dropped an element * Type is used to indicate that stream is dropped an element
*/ */
case object Dropped extends QueueOfferResult case object Dropped extends QueueOfferResult {
override def isEnqueued: Boolean = false
}
/** /**
* Java API: The `Dropped` singleton instance * Java API: The `Dropped` singleton instance
@ -47,10 +57,14 @@ object QueueOfferResult {
* Type is used to indicate that stream is failed before or during call to the stream * Type is used to indicate that stream is failed before or during call to the stream
* @param cause - exception that stream failed with * @param cause - exception that stream failed with
*/ */
final case class Failure(cause: Throwable) extends QueueCompletionResult final case class Failure(cause: Throwable) extends QueueCompletionResult {
override def isEnqueued: Boolean = false
}
/** /**
* Type is used to indicate that stream is completed before call * Type is used to indicate that stream is completed before call
*/ */
case object QueueClosed extends QueueCompletionResult case object QueueClosed extends QueueCompletionResult {
override def isEnqueued: Boolean = false
}
} }