aboutsummaryrefslogtreecommitdiff
path: root/doc/service-communication.tm
diff options
context:
space:
mode:
Diffstat (limited to 'doc/service-communication.tm')
-rw-r--r--doc/service-communication.tm37
1 files changed, 36 insertions, 1 deletions
diff --git a/doc/service-communication.tm b/doc/service-communication.tm
index cf8d96f..5f6cdf9 100644
--- a/doc/service-communication.tm
+++ b/doc/service-communication.tm
@@ -493,7 +493,42 @@
493 493
494 <\explain> 494 <\explain>
495 <scm|\<less\>server\<gtr\>><index|\<less\>server\<gtr\>><label|\<less\>server\<gtr\>> 495 <scm|\<less\>server\<gtr\>><index|\<less\>server\<gtr\>><label|\<less\>server\<gtr\>>
496 </explain|<todo|???>> 496 <|explain>
497 The record type of server objects. The control channel and terminal
498 condition can be retrieved with <scm|server-terminal-condition> and
499 <scm|server-control-channel> respectively. In practice, you will need to
500 define a subtype of <scm|\<less\>server\<gtr\>> with
501 <scm|define-record-type> from R6RS. That way, new fields can be added and
502 a type predicate becomes available.
503
504 <\example>
505 The server type of <acronym|NSE> (network size estimation) is
506 implemented more-or-less like this:
507
508 <\scm>
509 (define-record-type (\<less\>server:nse\<gtr\> make-server
510 server:nse?)
511
512 \ \ (parent \<less\>server\<gtr\>)
513
514 \ \ (fields (immutable estimate/box server-estimate/box))
515
516 \ \ (protocol
517
518 \ \ \ \ (lambda (%make)
519
520 \ \ \ \ \ \ (lambda ()
521
522 \ \ \ \ \ \ \ \ ((%make) (make-atomic-box #false))))))
523
524 (define server (make-server))
525
526 (server:nse? server) ; -\<gtr\> #true
527
528 (atomic-box? (server-estimate/box)) ; -\<gtr\> #true
529 </scm>
530 </example>
531 </explain>
497 532
498 <\explain> 533 <\explain>
499 <scm|(maybe-send-control-message! <var|server> . <var|message>)> 534 <scm|(maybe-send-control-message! <var|server> . <var|message>)>