Skip to content

Commit

Permalink
Added Raft-Troupe to libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
V-Ask committed May 21, 2024
1 parent 427dd85 commit ee3f15e
Show file tree
Hide file tree
Showing 12 changed files with 1,098 additions and 15 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ libs:
$(COMPILER) ./lib/declassifyutil.trp -l
$(COMPILER) ./lib/stdio.trp -l
$(COMPILER) ./lib/timeout.trp -l
$(COMPILER) ./lib/raft.trp -l
$(COMPILER) ./lib/raft_debug.trp -l
$(COMPILER) ./lib/bst.trp -l
$(COMPILER) ./lib/localregistry.trp -l
$(COMPILER) ./lib/raft_troupe.trp -l

test:
mkdir -p out
Expand Down
Binary file added examples/network/bug.zip
Binary file not shown.
15 changes: 15 additions & 0 deletions examples/network/bug/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
MKID=node $(TROUPE)/rt/built/p2p/mkid.mjs
MKALIASES=node $(TROUPE)/rt/built/p2p/mkaliases.js
START=$(TROUPE)/network.sh

zero.listener:
$(START) zero.trp --id=ids/test-listener.json --rspawn=true --aliases=aliases.json --stdiolev={} # --debug --debugp2p

test.dialer:
$(START) test.trp --id=ids/test-dialer.json --aliases=aliases.json # --debug --debugp2p

create-network-identifiers:
mkdir -p ids
$(MKID) --outfile=ids/test-listener.json
$(MKID) --outfile=ids/test-dialer.json
$(MKALIASES) --include ids/test-listener.json --include ids/test-dialer.json --outfile aliases.json
1 change: 1 addition & 0 deletions examples/network/bug/aliases.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"test-listener":"12D3KooWLcEDHga2pJexeKf34SkFcSEApWH9cBfejSQ1ijK4vyf7","test-dialer":"12D3KooWPZqq8atHw82spMogKmA6RZrbyzHYTUuspX4nCEgcwM8k"}
1 change: 1 addition & 0 deletions examples/network/bug/ids/test-dialer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":"12D3KooWPZqq8atHw82spMogKmA6RZrbyzHYTUuspX4nCEgcwM8k","privKey":"CAESQEKXDF2N8k22Ay+bEOg+1cLzst7w0xsadOftWr9rnvspzEsuo4temSVKAyRC0iaoqho4cGMI+2U8n46ZftL1kVE=","pubKey":"CAESIMxLLqOLXpklSgMkQtImqKoaOHBjCPtlPJ+OmX7S9ZFR"}
1 change: 1 addition & 0 deletions examples/network/bug/ids/test-listener.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":"12D3KooWLcEDHga2pJexeKf34SkFcSEApWH9cBfejSQ1ijK4vyf7","privKey":"CAESQE9L+uwGkxBHWvTPhhaAof1aX1TLZIkNjgsOKQJA3oTnoFSXJ4h2unqF2kQxYLkNuRDXw0u+nXr4Z518vVPxrjo=","pubKey":"CAESIKBUlyeIdrp6hdpEMWC5DbkQ18NLvp16+GedfL1T8a46"}
10 changes: 10 additions & 0 deletions examples/network/bug/test.trp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
datatype Atoms = TEST

let fun spawned_func dialer =
send(dialer, TEST)

val pid = self ()
val receiver = spawn("@test-listener", fn () => spawned_func pid)

in receive [hn x => printString "bug"]
end
1 change: 1 addition & 0 deletions examples/network/bug/zero.trp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
6 changes: 5 additions & 1 deletion examples/network/pingpong/p2ppingpong.trp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ let fun pingpong () =
val {counter, pid=sender} = receive [hn x => x]
val _ = send (sender, {counter=counter + 1, pid=self()})
val _ = print counter
in pingpong()
in
(if counter + 1 > 100 then
print (getTime()) else ());
pingpong()
end

in let val processA = spawn ("@pingpong-listener", pingpong)
val _ = print processA
val processB = spawn ("@pingpong-dialer", pingpong)
val _ = print processB
val _ = print (getTime())
val _ = send (processA,{counter = 1, pid =processB})
in ()
end
Expand Down
6 changes: 0 additions & 6 deletions lib/out/raft.exports

This file was deleted.

6 changes: 0 additions & 6 deletions lib/out/raft_debug.exports

This file was deleted.

Loading

0 comments on commit ee3f15e

Please sign in to comment.