mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 22:50:18 +00:00
Fixes topology for co (#394)
* Fixes topology for co * Removed debug output * Test fixed
This commit is contained in:
parent
4ded24d7a7
commit
d1b54fe39b
@ -1,23 +1,14 @@
|
||||
service Kademlia("kad"):
|
||||
neighborhood: string, ?bool, ?bool -> []string
|
||||
service HelloWorld("hello-srv"):
|
||||
hello: string -> string
|
||||
|
||||
service Peer("peer"):
|
||||
timestamp_sec: -> ()
|
||||
timeout: u32, string -> ()
|
||||
func sayHello() -> string:
|
||||
-- execute computation on a Peer in the network
|
||||
on "hello-peer":
|
||||
comp <- HelloWorld.hello(%init_peer_id%)
|
||||
|
||||
func ack_peers() -> []string:
|
||||
acked_peers: *string
|
||||
-- send the result to target browser in the background
|
||||
co on "target-peer" via "target-relay":
|
||||
res <- HelloWorld.hello(%init_peer_id%)
|
||||
|
||||
on HOST_PEER_ID:
|
||||
nodes <- Kademlia.neighborhood(%init_peer_id%, nil, nil)
|
||||
for n <- nodes par:
|
||||
status: *string
|
||||
on n:
|
||||
Peer.timestamp_sec()
|
||||
status <<- "acked"
|
||||
|
||||
if status! == "acked":
|
||||
acked_peers <<- n
|
||||
|
||||
Peer.timeout(15000, "") -- this line's indentation triggers the bug
|
||||
<- acked_peers
|
||||
-- send the result to the initiator
|
||||
<- comp
|
@ -578,9 +578,9 @@ class TopologySpec extends AnyFlatSpec with Matchers {
|
||||
|
||||
val expected: Node.Res =
|
||||
MakeRes.seq(
|
||||
through(relay),
|
||||
MakeRes.par(
|
||||
MakeRes.seq(
|
||||
through(relay),
|
||||
callRes(1, otherPeer, Some(Call.Export(varNode.name, varNode.`type`))),
|
||||
through(relay),
|
||||
through(initPeer) // pingback
|
||||
|
@ -140,6 +140,7 @@ object Topology extends Logging {
|
||||
}
|
||||
|
||||
trait Begins {
|
||||
|
||||
def beginsOn(current: Topology): Eval[List[OnTag]] = current.pathOn
|
||||
|
||||
def pathBefore(current: Topology): Eval[Chain[ValueModel]] =
|
||||
@ -371,7 +372,7 @@ object Topology extends Logging {
|
||||
SeqNext
|
||||
case (_, _: ForTag) =>
|
||||
For
|
||||
case (_, ParTag | ParTag.Detach) =>
|
||||
case (_, ParTag) => // No begin optimization for detach
|
||||
ParGroup
|
||||
case _ =>
|
||||
Default
|
||||
@ -450,14 +451,20 @@ object Topology extends Logging {
|
||||
println(rc.topology)
|
||||
println("Before: " + rc.topology.beforeOn.value)
|
||||
println("Begin: " + rc.topology.beginsOn.value)
|
||||
println("PathBefore: " + rc.topology.pathBefore.value)
|
||||
println(
|
||||
(if (rc.topology.pathBefore.value.nonEmpty) Console.YELLOW
|
||||
else "") + "PathBefore: " + Console.RESET + rc.topology.pathBefore.value
|
||||
)
|
||||
|
||||
println(Console.CYAN + "Parent: " + rc.topology.parent + Console.RESET)
|
||||
|
||||
println("End : " + rc.topology.endsOn.value)
|
||||
println("After: " + rc.topology.afterOn.value)
|
||||
println("Exit : " + rc.topology.forceExit.value)
|
||||
println("PathAfter: " + rc.topology.pathAfter.value)
|
||||
println(
|
||||
(if (rc.topology.pathAfter.value.nonEmpty) Console.YELLOW
|
||||
else "") + "PathAfter: " + Console.RESET + rc.topology.pathAfter.value
|
||||
)
|
||||
println(Console.YELLOW + " - - - - -" + Console.RESET)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user