Compare commits

...

106 Commits

Author SHA1 Message Date
Tony Garnock-Jones 3341862f05 Delimited-continuation-based suspend-turn, react/suspend, until 4 months ago
Tony Garnock-Jones 5e1518c2bb Avoid caching turn past a user action (which causes problems if we suspend/resume across turns) 4 months ago
Tony Garnock-Jones 4970d0fd9e Tweak error message 4 months ago
Tony Garnock-Jones b2c591777e Avoid potential (?) for wrong early termination of engine 4 months ago
Tony Garnock-Jones 26ca865b87 More sensible representation of facet ancestry 4 months ago
Tony Garnock-Jones 0ba6bac01b Clean up relay logging 4 months ago
Tony Garnock-Jones b409063ff2 Handle EPIPE in tcp driver 4 months ago
Tony Garnock-Jones 6ea074948a Launchers from previous incarnation 4 months ago
Tony Garnock-Jones 247fd1b2c0 Introduce `object` and `spawn/link` 4 months ago
Tony Garnock-Jones b5c57381fa Simplify during* 4 months ago
Tony Garnock-Jones 2f4525b031 Split out tcp-client.rkt and tcp-echo-server.rkt 4 months ago
Tony Garnock-Jones 11eb0bcd6f drivers/racket-event.rkt 4 months ago
Tony Garnock-Jones 1ca04c66b0 Detect situation with empty spawn body 4 months ago
Tony Garnock-Jones 752bc91991 ActiveSocket-close now gets a string, not an embedded exn 4 months ago
Tony Garnock-Jones 3984a2c22a Correct generation of patterns for literal embedded-values 4 months ago
Tony Garnock-Jones 7790923e65 Split out timer-demo.rkt 4 months ago
Tony Garnock-Jones bd65204760 entity/stop-on-retract 4 months ago
Tony Garnock-Jones 37ca805969 Ambient current-turn 4 months ago
Tony Garnock-Jones 9aa33210b0 Use tcp driver in tcp-server 4 months ago
Tony Garnock-Jones 45e8c29976 TCP client driver, and provides 4 months ago
Tony Garnock-Jones 336811c51e Beginnings of a TCP driver 4 months ago
Tony Garnock-Jones 5ab375bc26 Conditional assertion 4 months ago
Tony Garnock-Jones 82648dc0da Port timer driver from older syndicate/rkt implementation 4 months ago
Tony Garnock-Jones ee5a5d9f5f Cosmetic, more or less 4 months ago
Tony Garnock-Jones de18aa2112 Add debug output to facet-inert? 4 months ago
Tony Garnock-Jones b12fc5188d "Linking" during spawn; and during/spawn 4 months ago
Tony Garnock-Jones 5dec0afe39 syntax-classes.rkt 4 months ago
Tony Garnock-Jones 52362a9183 facet-on-end-of-turn! 4 months ago
Tony Garnock-Jones cce81dc104 Seldom any need for this chmod, so omit it in favour of manual fixup when required 4 months ago
Tony Garnock-Jones e8a2e00fa2 TAttenuate 4 months ago
Tony Garnock-Jones fff4b05036 Run packet writer in a turn to add proper error handling 4 months ago
Tony Garnock-Jones c40ba51a29 Oops! Omitted DBind case when extending index skeleton 4 months ago
Tony Garnock-Jones d0fb1cfa99 Various missing con/destructors 4 months ago
Tony Garnock-Jones eb3aa40541 Fix double-embedded problem; ~working tcp-server! 4 months ago
Tony Garnock-Jones 5c2bdb1e93 Don't silently swallow errors in linked-thread 4 months ago
Tony Garnock-Jones 2276d1a81e Allow deferred production of initial-ref 4 months ago
Tony Garnock-Jones 600a52c287 Fully expose the problem with missing-unwrapping-of-embedded 4 months ago
Tony Garnock-Jones 40c26f006e Remove :template in favour of ->preserve 4 months ago
Tony Garnock-Jones ef66c1d358 Further adaptation to recent Preserves changes 4 months ago
Tony Garnock-Jones 92eab82b1f Correct name of engine.rkt logger 4 months ago
Tony Garnock-Jones 19fc5f97bb Adapt to recent changes in preserves-schema 4 months ago
Tony Garnock-Jones 601d60adc3 Adapt to new ty-field records 4 months ago
Tony Garnock-Jones 468b6541f9 Yesterday's work on relay + TCP distribution 4 months ago
Tony Garnock-Jones 6f9ee4eb44 More emacs indentation config 4 months ago
Tony Garnock-Jones 8e866239a6 #:name for during* 4 months ago
Tony Garnock-Jones bed381dd5e Remove unwanted commented code 4 months ago
Tony Garnock-Jones b22ed84bdb Minor refactoring 4 months ago
Tony Garnock-Jones 5d1e266ea3 Improve error reporting on turn reuse 4 months ago
Tony Garnock-Jones 98486667f4 gen:custom-write for turn 4 months ago
Tony Garnock-Jones 5260370154 entity-data 4 months ago
Tony Garnock-Jones e7153b9c6a Truncate output of hmac-sha256 correctly 4 months ago
Tony Garnock-Jones c18a2b2652 turn-committed? 4 months ago
Tony Garnock-Jones eec5c59f84 Accommodate new preserves approach to (un)parsing embeddeds 4 months ago
Tony Garnock-Jones 3751c07de6 *dead-actor*, *dead-facet*, *dead-engine* 4 months ago
Tony Garnock-Jones 557a0fb499 actor-remove-exit-hook! 4 months ago
Tony Garnock-Jones 4c72ab11f4 Export actor-name and actor-engine 4 months ago
Tony Garnock-Jones da0d2b8e61 attenuate-entity-ref as well as attenuate-sturdy 4 months ago
Tony Garnock-Jones 1290e30c3d Merge branch 'main' into novy 4 months ago
Tony Garnock-Jones 2d07e46c67 Fix and add copyright notices 4 months ago
Tony Garnock-Jones 7be7c36537 Merge branch 'main' into novy 4 months ago
Tony Garnock-Jones e85760e6d6 syndicate/sturdy.rkt 4 months ago
Tony Garnock-Jones 0a887ec9e2 Add missing dependency from syndicate-examples to preserves. 4 months ago
Tony Garnock-Jones f1c3859a71 Put assertion-struct and message-struct back. 4 months ago
Tony Garnock-Jones 2a9cdfc5cc !dump-registered-preserves-patterns! 4 months ago
Tony Garnock-Jones b49178146d Move box-protocol to a #lang preserves-schema module 4 months ago
Tony Garnock-Jones d554c4ba8e Move go.rkt and go2.rkt into the examples package 4 months ago
Tony Garnock-Jones 6a0bcb1246 Make box-and-client work better with raco test 4 months ago
Tony Garnock-Jones d648af920a Restore syndicate-examples package; port box-and-client.rkt 4 months ago
Tony Garnock-Jones 7b600c51df Emacs indentation support 4 months ago
Tony Garnock-Jones a23047c26b stop-when, stop-when-true, when retracted 4 months ago
Tony Garnock-Jones 50f6dfadc0 Pattern quasiquotation (!!!) 4 months ago
Tony Garnock-Jones 7bf0f17e8e Repair missing argument in call to struct-label-and-arity 4 months ago
Tony Garnock-Jones 12df86ee74 Hash-table patterns 4 months ago
Tony Garnock-Jones 507f137c25 Fix templates of union schemas 4 months ago
Tony Garnock-Jones 7ce9166a5d actor-system/dataspace 4 months ago
Tony Garnock-Jones 490f2d82db Provide :pattern and :template by default 4 months ago
Tony Garnock-Jones d6c29fc2e7 Immediate stop-facet continuation execution 4 months ago
Tony Garnock-Jones 22bd461cdc Entity names 4 months ago
Tony Garnock-Jones 63720f80ba Split out during*; new example go2.rkt 4 months ago
Tony Garnock-Jones 5d17a3bc58 Use actor names; extract reporting from box 4 months ago
Tony Garnock-Jones defb65cd30 Actor names; debug tracing of actors 4 months ago
Tony Garnock-Jones 2fa1b033eb Use :template in send!. 4 months ago
Tony Garnock-Jones 6b3988caf7 Repair during macro; use during in box/client example 4 months ago
Tony Garnock-Jones 4b1b2a9635 Proper skeleton-based dataspace 4 months ago
Tony Garnock-Jones 6fe14e09a5 Pattern decomposition 4 months ago
Tony Garnock-Jones 044860a3b5 Useful custom-write for entities 4 months ago
Tony Garnock-Jones 40310a0eb3 Split out dataspace.rkt 4 months ago
Tony Garnock-Jones 7a9f52b97c Add missing layer in pattern generation 4 months ago
Tony Garnock-Jones b77fe3efbc Steps towards using :pattern/:template in syntax 4 months ago
Tony Garnock-Jones fe6430abfd Add :template 4 months ago
Tony Garnock-Jones ac01ce4dfe Work towards schema-to-pattern compiler 4 months ago
Tony Garnock-Jones 5c97661c73 Update schemas for new embedded syntax; steps toward pattern support 4 months ago
Tony Garnock-Jones a2264b0c63 Merge branch 'main' into novy 4 months ago
Tony Garnock-Jones 37bd64bf05 First attempt at novy syntax 4 months ago
Tony Garnock-Jones 35e1d24fde Cope with nonexistent schemas/gen directory during setup 4 months ago
Tony Garnock-Jones 568f97c2f6 ref -> entity-ref 4 months ago
Tony Garnock-Jones d4af09e1b9 Main submodule in go.rkt 4 months ago
Tony Garnock-Jones a06b9d188a Integrate dataflow 4 months ago
Tony Garnock-Jones e5b87f5bb0 Cosmetic 4 months ago
Tony Garnock-Jones bcbc660ff1 Make turns atomic, rather than reply-turn-per-event 4 months ago
Tony Garnock-Jones caec6fc820 Daemon actors and go.rkt shutdown 4 months ago
Tony Garnock-Jones 3528391f12 Crude pseudo-dataspace, plus box-and-client 4 months ago
Tony Garnock-Jones 4eb43a158e Progress 4 months ago
Tony Garnock-Jones 21bb695ac8 First program! 4 months ago
Tony Garnock-Jones d1a1c967f7 First steps to an actual novy implementation 4 months ago
Tony Garnock-Jones 08c4980025 Move the bulk of the existing implementation out of the way 4 months ago
  1. 0
      OLD-syndicate-examples/chat-client.rkt
  2. 0
      OLD-syndicate-examples/chat-server-nested-dataspace.rkt
  3. 0
      OLD-syndicate-examples/chat-server.rkt
  4. 0
      OLD-syndicate-examples/echo.rkt
  5. 0
      OLD-syndicate-examples/filesystem.rkt
  6. 0
      OLD-syndicate-examples/gl-2d-basic.rkt
  7. 0
      OLD-syndicate-examples/gl-2d-clock-face.rkt
  8. 0
      OLD-syndicate-examples/gl-2d-many.rkt
  9. 0
      OLD-syndicate-examples/gl-2d-platformer.rkt
  10. 0
      OLD-syndicate-examples/gui/README.md
  11. 0
      OLD-syndicate-examples/gui/gui.rkt
  12. 0
      OLD-syndicate-examples/gui/hsv.rkt
  13. 0
      OLD-syndicate-examples/gui/layout/layout.rkt
  14. 0
      OLD-syndicate-examples/gui/layout/main.rkt
  15. 0
      OLD-syndicate-examples/gui/layout/sizing.rkt
  16. 0
      OLD-syndicate-examples/gui/oakura-beach-20081225.jpg
  17. 0
      OLD-syndicate-examples/gui/syndicate-gui-snapshot.png
  18. 0
      OLD-syndicate-examples/ircd/Makefile
  19. 0
      OLD-syndicate-examples/ircd/channel.rkt
  20. 0
      OLD-syndicate-examples/ircd/config.rkt
  21. 0
      OLD-syndicate-examples/ircd/dynamic-main.rkt
  22. 0
      OLD-syndicate-examples/ircd/greeter.rkt
  23. 0
      OLD-syndicate-examples/ircd/ircd-config.rktd
  24. 0
      OLD-syndicate-examples/ircd/irssi-config
  25. 0
      OLD-syndicate-examples/ircd/main.rkt
  26. 0
      OLD-syndicate-examples/ircd/message.rkt
  27. 0
      OLD-syndicate-examples/ircd/protocol.rkt
  28. 0
      OLD-syndicate-examples/ircd/session.rkt
  29. 0
      OLD-syndicate-examples/netstack/Makefile
  30. 0
      OLD-syndicate-examples/netstack/README.md
  31. 0
      OLD-syndicate-examples/netstack/TODO.md
  32. 0
      OLD-syndicate-examples/netstack/arp.rkt
  33. 0
      OLD-syndicate-examples/netstack/checksum.rkt
  34. 0
      OLD-syndicate-examples/netstack/configuration.rkt
  35. 0
      OLD-syndicate-examples/netstack/demo-config.rkt
  36. 0
      OLD-syndicate-examples/netstack/dump-bytes.rkt
  37. 0
      OLD-syndicate-examples/netstack/ethernet.rkt
  38. 0
      OLD-syndicate-examples/netstack/fetchurl.rkt
  39. 0
      OLD-syndicate-examples/netstack/ip.rkt
  40. 0
      OLD-syndicate-examples/netstack/main.rkt
  41. 0
      OLD-syndicate-examples/netstack/port-allocator.rkt
  42. 0
      OLD-syndicate-examples/netstack/tcp.rkt
  43. 0
      OLD-syndicate-examples/netstack/udp.rkt
  44. 0
      OLD-syndicate-examples/private/beautiful-grassland-wallpapers-1920x1080.jpg
  45. 0
      OLD-syndicate-examples/private/sounds/270302__littlerobotsoundfactory__collect-point-02.wav
  46. 0
      OLD-syndicate-examples/private/sounds/270303__littlerobotsoundfactory__collect-point-01.wav
  47. 0
      OLD-syndicate-examples/private/sounds/270304__littlerobotsoundfactory__collect-point-00.wav
  48. 0
      OLD-syndicate-examples/private/sounds/270305__littlerobotsoundfactory__climb-rope-loop-00.wav
  49. 0
      OLD-syndicate-examples/private/sounds/270306__littlerobotsoundfactory__explosion-02.wav
  50. 0
      OLD-syndicate-examples/private/sounds/270307__littlerobotsoundfactory__explosion-01.wav
  51. 0
      OLD-syndicate-examples/private/sounds/270308__littlerobotsoundfactory__explosion-00.wav
  52. 0
      OLD-syndicate-examples/private/sounds/270309__littlerobotsoundfactory__craft-00.wav
  53. 0
      OLD-syndicate-examples/private/sounds/270310__littlerobotsoundfactory__explosion-04.wav
  54. 0
      OLD-syndicate-examples/private/sounds/270311__littlerobotsoundfactory__explosion-03.wav
  55. 0
      OLD-syndicate-examples/private/sounds/270315__littlerobotsoundfactory__menu-navigate-03.wav
  56. 0
      OLD-syndicate-examples/private/sounds/270316__littlerobotsoundfactory__open-00.wav
  57. 0
      OLD-syndicate-examples/private/sounds/270317__littlerobotsoundfactory__jump-01.wav
  58. 0
      OLD-syndicate-examples/private/sounds/270318__littlerobotsoundfactory__jump-02.wav
  59. 0
      OLD-syndicate-examples/private/sounds/270319__littlerobotsoundfactory__jingle-win-01.wav
  60. 0
      OLD-syndicate-examples/private/sounds/270320__littlerobotsoundfactory__jump-00.wav
  61. 0
      OLD-syndicate-examples/private/sounds/270321__littlerobotsoundfactory__menu-navigate-01.wav
  62. 0
      OLD-syndicate-examples/private/sounds/270322__littlerobotsoundfactory__menu-navigate-02.wav
  63. 0
      OLD-syndicate-examples/private/sounds/270323__littlerobotsoundfactory__jump-03.wav
  64. 0
      OLD-syndicate-examples/private/sounds/270324__littlerobotsoundfactory__menu-navigate-00.wav
  65. 0
      OLD-syndicate-examples/private/sounds/270325__littlerobotsoundfactory__hit-02.wav
  66. 0
      OLD-syndicate-examples/private/sounds/270326__littlerobotsoundfactory__hit-01.wav
  67. 0
      OLD-syndicate-examples/private/sounds/270327__littlerobotsoundfactory__hit-00.wav
  68. 0
      OLD-syndicate-examples/private/sounds/270328__littlerobotsoundfactory__hero-death-00.wav
  69. 0
      OLD-syndicate-examples/private/sounds/270329__littlerobotsoundfactory__jingle-lose-00.wav
  70. 0
      OLD-syndicate-examples/private/sounds/270330__littlerobotsoundfactory__jingle-achievement-01.wav
  71. 0
      OLD-syndicate-examples/private/sounds/270331__littlerobotsoundfactory__jingle-achievement-00.wav
  72. 0
      OLD-syndicate-examples/private/sounds/270332__littlerobotsoundfactory__hit-03.wav
  73. 0
      OLD-syndicate-examples/private/sounds/270333__littlerobotsoundfactory__jingle-win-00.wav
  74. 0
      OLD-syndicate-examples/private/sounds/270334__littlerobotsoundfactory__jingle-lose-01.wav
  75. 0
      OLD-syndicate-examples/private/sounds/270335__littlerobotsoundfactory__shoot-03.wav
  76. 0
      OLD-syndicate-examples/private/sounds/270336__littlerobotsoundfactory__shoot-02.wav
  77. 0
      OLD-syndicate-examples/private/sounds/270337__littlerobotsoundfactory__pickup-00.wav
  78. 0
      OLD-syndicate-examples/private/sounds/270338__littlerobotsoundfactory__open-01.wav
  79. 0
      OLD-syndicate-examples/private/sounds/270339__littlerobotsoundfactory__pickup-02.wav
  80. 0
      OLD-syndicate-examples/private/sounds/270340__littlerobotsoundfactory__pickup-01.wav
  81. 0
      OLD-syndicate-examples/private/sounds/270341__littlerobotsoundfactory__pickup-04.wav
  82. 0
      OLD-syndicate-examples/private/sounds/270342__littlerobotsoundfactory__pickup-03.wav
  83. 0
      OLD-syndicate-examples/private/sounds/270343__littlerobotsoundfactory__shoot-01.wav
  84. 0
      OLD-syndicate-examples/private/sounds/270344__littlerobotsoundfactory__shoot-00.wav
  85. 0
      OLD-syndicate-examples/private/sounds/_readme_and_license.txt
  86. 0
      OLD-syndicate-examples/santa.rkt
  87. 0
      OLD-syndicate-examples/server-chat-client.rkt
  88. 0
      OLD-syndicate-examples/simple-cross-layer.rkt
  89. 0
      OLD-syndicate-examples/sqlite.rkt
  90. 0
      OLD-syndicate-examples/stdin-echo.rkt
  91. 0
      OLD-syndicate-examples/time.rkt
  92. 0
      OLD-syndicate-examples/udp-echo.rkt
  93. 0
      OLD-syndicate-examples/udp-multicast.rkt
  94. 0
      OLD-syndicate-examples/web-core.rkt
  95. 638
      OLD-syndicate/dataspace.rkt
  96. 0
      OLD-syndicate/distributed.rkt
  97. 0
      OLD-syndicate/distributed/buffer.rkt
  98. 0
      OLD-syndicate/distributed/client.rkt
  99. 0
      OLD-syndicate/distributed/client/loopback.rkt
  100. 0
      OLD-syndicate/distributed/client/tcp.rkt

0
syndicate-examples/chat-client.rkt → OLD-syndicate-examples/chat-client.rkt

0
syndicate-examples/chat-server-nested-dataspace.rkt → OLD-syndicate-examples/chat-server-nested-dataspace.rkt

0
syndicate-examples/chat-server.rkt → OLD-syndicate-examples/chat-server.rkt

0
syndicate-examples/echo.rkt → OLD-syndicate-examples/echo.rkt

0
syndicate-examples/filesystem.rkt → OLD-syndicate-examples/filesystem.rkt

0
syndicate-examples/gl-2d-basic.rkt → OLD-syndicate-examples/gl-2d-basic.rkt

0
syndicate-examples/gl-2d-clock-face.rkt → OLD-syndicate-examples/gl-2d-clock-face.rkt

0
syndicate-examples/gl-2d-many.rkt → OLD-syndicate-examples/gl-2d-many.rkt

0
syndicate-examples/gl-2d-platformer.rkt → OLD-syndicate-examples/gl-2d-platformer.rkt

0
syndicate-examples/gui/README.md → OLD-syndicate-examples/gui/README.md

0
syndicate-examples/gui/gui.rkt → OLD-syndicate-examples/gui/gui.rkt

0
syndicate-examples/gui/hsv.rkt → OLD-syndicate-examples/gui/hsv.rkt

0
syndicate-examples/gui/layout/layout.rkt → OLD-syndicate-examples/gui/layout/layout.rkt

0
syndicate-examples/gui/layout/main.rkt → OLD-syndicate-examples/gui/layout/main.rkt

0
syndicate-examples/gui/layout/sizing.rkt → OLD-syndicate-examples/gui/layout/sizing.rkt

0
syndicate-examples/gui/oakura-beach-20081225.jpg → OLD-syndicate-examples/gui/oakura-beach-20081225.jpg

Before

Width: 1920  |  Height: 1440  |  Size: 483 KiB

After

Width: 1920  |  Height: 1440  |  Size: 483 KiB

0
syndicate-examples/gui/syndicate-gui-snapshot.png → OLD-syndicate-examples/gui/syndicate-gui-snapshot.png

Before

Width: 851  |  Height: 646  |  Size: 491 KiB

After

Width: 851  |  Height: 646  |  Size: 491 KiB

0
syndicate-examples/ircd/Makefile → OLD-syndicate-examples/ircd/Makefile

0
syndicate-examples/ircd/channel.rkt → OLD-syndicate-examples/ircd/channel.rkt

0
syndicate-examples/ircd/config.rkt → OLD-syndicate-examples/ircd/config.rkt

0
syndicate-examples/ircd/dynamic-main.rkt → OLD-syndicate-examples/ircd/dynamic-main.rkt

0
syndicate-examples/ircd/greeter.rkt → OLD-syndicate-examples/ircd/greeter.rkt

0
syndicate-examples/ircd/ircd-config.rktd → OLD-syndicate-examples/ircd/ircd-config.rktd

0
syndicate-examples/ircd/irssi-config → OLD-syndicate-examples/ircd/irssi-config

0
syndicate-examples/ircd/main.rkt → OLD-syndicate-examples/ircd/main.rkt

0
syndicate-examples/ircd/message.rkt → OLD-syndicate-examples/ircd/message.rkt

0
syndicate-examples/ircd/protocol.rkt → OLD-syndicate-examples/ircd/protocol.rkt

0
syndicate-examples/ircd/session.rkt → OLD-syndicate-examples/ircd/session.rkt

0
syndicate-examples/netstack/Makefile → OLD-syndicate-examples/netstack/Makefile

0
syndicate-examples/netstack/README.md → OLD-syndicate-examples/netstack/README.md

0
syndicate-examples/netstack/TODO.md → OLD-syndicate-examples/netstack/TODO.md

0
syndicate-examples/netstack/arp.rkt → OLD-syndicate-examples/netstack/arp.rkt

0
syndicate-examples/netstack/checksum.rkt → OLD-syndicate-examples/netstack/checksum.rkt

0
syndicate-examples/netstack/configuration.rkt → OLD-syndicate-examples/netstack/configuration.rkt

0
syndicate-examples/netstack/demo-config.rkt → OLD-syndicate-examples/netstack/demo-config.rkt

0
syndicate-examples/netstack/dump-bytes.rkt → OLD-syndicate-examples/netstack/dump-bytes.rkt

0
syndicate-examples/netstack/ethernet.rkt → OLD-syndicate-examples/netstack/ethernet.rkt

0
syndicate-examples/netstack/fetchurl.rkt → OLD-syndicate-examples/netstack/fetchurl.rkt

0
syndicate-examples/netstack/ip.rkt → OLD-syndicate-examples/netstack/ip.rkt

0
syndicate-examples/netstack/main.rkt → OLD-syndicate-examples/netstack/main.rkt

0
syndicate-examples/netstack/port-allocator.rkt → OLD-syndicate-examples/netstack/port-allocator.rkt

0
syndicate-examples/netstack/tcp.rkt → OLD-syndicate-examples/netstack/tcp.rkt

0
syndicate-examples/netstack/udp.rkt → OLD-syndicate-examples/netstack/udp.rkt

0
syndicate-examples/private/beautiful-grassland-wallpapers-1920x1080.jpg → OLD-syndicate-examples/private/beautiful-grassland-wallpapers-1920x1080.jpg

Before

Width: 1920  |  Height: 1080  |  Size: 250 KiB

After

Width: 1920  |  Height: 1080  |  Size: 250 KiB

0
syndicate-examples/private/sounds/270302__littlerobotsoundfactory__collect-point-02.wav → OLD-syndicate-examples/private/sounds/270302__littlerobotsoundfactory__collect-point-02.wav

0
syndicate-examples/private/sounds/270303__littlerobotsoundfactory__collect-point-01.wav → OLD-syndicate-examples/private/sounds/270303__littlerobotsoundfactory__collect-point-01.wav

0
syndicate-examples/private/sounds/270304__littlerobotsoundfactory__collect-point-00.wav → OLD-syndicate-examples/private/sounds/270304__littlerobotsoundfactory__collect-point-00.wav

0
syndicate-examples/private/sounds/270305__littlerobotsoundfactory__climb-rope-loop-00.wav → OLD-syndicate-examples/private/sounds/270305__littlerobotsoundfactory__climb-rope-loop-00.wav

0
syndicate-examples/private/sounds/270306__littlerobotsoundfactory__explosion-02.wav → OLD-syndicate-examples/private/sounds/270306__littlerobotsoundfactory__explosion-02.wav

0
syndicate-examples/private/sounds/270307__littlerobotsoundfactory__explosion-01.wav → OLD-syndicate-examples/private/sounds/270307__littlerobotsoundfactory__explosion-01.wav

0
syndicate-examples/private/sounds/270308__littlerobotsoundfactory__explosion-00.wav → OLD-syndicate-examples/private/sounds/270308__littlerobotsoundfactory__explosion-00.wav

0
syndicate-examples/private/sounds/270309__littlerobotsoundfactory__craft-00.wav → OLD-syndicate-examples/private/sounds/270309__littlerobotsoundfactory__craft-00.wav

0
syndicate-examples/private/sounds/270310__littlerobotsoundfactory__explosion-04.wav → OLD-syndicate-examples/private/sounds/270310__littlerobotsoundfactory__explosion-04.wav

0
syndicate-examples/private/sounds/270311__littlerobotsoundfactory__explosion-03.wav → OLD-syndicate-examples/private/sounds/270311__littlerobotsoundfactory__explosion-03.wav

0
syndicate-examples/private/sounds/270315__littlerobotsoundfactory__menu-navigate-03.wav → OLD-syndicate-examples/private/sounds/270315__littlerobotsoundfactory__menu-navigate-03.wav

0
syndicate-examples/private/sounds/270316__littlerobotsoundfactory__open-00.wav → OLD-syndicate-examples/private/sounds/270316__littlerobotsoundfactory__open-00.wav

0
syndicate-examples/private/sounds/270317__littlerobotsoundfactory__jump-01.wav → OLD-syndicate-examples/private/sounds/270317__littlerobotsoundfactory__jump-01.wav

0
syndicate-examples/private/sounds/270318__littlerobotsoundfactory__jump-02.wav → OLD-syndicate-examples/private/sounds/270318__littlerobotsoundfactory__jump-02.wav

0
syndicate-examples/private/sounds/270319__littlerobotsoundfactory__jingle-win-01.wav → OLD-syndicate-examples/private/sounds/270319__littlerobotsoundfactory__jingle-win-01.wav

0
syndicate-examples/private/sounds/270320__littlerobotsoundfactory__jump-00.wav → OLD-syndicate-examples/private/sounds/270320__littlerobotsoundfactory__jump-00.wav

0
syndicate-examples/private/sounds/270321__littlerobotsoundfactory__menu-navigate-01.wav → OLD-syndicate-examples/private/sounds/270321__littlerobotsoundfactory__menu-navigate-01.wav

0
syndicate-examples/private/sounds/270322__littlerobotsoundfactory__menu-navigate-02.wav → OLD-syndicate-examples/private/sounds/270322__littlerobotsoundfactory__menu-navigate-02.wav

0
syndicate-examples/private/sounds/270323__littlerobotsoundfactory__jump-03.wav → OLD-syndicate-examples/private/sounds/270323__littlerobotsoundfactory__jump-03.wav

0
syndicate-examples/private/sounds/270324__littlerobotsoundfactory__menu-navigate-00.wav → OLD-syndicate-examples/private/sounds/270324__littlerobotsoundfactory__menu-navigate-00.wav

0
syndicate-examples/private/sounds/270325__littlerobotsoundfactory__hit-02.wav → OLD-syndicate-examples/private/sounds/270325__littlerobotsoundfactory__hit-02.wav

0
syndicate-examples/private/sounds/270326__littlerobotsoundfactory__hit-01.wav → OLD-syndicate-examples/private/sounds/270326__littlerobotsoundfactory__hit-01.wav

0
syndicate-examples/private/sounds/270327__littlerobotsoundfactory__hit-00.wav → OLD-syndicate-examples/private/sounds/270327__littlerobotsoundfactory__hit-00.wav

0
syndicate-examples/private/sounds/270328__littlerobotsoundfactory__hero-death-00.wav → OLD-syndicate-examples/private/sounds/270328__littlerobotsoundfactory__hero-death-00.wav

0
syndicate-examples/private/sounds/270329__littlerobotsoundfactory__jingle-lose-00.wav → OLD-syndicate-examples/private/sounds/270329__littlerobotsoundfactory__jingle-lose-00.wav

0
syndicate-examples/private/sounds/270330__littlerobotsoundfactory__jingle-achievement-01.wav → OLD-syndicate-examples/private/sounds/270330__littlerobotsoundfactory__jingle-achievement-01.wav

0
syndicate-examples/private/sounds/270331__littlerobotsoundfactory__jingle-achievement-00.wav → OLD-syndicate-examples/private/sounds/270331__littlerobotsoundfactory__jingle-achievement-00.wav

0
syndicate-examples/private/sounds/270332__littlerobotsoundfactory__hit-03.wav → OLD-syndicate-examples/private/sounds/270332__littlerobotsoundfactory__hit-03.wav

0
syndicate-examples/private/sounds/270333__littlerobotsoundfactory__jingle-win-00.wav → OLD-syndicate-examples/private/sounds/270333__littlerobotsoundfactory__jingle-win-00.wav

0
syndicate-examples/private/sounds/270334__littlerobotsoundfactory__jingle-lose-01.wav → OLD-syndicate-examples/private/sounds/270334__littlerobotsoundfactory__jingle-lose-01.wav

0
syndicate-examples/private/sounds/270335__littlerobotsoundfactory__shoot-03.wav → OLD-syndicate-examples/private/sounds/270335__littlerobotsoundfactory__shoot-03.wav

0
syndicate-examples/private/sounds/270336__littlerobotsoundfactory__shoot-02.wav → OLD-syndicate-examples/private/sounds/270336__littlerobotsoundfactory__shoot-02.wav

0
syndicate-examples/private/sounds/270337__littlerobotsoundfactory__pickup-00.wav → OLD-syndicate-examples/private/sounds/270337__littlerobotsoundfactory__pickup-00.wav

0
syndicate-examples/private/sounds/270338__littlerobotsoundfactory__open-01.wav → OLD-syndicate-examples/private/sounds/270338__littlerobotsoundfactory__open-01.wav

0
syndicate-examples/private/sounds/270339__littlerobotsoundfactory__pickup-02.wav → OLD-syndicate-examples/private/sounds/270339__littlerobotsoundfactory__pickup-02.wav

0
syndicate-examples/private/sounds/270340__littlerobotsoundfactory__pickup-01.wav → OLD-syndicate-examples/private/sounds/270340__littlerobotsoundfactory__pickup-01.wav

0
syndicate-examples/private/sounds/270341__littlerobotsoundfactory__pickup-04.wav → OLD-syndicate-examples/private/sounds/270341__littlerobotsoundfactory__pickup-04.wav

0
syndicate-examples/private/sounds/270342__littlerobotsoundfactory__pickup-03.wav → OLD-syndicate-examples/private/sounds/270342__littlerobotsoundfactory__pickup-03.wav

0
syndicate-examples/private/sounds/270343__littlerobotsoundfactory__shoot-01.wav → OLD-syndicate-examples/private/sounds/270343__littlerobotsoundfactory__shoot-01.wav

0
syndicate-examples/private/sounds/270344__littlerobotsoundfactory__shoot-00.wav → OLD-syndicate-examples/private/sounds/270344__littlerobotsoundfactory__shoot-00.wav

0
syndicate-examples/private/sounds/_readme_and_license.txt → OLD-syndicate-examples/private/sounds/_readme_and_license.txt

0
syndicate-examples/santa.rkt → OLD-syndicate-examples/santa.rkt

0
syndicate-examples/server-chat-client.rkt → OLD-syndicate-examples/server-chat-client.rkt

0
syndicate-examples/simple-cross-layer.rkt → OLD-syndicate-examples/simple-cross-layer.rkt

0
syndicate-examples/sqlite.rkt → OLD-syndicate-examples/sqlite.rkt

0
syndicate-examples/stdin-echo.rkt → OLD-syndicate-examples/stdin-echo.rkt

0
syndicate-examples/time.rkt → OLD-syndicate-examples/time.rkt

0
syndicate-examples/udp-echo.rkt → OLD-syndicate-examples/udp-echo.rkt

0
syndicate-examples/udp-multicast.rkt → OLD-syndicate-examples/udp-multicast.rkt

0
syndicate-examples/web-core.rkt → OLD-syndicate-examples/web-core.rkt

638
OLD-syndicate/dataspace.rkt

@ -0,0 +1,638 @@
#lang racket/base
;;; SPDX-License-Identifier: LGPL-3.0-or-later
;;; SPDX-FileCopyrightText: Copyright © 2010-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
(provide make-dataspace ;; TODO: how to cleanly provide this?
with-current-facet ;; TODO: shouldn't be provided
with-non-script-context ;; TODO: shouldn't be provided
run-scripts! ;; TODO: how to cleanly provide this?
apply-patch! ;; TODO: DEFINITELY SHOULDN'T BE PROVIDED - needed by relay.rkt
dataspace?
dataspace-assertions ;; TODO: shouldn't be provided - needed by various tests
dataspace-routing-table ;; TODO: shouldn't be provided - needed by relay.rkt
generate-id! ;; TODO: shouldn't be provided - inline syntax.rkt??
actor?
actor-id
actor-name
actor-dataspace ;; TODO: should this be provided?
facet?
facet-actor
facet-live?
field-handle ;; TODO: shouldn't be provided - inline syntax.rkt??
field-handle?
field-handle-name
field-handle-id
field-handle-owner
field-handle-value
current-actor-crash-logger
current-actor
current-facet
in-script? ;; TODO: shouldn't be provided - inline syntax.rkt??
capture-facet-context ;; TODO: shouldn't be provided - inline syntax.rkt??
suspend-script* ;; TODO: shouldn't be provided - inline syntax.rkt??
add-facet!
stop-facet!
add-stop-script! ;; TODO: shouldn't be provided - inline syntax.rkt??
add-endpoint!
remove-endpoint!
terminate-facet! ;; TODO: shouldn't be provided - inline syntax.rkt??
schedule-script! ;; TODO: shouldn't be provided - inline syntax.rkt??
push-script! ;; TODO: shouldn't be provided - inline syntax.rkt??
ensure-in-script! ;; TODO: shouldn't be provided - inline syntax.rkt??
spawn! ;; TODO: should this be provided?
enqueue-send! ;; TODO: should this be provided?
enqueue-deferred-turn! ;; TODO: should this be provided?
adhoc-retract! ;; TODO: should this be provided?
adhoc-assert! ;; TODO: should this be provided?
actor-adhoc-assertions ;; TODO: should this be provided?
)
(require syndicate/dataflow)
(require racket/match)
(require racket/set)
(require (only-in racket/exn exn->string))
(require "functional-queue.rkt")
(require "skeleton.rkt")
(require "pattern.rkt")
(require "bag.rkt")
(require "reflection.rkt")
;; An `ActorID` uniquely identifies an actor in a `Dataspace`.
;; A `FID` is a Facet ID, uniquely identifying a facet in a `Dataspace`.
;; A `Dataspace` is a ... TODO
;; An `Action` is one of
;; - `(patch (MutableDeltaof Assertion))`
;; - `(message Assertion)`
;; - `(spawn Any BootProc (Set Assertion))`
;; - `(quit)`
;; - `(deferred-turn (-> Any))`
(struct patch (changes) #:prefab)
(struct message (body) #:prefab)
(struct spawn (name boot-proc initial-assertions) #:prefab)
(struct quit () #:prefab)
(struct deferred-turn (continuation) #:prefab)
(struct dataspace ([next-id #:mutable] ;; Nat
routing-table ;; Skeleton
;; v TODO: Caches have to be bags, not sets; once
;; this change is made, can I avoid keeping a bag
;; of assertions in the dataspace as a whole?
assertions ;; (MutableBagof Assertion)
dataflow ;; DataflowGraph
[runnable #:mutable] ;; (Listof Actor)
[pending-actions #:mutable] ;; (Queueof ActionGroup)
) #:transparent)
(struct actor (id ;; ActorID
dataspace ;; Dataspace
name ;; Any
[root-facet #:mutable] ;; (Option Facet)
[runnable? #:mutable] ;; Boolean
pending-scripts ;; (MutableVectorof (Queueof (-> Any)))
[pending-actions #:mutable] ;; (Queueof Action)
[adhoc-assertions #:mutable] ;; (Bagof Assertion)
[cleanup-changes #:mutable] ;; (Deltaof Assertion)
)
#:methods gen:custom-write
[(define (write-proc a p mode)
(fprintf p "#<actor ~a ~v>" (actor-id a) (actor-name a)))])
(struct action-group (actor ;; (U Actor 'meta)
actions ;; (Listof Action)
)
#:transparent)
(struct facet (id ;; FID
[live? #:mutable] ;; Boolean
actor ;; Actor
parent ;; (Option Facet)
endpoints ;; (MutableHash EID Endpoint)
[stop-scripts #:mutable] ;; (Listof Script) -- IN REVERSE ORDER
[children #:mutable] ;; (Seteqof Facet)
)
#:methods gen:custom-write
[(define (write-proc f p mode)
(local-require (only-in racket/string string-join))
(define (facet-id-chain f)
(if f
(cons (number->string (facet-id f)) (facet-id-chain (facet-parent f)))
'()))
(fprintf p "#<facet ~a ~v ~a>"
(actor-id (facet-actor f))
(actor-name (facet-actor f))
(string-join (facet-id-chain f) ":")))])
(struct endpoint (id ;; EID
[assertion #:mutable] ;; Assertion
[handler #:mutable] ;; (Option SkInterest)
update-fn ;; (-> (Values Assertion (Option SkInterest)))
)
#:methods gen:custom-write
[(define (write-proc e p mode)
(fprintf p "#<endpoint ~a>" (endpoint-id e)))])
;; TODO: the field ownership checks during field-ref/field-set! might
;; be quite expensive. Are they worth it?
(struct field-handle (name ;; Symbol
id ;; Nat
owner ;; Actor
[value #:mutable] ;; Any
)
#:methods gen:custom-write
[(define (write-proc f port mode)
(fprintf port "#<field-handle:~a:~a>" (field-handle-name f) (field-handle-id f)))]
#:property prop:procedure
(case-lambda
[(f)
(define ac (current-actor))
(when (not (eq? (field-handle-owner f) ac)) (field-scope-error 'field-ref f))
(dataflow-record-observation! (dataspace-dataflow (actor-dataspace ac)) f)
(field-handle-value f)]
[(f v)
(define ac (current-actor))
(when (not (eq? (field-handle-owner f) (current-actor))) (field-scope-error 'field-set! f))
(when (not (equal? (field-handle-value f) v))
(dataflow-record-damage! (dataspace-dataflow (actor-dataspace ac)) f)
(set-field-handle-value! f v))]))
(define (field-scope-error who f)
(error who "Field ~a used out-of-scope; owner = ~a, current = ~a"
f
(field-handle-owner f)
(current-actor)))
;; Parameterof (Actor Exn -> Void)
(define current-actor-crash-logger
(make-parameter
(lambda (a e)
(log-error "Actor ~a died with exception:\n~a" a (exn->string e)))))
(define (current-actor) (facet-actor (current-facet)))
;; Parameterof Facet
(define current-facet (make-parameter #f))
;; Parameterof Boolean
(define in-script? (make-parameter #t))
;;---------------------------------------------------------------------------
;; Script priorities. These are used to ensure that the results of
;; some *side effects* are visible to certain pieces of code.
(module priorities racket/base
(require (for-syntax racket/base))
(define-syntax (define-priority-levels stx)
(let loop ((counter 0) (stx (syntax-case stx ()
[(_ level ...) #'(level ...)])))
(syntax-case stx ()
[()
#'(void)]
[(#:count c)
#`(begin (define c #,counter)
(provide c))]
[(this-level more ...)
#`(begin (define this-level #,counter)
(provide this-level)
#,(loop (+ counter 1) #'(more ...)))])))
(define-priority-levels ;; highest-priority to lowest-priority
*query-priority-high*
*query-priority*
*query-handler-priority*
*normal-priority*
*gc-priority*
*idle-priority*
#:count priority-count))
(require (submod "." priorities))
;;---------------------------------------------------------------------------
(define (make-dataspace boot-proc)
(dataspace 0
(make-empty-skeleton)
(make-bag)
(make-dataflow-graph)
'()
(enqueue (make-queue) (action-group 'meta (list (spawn #f boot-proc (set)))))))
(define (generate-id! ds)
(let ((id (dataspace-next-id ds)))
(set-dataspace-next-id! ds (+ id 1))
id))
(define (add-actor! ds name boot-proc initial-assertions)
(define the-actor-id (generate-id! ds))
(define filtered-initial-assertions (set-remove initial-assertions (void)))
(define initial-delta (set->bag filtered-initial-assertions +1))
(define the-actor (actor the-actor-id
ds
name
#f
#f
(make-vector priority-count (make-queue))
(make-queue)
initial-delta
(bag)))
(apply-patch! ds the-actor initial-delta)
;; Root facet is a dummy "system" facet that exists to hold one-or-more "user" "root" facets.
(add-facet! #f
the-actor
#f
(lambda ()
;; The "true root", user-visible facet.
(add-facet! #f
the-actor
(current-facet)
(lambda ()
(boot-proc)))
(for [(a filtered-initial-assertions)]
(adhoc-retract! the-actor a)))))
(define-syntax-rule (with-current-facet [f0] body ...)
(let ((f f0))
;; (when (not f)
;; (error 'with-current-facet "Cannot use with-current-facet this way"))
(parameterize ((current-facet f))
(with-handlers ([(lambda (e) (not (exn:break? e)))
(lambda (e)
(define a (current-actor))
((current-actor-crash-logger) a e)
(abandon-queued-work! a)
;; v Supply #f for `emit-patches?` here
;; because we are in an uncertain limbo after
;; discarding previously-queued actions.
;; Instead of emitting patches to orderly
;; tear down assertions from endpoints, we
;; rely on the recorded `cleanup-changes`.
(terminate-actor! a #f e))]) ;; TODO: tracing
(call-with-syndicate-prompt
(lambda ()
body ...))
(void)))))
(define-syntax-rule (with-non-script-context body ...)
(parameterize ((in-script? #f))
body ...))
(define (capture-facet-context proc)
(let ((f (current-facet)))
;; (when (not f)
;; (error 'capture-facet-context "Cannot capture non-facet"))
(lambda args
(with-current-facet [f]
(apply proc args)))))
(define (pop-next-script! ac)
(define priority-levels (actor-pending-scripts ac))
(let loop ((level 0))
(and (< level (vector-length priority-levels))
(let ((q (vector-ref priority-levels level)))
(if (queue-empty? q)
(loop (+ level 1))
(let-values (((script q) (dequeue q)))
(vector-set! priority-levels level q)
script))))))
(define (run-actor-pending-scripts! ds ac)
(let loop ()
(let ((script (pop-next-script! ac)))
(and script
(begin (script)
(refresh-facet-assertions! ds)
(loop))))))
(define (refresh-facet-assertions! ds)
(with-non-script-context
(dataflow-repair-damage! (dataspace-dataflow ds)
(lambda (subject-id)
(match-define (list f eid) subject-id)
(when (facet-live? f) ;; TODO: necessary test, or tautological?
(define ac (facet-actor f))
(with-current-facet [f]
(define ep (hash-ref (facet-endpoints f) eid))
(match-define (endpoint _ old-assertion old-handler update-fn) ep)
(define-values (new-assertion new-handler) (update-fn))
(when (not (equal? old-assertion new-assertion))
(retract! ac old-assertion)
(when old-handler (dataspace-unsubscribe! ds old-handler))
(set-endpoint-assertion! ep new-assertion)
(set-endpoint-handler! ep new-handler)
(assert! ac new-assertion)
(when new-handler (dataspace-subscribe! ds new-handler)))))))))
(define (commit-actions! ds ac)
(define pending (queue->list (actor-pending-actions ac)))
;; (log-info "commit-actions!: ~a actions ~a" ac pending)
(when (pair? pending)
(set-actor-pending-actions! ac (make-queue))
(set-dataspace-pending-actions! ds (enqueue (dataspace-pending-actions ds)
(action-group ac pending)))))
(define (run-all-pending-scripts! ds)
(define runnable (dataspace-runnable ds))
(set-dataspace-runnable! ds '())
(for [(ac (in-list runnable))]
(run-actor-pending-scripts! ds ac)
(set-actor-runnable?! ac #f)
(commit-actions! ds ac)))
(define (perform-pending-actions! ds)
(define groups (queue->list (dataspace-pending-actions ds)))
(set-dataspace-pending-actions! ds (make-queue))
(for [(group (in-list groups))]
(match-define (action-group ac actions) group)
(for [(action (in-list actions))]
;; (log-info "~a in ~a performing ~a" ac (eq-hash-code ds) action)
(match action
[(patch delta)
(apply-patch! ds ac delta)]
[(message body)
(send-assertion! (dataspace-routing-table ds) body)]
[(spawn name boot-proc initial-assertions)
(add-actor! ds name boot-proc initial-assertions)]
[(quit)
(apply-patch! ds ac (actor-cleanup-changes ac))]
[(deferred-turn k)
(push-script! ac k)])
(run-all-pending-scripts! ds))))
(define (apply-patch! ds ac delta)
(when (not (bag-empty? delta))
(define ds-assertions (dataspace-assertions ds))
;; (log-info "apply-patch! ~a ~v" ac delta)
;; (for [((a c) (in-bag/count ds-assertions))] (log-info " . ~v = ~v" a c))
;; (for [((a c) (in-bag/count delta))] (log-info " → ~v = ~v" a c))
(define rt (dataspace-routing-table ds))
(define pending-removals '())
(define new-cleanup-changes
(for/fold [(cleanup-changes (actor-cleanup-changes ac))] [((a count) (in-bag/count delta))]
(match (bag-change! ds-assertions a count)
['present->absent (set! pending-removals (cons a pending-removals))]
['absent->present (add-assertion! rt a)]
;; 'absent->absent absurd
['present->present (void)]) ;; i.e. no visible change
(define-values (updated-bag _summary) (bag-change cleanup-changes a (- count)))
updated-bag))
(for [(a (in-list pending-removals))]
(remove-assertion! rt a))
(set-actor-cleanup-changes! ac new-cleanup-changes)))
(define (run-scripts! ds)
(run-all-pending-scripts! ds)
(perform-pending-actions! ds)
;; TODO: figure out when a dataspace should quit itself. Given the
;; mutable nature of the implementation, maybe never? It might be
;; being held elsewhere!
(not (and (null? (dataspace-runnable ds))
(queue-empty? (dataspace-pending-actions ds)))))
(define (add-facet! where actor parent boot-proc)
(when (and (not (in-script?)) where)
(error 'add-facet!
"~a: Cannot add facet outside script; are you missing an (on ...)?"
where))
(define f (facet (generate-id! (actor-dataspace actor))
#t
actor
parent
(make-hash)
'()
(seteq)))
(if parent
(set-facet-children! parent (set-add (facet-children parent) f))
(begin
(when (actor-root-facet actor)
;; This should never happen. We deliberately create an
;; otherwise-dummy root facet for each actor specifically to
;; hold user facets, and there should be no way for the user
;; to stop that root facet explicitly, which means user code
;; can't start any replacements for it at all, let alone
;; more than one!
(error 'add-facet! "INTERNAL ERROR: Attempt to add second root facet"))
(set-actor-root-facet! actor f)))
(with-current-facet [f]
(with-non-script-context
(boot-proc)))
(push-script! actor (lambda ()
(when (or (and parent (not (facet-live? parent))) (facet-inert? f))
(terminate-facet! f)))))
(define (facet-inert? f)
(and (hash-empty? (facet-endpoints f))
(set-empty? (facet-children f))))
(define (schedule-script! #:priority [priority *normal-priority*] ac thunk)
(push-script! #:priority priority ac (capture-facet-context thunk)))
(define (push-script! #:priority [priority *normal-priority*] ac thunk-with-context)
(when (not (actor-runnable? ac))
(set-actor-runnable?! ac #t)
(let ((ds (actor-dataspace ac)))
(set-dataspace-runnable! ds (cons ac (dataspace-runnable ds)))))
(define v (actor-pending-scripts ac))
(vector-set! v priority (enqueue (vector-ref v priority) thunk-with-context)))
(define (retract-facet-assertions-and-subscriptions! f emit-patches?)
(define ac (facet-actor f))
(define ds (actor-dataspace ac))
(push-script! ac (lambda ()
(for [((eid ep) (in-hash (facet-endpoints f)))]
(destroy-endpoint! ds ac f ep emit-patches?))
(hash-clear! (facet-endpoints f)))))
(define (abandon-queued-work! ac)
(set-actor-pending-actions! ac (make-queue))
(let ((scripts (actor-pending-scripts ac)))
(for [(i (in-range (vector-length scripts)))]
(vector-set! scripts i (make-queue)))))
;; Abruptly terminates an entire actor, without running stop-scripts etc.
(define (terminate-actor! the-actor emit-patches? maybe-exn)
(when emit-patches?
(push-script! the-actor (lambda () (for [(a (in-bag (actor-adhoc-assertions the-actor)))]
(retract! the-actor a)))))
(let ((f (actor-root-facet the-actor)))
(when f
(let abort-facet! ((f f))
(set-facet-live?! f #f)
(for [(child (in-set (facet-children f)))] (abort-facet! child))
(retract-facet-assertions-and-subscriptions! f emit-patches?))))
(push-script! the-actor (lambda ()
(let ((name (actor-name the-actor)))
(when name
(enqueue-send! the-actor (terminated name maybe-exn))))
(enqueue-action! the-actor (quit)))))
;; Cleanly terminates a facet and its children, running stop-scripts etc.
(define (terminate-facet! f)
(when (facet-live? f)
(define ac (facet-actor f))
(define parent (facet-parent f))
(if parent
(set-facet-children! parent (set-remove (facet-children parent) f))
(set-actor-root-facet! ac #f))
(set-facet-live?! f #f)
(for [(child (in-set (facet-children f)))] (terminate-facet! child))
;; Run stop-scripts after terminating children. This means that
;; children's stop-scripts run before ours.
(push-script! ac (lambda ()
(with-current-facet [f]
(for [(script (in-list (reverse (facet-stop-scripts f))))]
(script)))))
(retract-facet-assertions-and-subscriptions! f #t)
(push-script! #:priority *gc-priority* ac
(lambda ()
(if parent
(when (facet-inert? parent) (terminate-facet! parent))
(terminate-actor! ac #t #f))))))
(define (stop-facet! f stop-script)
(define ac (facet-actor f))
(with-current-facet [(facet-parent f)] ;; run in parent context wrt terminating facet
(schedule-script! ac (lambda ()
(terminate-facet! f)
(schedule-script! ac stop-script)))))
(define (add-stop-script! f script-proc)
(set-facet-stop-scripts! f (cons script-proc (facet-stop-scripts f))))
(define (add-endpoint! f where dynamic? update-fn)
(when (in-script?)
(error 'add-endpoint!
"~a: Cannot add endpoint in script; are you missing a (react ...)?"
where))
(define ds (actor-dataspace (facet-actor f)))
(define eid (generate-id! ds))
(define-values (assertion handler)
(parameterize ((current-dataflow-subject-id (if dynamic? (list f eid) #f)))
(call-with-syndicate-prompt update-fn)))
(define ep (endpoint eid assertion handler update-fn))
(assert! (facet-actor f) assertion)
(when handler (dataspace-subscribe! ds handler))
(hash-set! (facet-endpoints f) eid ep)
eid)
(define (remove-endpoint! f eid)
(define eps (facet-endpoints f))
(define ep (hash-ref eps eid #f))
(when ep
(define ac (facet-actor f))
(define ds (actor-dataspace ac))
(destroy-endpoint! ds ac f ep #t)
(hash-remove! eps eid)))
(define (destroy-endpoint! ds ac f ep emit-patches?)
(match-define (endpoint eid assertion handler _update-fn) ep)
(dataflow-forget-subject! (dataspace-dataflow ds) (list f eid))
(when emit-patches? (retract! ac assertion))
(when handler (dataspace-unsubscribe! ds handler)))
(define (enqueue-action! ac action)
(set-actor-pending-actions! ac (enqueue (actor-pending-actions ac) action)))
(define (ensure-patch-action! ac)
(let ((q (actor-pending-actions ac)))
(when (or (queue-empty? q) (not (patch? (queue-last q))))
(enqueue-action! ac (patch (make-bag)))))
(patch-changes (queue-last (actor-pending-actions ac))))
(define (retract! ac assertion)
(when (not (void? assertion))
(bag-change! (ensure-patch-action! ac) assertion -1)))
(define (assert! ac assertion)
(when (not (void? assertion))
(bag-change! (ensure-patch-action! ac) assertion +1)))
(define (adhoc-retract! ac assertion [count 1])
(when (not (void? assertion))
(define-values (new-assertions summary)
(bag-change (actor-adhoc-assertions ac) assertion (- count) #:clamp? #t))
(set-actor-adhoc-assertions! ac new-assertions)
(match summary
;; 'absent->present absurd (if the call to `adhoc-retract!`
;; matches a previous `adhoc-assert!`)
['present->absent (retract! ac assertion)]
['present->present (void)]
['absent->absent (void)]))) ;; can happen if we're exploiting the clamping
(define (adhoc-assert! ac assertion [count 1])
(when (not (void? assertion))
(define-values (new-assertions summary)
(bag-change (actor-adhoc-assertions ac) assertion count))
(set-actor-adhoc-assertions! ac new-assertions)
(match summary
;; 'absent->absent and 'present->absent absurd (assuming there
;; haven't been too many calls to `adhoc-retract!` in the past)
['absent->present (assert! ac assertion)]
['present->present (void)])))
(define (dataspace-unsubscribe! ds h)
(remove-interest! (dataspace-routing-table ds) h))
(define (dataspace-subscribe! ds h)
(add-interest! (dataspace-routing-table ds) h))
(define (ensure-in-script! who)
(when (not (in-script?))
(error who "Attempt to perform action outside script; are you missing an (on ...)?")))
(define (enqueue-send! ac body)
(enqueue-action! ac (message body)))
(define (enqueue-deferred-turn! ac k)
(enqueue-action! ac (deferred-turn (capture-facet-context k))))
(define (spawn! ac name boot-proc initial-assertions)
(enqueue-action! ac (spawn name boot-proc initial-assertions)))
;;---------------------------------------------------------------------------
;; Script suspend-and-resume.
(define prompt-tag (make-continuation-prompt-tag 'syndicate))
(define (call-with-syndicate-prompt thunk)
(call-with-continuation-prompt thunk prompt-tag))
(define (suspend-script* where proc)
(when (not (in-script?))
(error 'suspend-script
"~a: Cannot suspend script outside script; are you missing an (on ...)?"
where))
(call-with-composable-continuation
(lambda (k)
(abort-current-continuation
prompt-tag
(lambda ()
(define in? (in-script?))
(define raw-resume-parent
(capture-facet-context
(lambda results
(parameterize ((in-script? in?))
(apply k results)))))
(define resume-parent
(lambda results
(push-script! (current-actor)
(lambda () (apply raw-resume-parent results)))))
(proc resume-parent))))
prompt-tag))

0
syndicate/distributed.rkt → OLD-syndicate/distributed.rkt

0
syndicate/distributed/buffer.rkt → OLD-syndicate/distributed/buffer.rkt

0
syndicate/distributed/client.rkt → OLD-syndicate/distributed/client.rkt

0
syndicate/distributed/client/loopback.rkt → OLD-syndicate/distributed/client/loopback.rkt

0
syndicate/distributed/client/tcp.rkt → OLD-syndicate/distributed/client/tcp.rkt

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save