norangebit b50890b44f
All checks were successful
continuous-integration/drone/tag Build is passing
refactoring
2020-05-03 19:38:55 +02:00

31 lines
627 B
Kotlin

package drills.drill09.dbreplica
import util.network.epidemic.TimedPayload
import util.network.simulator.Address
import util.network.simulator.Network
fun main() {
val network = Network()
repeat(10) {
DbNode.createPushPullNode(Address(it), network, TimedPayload(0, 0))
}
val alpha = network.getRandomNode() as DbNode<Int>
network.start()
Thread.sleep(1000)
network.forEach {
println((it as DbNode<Int>).nodeValue)
}
alpha.changeValue(TimedPayload.createContent(42))
Thread.sleep(2000)
network.forEach {
println((it as DbNode<Int>).nodeValue)
}
}