Include entries DData Gossip message dynamically based on size, #28421 (#29751)

This commit is contained in:
Patrik Nordwall 2020-11-16 12:00:16 +01:00 committed by GitHub
parent ac58f7d4ca
commit 4fa733c146
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 247 additions and 21 deletions

View file

@ -263,6 +263,9 @@ sealed abstract class VersionVector extends ReplicatedData with ReplicatedDataSe
override def pruningCleanup(removedNode: UniqueAddress): VersionVector
/** INTERNAL API */
@InternalApi private[akka] def estimatedSize: Int
}
final case class OneVersionVector private[akka] (node: UniqueAddress, version: Long) extends VersionVector {
@ -322,6 +325,10 @@ final case class OneVersionVector private[akka] (node: UniqueAddress, version: L
override def toString: String =
s"VersionVector($node -> $version)"
/** INTERNAL API */
@InternalApi override private[akka] def estimatedSize: Int =
EstimatedSize.UniqueAddress + EstimatedSize.LongValue
}
final case class ManyVersionVector(versions: TreeMap[UniqueAddress, Long]) extends VersionVector {
@ -389,4 +396,8 @@ final case class ManyVersionVector(versions: TreeMap[UniqueAddress, Long]) exten
override def toString: String =
versions.map { case ((n, v)) => n.toString + " -> " + v }.mkString("VersionVector(", ", ", ")")
/** INTERNAL API */
@InternalApi override private[akka] def estimatedSize: Int =
versions.size * (EstimatedSize.UniqueAddress + EstimatedSize.LongValue)
}