+str #20795 IOResult construction exposed, in bincompat way (#21070)

* +str #20795 IOResult construction exposed, in bincompat way

Thanks https://github.com/ktoso/kaze-class ;)

* Addressed feedback in IOResult

* Update IOResult.scala

* Update IOResult.scala
This commit is contained in:
Konrad Malawski 2016-10-24 17:00:51 +02:00 committed by GitHub
parent 101772fb8c
commit bcf4de5b2c
2 changed files with 19 additions and 1 deletions

View file

@ -12,7 +12,10 @@ import scala.util.{ Failure, Success, Try }
* @param count Numeric value depending on context, for example IO operations performed or bytes processed.
* @param status Status of the result. Can be either [[akka.Done]] or an exception.
*/
final case class IOResult private[stream] (count: Long, status: Try[Done]) {
final case class IOResult(count: Long, status: Try[Done]) {
def withCount(value: Long): IOResult = copy(count = value)
def withStatus(value: Try[Done]): IOResult = copy(status = value)
/**
* Java API: Numeric value depending on context, for example IO operations performed or bytes processed.
@ -34,3 +37,14 @@ final case class IOResult private[stream] (count: Long, status: Try[Done]) {
}
}
object IOResult {
/** JAVA API: Creates successful IOResult */
def createSuccessful(count: Long): IOResult =
new IOResult(count, Success(Done))
/** JAVA API: Creates failed IOResult, `count` should be the number of bytes (or other unit, please document in your APIs) processed before failing */
def createFailed(count: Long, ex: Throwable): IOResult =
new IOResult(count, Failure(ex))
}

View file

@ -998,6 +998,10 @@ object MiMa extends AutoPlugin {
// #21330 takeWhile inclusive flag
ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.stream.scaladsl.FlowOps.takeWhile")
),
"2.4.11" -> Seq(
// #20795 IOResult construction exposed
ProblemFilters.exclude[MissingTypesProblem]("akka.stream.IOResult$")
)
)
}