move code to src/test
* so that it compiles and tests pass * fix some additional snip references in getting started
This commit is contained in:
parent
413df8e0f4
commit
59f53e1a22
289 changed files with 45 additions and 45 deletions
29
akka-docs/src/test/scala/docs/ddata/TwoPhaseSet.scala
Normal file
29
akka-docs/src/test/scala/docs/ddata/TwoPhaseSet.scala
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* Copyright (C) 2015-2017 Lightbend Inc. <http://www.lightbend.com>
|
||||
*/
|
||||
package docs.ddata
|
||||
|
||||
import akka.cluster.ddata.ReplicatedData
|
||||
import akka.cluster.ddata.GSet
|
||||
|
||||
//#twophaseset
|
||||
case class TwoPhaseSet(
|
||||
adds: GSet[String] = GSet.empty,
|
||||
removals: GSet[String] = GSet.empty)
|
||||
extends ReplicatedData {
|
||||
type T = TwoPhaseSet
|
||||
|
||||
def add(element: String): TwoPhaseSet =
|
||||
copy(adds = adds.add(element))
|
||||
|
||||
def remove(element: String): TwoPhaseSet =
|
||||
copy(removals = removals.add(element))
|
||||
|
||||
def elements: Set[String] = adds.elements diff removals.elements
|
||||
|
||||
override def merge(that: TwoPhaseSet): TwoPhaseSet =
|
||||
copy(
|
||||
adds = this.adds.merge(that.adds),
|
||||
removals = this.removals.merge(that.removals))
|
||||
}
|
||||
//#twophaseset
|
||||
Loading…
Add table
Add a link
Reference in a new issue