Ejemplo n.º 1
0
 private void MapActorToNode(ExternalRouteRegistration routeRegistration, ReceiverIdentifier nodeIdentifier)
 {
     if (!nodeActors.TryGetValue(nodeIdentifier, out var actors))
     {
         actors = new Bcl.HashSet <ReceiverIdentifier>();
         nodeActors[nodeIdentifier] = actors;
     }
     actors.Add(routeRegistration.Route.Receiver);
 }
Ejemplo n.º 2
0
 private void MapActorToMessage(ExternalRouteRegistration routeRegistration)
 {
     if (!actorToMessageMap.TryGetValue(routeRegistration.Route.Receiver, out var actorMessages))
     {
         actorMessages = new Bcl.HashSet <MessageIdentifier>();
         actorToMessageMap[routeRegistration.Route.Receiver] = actorMessages;
     }
     actorMessages.Add(routeRegistration.Route.Message);
 }
Ejemplo n.º 3
0
        private void MapMessageHubToNode(ExternalRouteRegistration routeRegistration, ReceiverIdentifier nodeIdentifier)
        {
            var messageHub = routeRegistration.Route.Receiver;

            if (!nodeMessageHubs.TryGetValue(nodeIdentifier, out var messageHubs))
            {
                messageHubs = new Bcl.HashSet <ReceiverIdentifier>();
                nodeMessageHubs[nodeIdentifier] = messageHubs;
            }
            messageHubs.Add(messageHub);
        }
Ejemplo n.º 4
0
 private Bcl.IDictionary <ReceiverIdentifier, Bcl.HashSet <MessageIdentifier> > MapSocketToActor(InternalRouteRegistration routeRegistration)
 {
     if (!socketToActorMessagesMap.TryGetValue(routeRegistration.DestinationSocket, out var actorMessages))
     {
         actorMessages = new Bcl.Dictionary <ReceiverIdentifier, Bcl.HashSet <MessageIdentifier> >
         {
             [routeRegistration.ReceiverIdentifier] = new Bcl.HashSet <MessageIdentifier>()
         };
         socketToActorMessagesMap[routeRegistration.DestinationSocket] = actorMessages;
     }
     return(actorMessages);
 }
Ejemplo n.º 5
0
        private void MapConnectionToNode(PeerConnection connection)
        {
            var uri = connection.Node.Uri.ToSocketAddress();

            if (!uriToNodeMap.TryGetValue(uri, out var nodes))
            {
                nodes             = new Bcl.HashSet <ReceiverIdentifier>();
                uriToNodeMap[uri] = nodes;
            }

            nodes.Add(new ReceiverIdentifier(connection.Node.SocketIdentity));

            logger.Debug($"[{nodes.Count}] node(s) registered at {uri}.");
        }
Ejemplo n.º 6
0
 private static void MapActorToMessage(InternalRouteRegistration routeRegistration,
                                       Bcl.IDictionary <ReceiverIdentifier, Bcl.HashSet <MessageIdentifier> > actorMessages,
                                       MessageContract messageContract)
 {
     if (!actorMessages.TryGetValue(routeRegistration.ReceiverIdentifier, out var messages))
     {
         messages = new Bcl.HashSet <MessageIdentifier>();
         actorMessages[routeRegistration.ReceiverIdentifier] = messages;
     }
     messages.Add(messageContract.Message);
 }