Typed Distributed Data requires untyped Cluster [#25746](https://github.com/akka/akka/issues/25746)
This commit is contained in:
parent
2c145cd3c3
commit
8a44fca087
44 changed files with 656 additions and 368 deletions
|
|
@ -199,9 +199,15 @@ final class ORMap[A, B <: ReplicatedData] private[akka] (
|
|||
* Adds an entry to the map
|
||||
* @see [[#put]]
|
||||
*/
|
||||
def :+(entry: (A, B))(implicit node: SelfUniqueAddress): ORMap[A, B] = {
|
||||
val (key, value) = entry
|
||||
put(node.uniqueAddress, key, value)
|
||||
}
|
||||
|
||||
@deprecated("Use `:+` that takes a `SelfUniqueAddress` parameter instead.", since = "2.5.20")
|
||||
def +(entry: (A, B))(implicit node: Cluster): ORMap[A, B] = {
|
||||
val (key, value) = entry
|
||||
put(node, key, value)
|
||||
put(node.selfUniqueAddress, key, value)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -217,6 +223,9 @@ final class ORMap[A, B <: ReplicatedData] private[akka] (
|
|||
* value, because important history can be lost when replacing the `ORSet` and
|
||||
* undesired effects of merging will occur. Use [[ORMultiMap]] or [[#updated]] instead.
|
||||
*/
|
||||
def put(node: SelfUniqueAddress, key: A, value: B): ORMap[A, B] = put(node.uniqueAddress, key, value)
|
||||
|
||||
@deprecated("Use `put` that takes a `SelfUniqueAddress` parameter instead.", since = "2.5.20")
|
||||
def put(node: Cluster, key: A, value: B): ORMap[A, B] = put(node.selfUniqueAddress, key, value)
|
||||
|
||||
/**
|
||||
|
|
@ -241,6 +250,10 @@ final class ORMap[A, B <: ReplicatedData] private[akka] (
|
|||
* If there is no current value for the `key` the `initial` value will be
|
||||
* passed to the `modify` function.
|
||||
*/
|
||||
def updated(node: SelfUniqueAddress, key: A, initial: B)(modify: B ⇒ B): ORMap[A, B] =
|
||||
updated(node.uniqueAddress, key, initial)(modify)
|
||||
|
||||
@deprecated("Use `updated` that takes a `SelfUniqueAddress` parameter instead.", since = "2.5.20")
|
||||
def updated(node: Cluster, key: A, initial: B)(modify: B ⇒ B): ORMap[A, B] =
|
||||
updated(node.selfUniqueAddress, key, initial)(modify)
|
||||
|
||||
|
|
@ -251,9 +264,9 @@ final class ORMap[A, B <: ReplicatedData] private[akka] (
|
|||
* passed to the `modify` function.
|
||||
*/
|
||||
@Deprecated
|
||||
@deprecated("use update for the Java API as updated is ambiguous with the Scala API", "2.5.19")
|
||||
@deprecated("use update for the Java API as updated is ambiguous with the Scala API", "2.5.20")
|
||||
def updated(node: Cluster, key: A, initial: B, modify: java.util.function.Function[B, B]): ORMap[A, B] =
|
||||
updated(node, key, initial)(value ⇒ modify.apply(value))
|
||||
updated(node.selfUniqueAddress, key, initial)(value ⇒ modify.apply(value))
|
||||
|
||||
/**
|
||||
* Java API: Replace a value by applying the `modify` function on the existing value.
|
||||
|
|
@ -261,6 +274,11 @@ final class ORMap[A, B <: ReplicatedData] private[akka] (
|
|||
* If there is no current value for the `key` the `initial` value will be
|
||||
* passed to the `modify` function.
|
||||
*/
|
||||
def update(node: SelfUniqueAddress, key: A, initial: B, modify: java.util.function.Function[B, B]): ORMap[A, B] =
|
||||
updated(node.uniqueAddress, key, initial)(value ⇒ modify.apply(value))
|
||||
|
||||
@Deprecated
|
||||
@deprecated("Use `update` that takes a `SelfUniqueAddress` parameter instead.", since = "2.5.20")
|
||||
def update(node: Cluster, key: A, initial: B, modify: java.util.function.Function[B, B]): ORMap[A, B] =
|
||||
updated(node, key, initial)(value ⇒ modify.apply(value))
|
||||
|
||||
|
|
@ -295,17 +313,25 @@ final class ORMap[A, B <: ReplicatedData] private[akka] (
|
|||
}
|
||||
|
||||
/**
|
||||
* Scala API
|
||||
* Removes an entry from the map.
|
||||
* Note that if there is a conflicting update on another node the entry will
|
||||
* not be removed after merge.
|
||||
*/
|
||||
def -(key: A)(implicit node: Cluster): ORMap[A, B] = remove(node, key)
|
||||
def remove(key: A)(implicit node: SelfUniqueAddress): ORMap[A, B] = remove(node.uniqueAddress, key)
|
||||
|
||||
/**
|
||||
* Java API
|
||||
* Removes an entry from the map.
|
||||
* Note that if there is a conflicting update on another node the entry will
|
||||
* not be removed after merge.
|
||||
*/
|
||||
def remove(node: SelfUniqueAddress, key: A): ORMap[A, B] = remove(node.uniqueAddress, key)
|
||||
|
||||
@deprecated("Use `remove` that takes a `SelfUniqueAddress` parameter instead.", since = "2.5.20")
|
||||
def -(key: A)(implicit node: Cluster): ORMap[A, B] = remove(node.selfUniqueAddress, key)
|
||||
|
||||
@deprecated("Use `remove` that takes a `SelfUniqueAddress` parameter instead.", since = "2.5.20")
|
||||
def remove(node: Cluster, key: A): ORMap[A, B] = remove(node.selfUniqueAddress, key)
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue