Topology

Hosts (Surround.Host)

data Topology   = Standalone | ClusterOnly | Hybrid
data HostConfig                   -- topology, this node, the cluster nodes, what it hosts, the frames' guard
data Host
data ActorClient = LocalClient … | RemoteClient …
Function Type Meaning
hostConfig Topology -> NodeEndpoint -> [NodeEndpoint] -> [Hosting] -> HostConfig A configuration
guardedBy FrameGuard -> HostConfig -> HostConfig Seal the frames
validate HostConfig -> [String] Warnings about a configuration
startHost ActorSystem -> HostConfig -> Either Fault Host Start it
hostClient Host -> ActorClient Its client
hostTopology Host -> Topology Its topology
askRoute ActorClient -> String -> String -> Bytes -> Int -> Either Fault Bytes Ask a route
tellRoute ActorClient -> String -> String -> Bytes -> () Tell a route

Configuration (Surround.Config)

Function Type Meaning
hostConfigFromEnv [Hosting] -> HostConfig From ACTOR_TOPOLOGY, NODE_HOST, NODE_PORT, SEEDS, FORTRESS_IDENTITY
nodeIdFromEnv () -> String NODE_ID
hostingAlso [Hosting] -> HostConfig -> HostConfig More hostings
topologyNamed String -> Topology "cluster", "hybrid", else standalone

Hosting classes (Cluster.Class, Cluster.Satellite)

data Hosted  = HostedMsg String Bytes (Maybe (Reply (Either Fault Bytes)))   -- type name, payload, reply
data Hosting                                                                -- a route template and a maker
Function Type Meaning
hostingOf Actor a => (ActorSystem -> Parameters -> Address a) -> Hosting Host a class by its @route
hosting String -> (ActorSystem -> Parameters -> ActorRef Hosted) -> Hosting Host by a template
answer Maybe (Reply (Either Fault Bytes)) -> Either Fault Bytes -> () Answer a hosted ask

The cluster’s roles

Function Type
Node.startClusterNodeWith ActorSystem -> NodeEndpoint -> [NodeEndpoint] -> Either Fault (ActorRef NodeMsg)
Node.startGuardedClusterNodeWith ActorSystem -> NodeEndpoint -> FrameGuard -> [NodeEndpoint] -> Either Fault (ActorRef NodeMsg)
Sat.startSatellite ActorSystem -> NodeEndpoint -> [NodeEndpoint] -> [Hosting] -> Either Fault (ActorRef SatelliteMsg)
Sat.startGuardedSatellite ActorSystem -> NodeEndpoint -> FrameGuard -> [NodeEndpoint] -> [Hosting] -> Either Fault (ActorRef SatelliteMsg)
Ast.startAsteroid ActorSystem -> NodeEndpoint -> [NodeEndpoint] -> Either Fault (ActorRef AsteroidMsg)
Ast.startGuardedAsteroid ActorSystem -> NodeEndpoint -> FrameGuard -> [NodeEndpoint] -> Either Fault (ActorRef AsteroidMsg)
Ast.askRemote ActorRef AsteroidMsg -> String -> String -> Bytes -> Int -> Either Fault Bytes
Ast.tellRemote ActorRef AsteroidMsg -> String -> String -> Bytes -> ()

NodeEndpoint host port (Network.Envelope) names a node.

Frames (Fortress.Guard, Network.Transport)

Function Type Meaning
fortressGuard String -> FrameGuard Seal every frame with keys from the cluster’s secret (Fortress.Guard)
openGuard FrameGuard Frames as they are, the default (Network.Transport)

Event streams

Function Type
Topic.topic ActorSystem -> String -> ActorRef (Topic event)
Topic.subscribe, Topic.unsubscribe ActorRef (Topic event) -> ActorRef event -> ()
Topic.publish ActorRef (Topic event) -> event -> ()
Topic.subscribers ActorRef (Topic event) -> Int
distributedTopic ActorSystem -> String -> NodeEndpoint -> [NodeEndpoint] -> Codec e -> FrameGuard -> Either Fault (DistributedTopic e)
subscribeAll DistributedTopic e -> ActorRef e -> ()
publishAll DistributedTopic e -> e -> ()