=cdd #18106 Merge update value with existing

This commit is contained in:
Patrik Nordwall 2015-08-14 10:08:36 +02:00
parent d84492e581
commit 153b683a0a
2 changed files with 35 additions and 13 deletions

View file

@ -857,9 +857,10 @@ final class Replicator(settings: ReplicatorSettings) extends Actor with ActorLog
val localValue = getData(key.id)
Try {
localValue match {
case Some(DataEnvelope(DeletedData, _)) throw new DataDeleted(key)
case Some(envelope @ DataEnvelope(existing, _)) modify(Some(existing))
case None modify(None)
case Some(DataEnvelope(DeletedData, _)) throw new DataDeleted(key)
case Some(envelope @ DataEnvelope(existing, _))
existing.merge(modify(Some(existing)).asInstanceOf[existing.T])
case None modify(None)
}
} match {
case Success(newData)