Skip to content

Commit 4d00f8e

Browse files
ktosoyim-leedrexin
authored
+doc #439 Cluster docs revamp, full page with samples and discussions (#441)
* =doc more info in readme * =doc speed up api: macro processing by calling git only once per run * =doc allow Cluster.Member to resolve to right api docs location * +doc #439 Cluster docs revamp, full page with samples and discussions * +doc add more Working with Cluster.Events docs * Apply suggestions from code review Co-Authored-By: Yim Lee <[email protected]> * Apply suggestions from code review Co-Authored-By: Dario Rexin <[email protected]> * Apply suggestions from code review Co-Authored-By: Yim Lee <[email protected]> Co-authored-by: Yim Lee <[email protected]> Co-authored-by: Dario Rexin <[email protected]>
1 parent 687a6e3 commit 4d00f8e

40 files changed

+1324
-661
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ We require that your commit messages match our template. The easiest way to do t
7070

7171
### Test on Linux
7272

73-
Swift Distributed Actors uses XCTest to run tests on both macOS and Linux. While the macOS version of XCTest is able to use the Objective-C runtime to discover tests at execution time, the Linux version is not. For this reason, whenever you add new tests you will want to run a script that generates the hooks needed to run those tests on Linux, or our CI will complain that the tests are not all present on Linux. To do this, merely execute `ruby generate_linux_tests.rb` at the root of the package and check the changes it made.
73+
Swift Distributed Actors uses XCTest to run tests on both macOS and Linux. While the macOS version of XCTest is able to use the Objective-C runtime to discover tests at execution time, the Linux version is not. For this reason, whenever you add new tests you will want to run a script that generates the hooks needed to run those tests on Linux, or our CI will complain that the tests are not all present on Linux. To do this, merely execute `./scripts/generate_linux_tests.rb` at the root of the package and check the changes it made.
7474

7575
## How to contribute your work
7676

Docs/SWIM.adoc

Lines changed: 0 additions & 97 deletions
This file was deleted.

Docs/actors_overview.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
[[actors]]
31
[[actors_overview]]
42
== Actors Overview
53

Docs/behaviors.adoc

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ You might be curious how the message type looks like, now that we've seen a beha
103103
In our example we do not yet worry about the serialization of the messages, so it can be in fact any type,
104104
however we strongly recommend
105105

106+
[[spawning_actors]]
107+
[[spawning_behaviors]]
106108
=== Spawning Actors
107109

108110
TIP: Starting actors is referred to as "spawning" them. In the same way one refers to spawning new threads by a thread pool or operating system.
@@ -397,26 +399,24 @@ the following situation:
397399
- messages sent to the "old" api:ActorRef[struct] are instead piped to the `/system/deadLetters` queue and may be logged for diagnosing potential control flow issues in the application.
398400

399401
[[receptionist]]
400-
=== Locating actors using the Receptionist
402+
=== Locating Actors using the Receptionist
401403

402-
The receptionist is a system actor that allows users to register actors under a :api:Receptionist[enum,alias='Receptionist.RegistrationKey'] so that
404+
The receptionist is a system actor that allows users to register actors under a api:Receptionist[enum,alias='Receptionist.RegistrationKey'] so that
403405
it can be looked up in other parts of the system. Usually actor references should be passed around to allow actors to communicate,
404406
but there are cases where this is not convenient or possible. One such example is communication in a cluster. To share a reference
405407
with another node in the cluster, we have to send that reference to it, but that is only possible, if we already have a reference
406408
to an actor on that node. So by registering the actors we want to make accessible from other nodes in the cluster, we have a way
407409
of sharing them by communicating with a local ref only. The registered actors will then automatically be made available on all
408410
nodes in the cluster and can be looked up by sending a message to the local receptionist.
409411

410-
*Example*
411-
412412
First we need to register the actor on the node it lives on. This is usually done in the `.setup` behavior.
413413

414414
[source]
415415
----
416416
include::{dir_sact_doc_tests}/ActorDocExamples.swift[tag=receptionist_register]
417417
----
418418
<1> Create the key under which the actor will be registered (can be re-used between calls)
419-
<2> Send `api:Receptionist[enum,alias='Receptionist.Register']` message to receptionist to register the actor
419+
<2> Send a api:Receptionist[enum,alias='register'] message to receptionist to register the actor under given `key`
420420

421421
Now we can lookup all actors that are registered under that key.
422422

@@ -556,6 +556,7 @@ This will lead to growth of the mailbox and can cause significant delays in mess
556556
used with caution and only when absolutely necessary and with reasonably small timeouts to avoid problems caused by unresponsive
557557
services.
558558

559+
[[event_stream]]
559560
=== EventStream
560561

561562
An `EventStream` allows actors to subscribe to events published by one or more other actors.
@@ -571,3 +572,8 @@ include::{dir_sact_doc_tests}/ActorDocExamples.swift[tag=eventStream]
571572
<2> Subscribe `ref` to receive events from the stream
572573
<3> Publish on event to all subscribers
573574
<4> Unsubscribe `ref` from the event stream
575+
576+
[[subreceive]]
577+
=== SubReceive
578+
579+
#TODO: Document context.subReceive, a powerful function that allows receiving other types of messages, regardless of the owning Behavior type.#

0 commit comments

Comments
 (0)