示例#1
0
文件: Sender.cs 项目: beomyeol/reef
 private Sender(
     StreamingNetworkService<GeneralGroupCommunicationMessage> networkService,
     IIdentifierFactory idFactory)
 {
     _networkService = networkService;
     _idFactory = idFactory;
 }
示例#2
0
        public GroupCommClient(
            [Parameter(typeof(GroupCommConfigurationOptions.SerializedGroupConfigs))] ISet<string> groupConfigs,
            [Parameter(typeof(TaskConfigurationOptions.Identifier))] string taskId,
            StreamingNetworkService<GeneralGroupCommunicationMessage> networkService,
            AvroConfigurationSerializer configSerializer,
            IInjector injector)
        {
            _commGroups = new Dictionary<string, ICommunicationGroupClientInternal>();
            _networkService = networkService;

            foreach (string serializedGroupConfig in groupConfigs)
            {
                IConfiguration groupConfig = configSerializer.FromString(serializedGroupConfig);
                IInjector groupInjector = injector.ForkInjector(groupConfig);
                var commGroupClient = (ICommunicationGroupClientInternal)groupInjector.GetInstance<ICommunicationGroupClient>();
                _commGroups[commGroupClient.GroupName] = commGroupClient;
            }

            networkService.Register(new StringIdentifier(taskId));

            foreach (var group in _commGroups.Values)
            {
               group.WaitingForRegistration();
            }
        }
示例#3
0
        private OperatorTopology(
            [Parameter(typeof(GroupCommConfigurationOptions.OperatorName))] string operatorName,
            [Parameter(typeof(GroupCommConfigurationOptions.CommunicationGroupName))] string groupName,
            [Parameter(typeof(TaskConfigurationOptions.Identifier))] string taskId,
            [Parameter(typeof(GroupCommConfigurationOptions.Timeout))] int timeout,
            [Parameter(typeof(GroupCommConfigurationOptions.RetryCountWaitingForRegistration))] int retryCount,
            [Parameter(typeof(GroupCommConfigurationOptions.SleepTimeWaitingForRegistration))] int sleepTime,
            [Parameter(typeof(GroupCommConfigurationOptions.TopologyRootTaskId))] string rootId,
            [Parameter(typeof(GroupCommConfigurationOptions.TopologyChildTaskIds))] ISet <string> childIds,
            StreamingNetworkService <GeneralGroupCommunicationMessage> networkService,
            Sender sender)
        {
            _operatorName = operatorName;
            _groupName    = groupName;
            _selfId       = taskId;
            _timeout      = timeout;
            _retryCount   = retryCount;
            _sleepTime    = sleepTime;
            _nameClient   = networkService.NamingClient;
            _sender       = sender;

            _parent = _selfId.Equals(rootId) ? null : new NodeStruct <T>(rootId);

            foreach (var childId in childIds)
            {
                _childNodeContainer.PutNode(new NodeStruct <T>(childId));
            }
        }
示例#4
0
        public GroupCommClient(
            [Parameter(typeof(GroupCommConfigurationOptions.SerializedGroupConfigs))] ISet <string> groupConfigs,
            [Parameter(typeof(TaskConfigurationOptions.Identifier))] string taskId,
            StreamingNetworkService <GeneralGroupCommunicationMessage> networkService,
            AvroConfigurationSerializer configSerializer,
            IInjector injector)
        {
            _commGroups     = new Dictionary <string, ICommunicationGroupClientInternal>();
            _networkService = networkService;

            foreach (string serializedGroupConfig in groupConfigs)
            {
                IConfiguration groupConfig     = configSerializer.FromString(serializedGroupConfig);
                IInjector      groupInjector   = injector.ForkInjector(groupConfig);
                var            commGroupClient = (ICommunicationGroupClientInternal)groupInjector.GetInstance <ICommunicationGroupClient>();
                _commGroups[commGroupClient.GroupName] = commGroupClient;
            }

            networkService.Register(new StringIdentifier(taskId));

            foreach (var group in _commGroups.Values)
            {
                group.WaitingForRegistration();
            }
        }
示例#5
0
文件: Sender.cs 项目: TaeHunKim/reef
 private Sender(
     StreamingNetworkService <GeneralGroupCommunicationMessage> networkService,
     IIdentifierFactory idFactory)
 {
     _networkService = networkService;
     _idFactory      = idFactory;
 }
示例#6
0
        public GroupCommClient(
            [Parameter(typeof(GroupCommConfigurationOptions.SerializedGroupConfigs))] ISet <string> groupConfigs,
            [Parameter(typeof(TaskConfigurationOptions.Identifier))] string taskId,
            StreamingNetworkService <GeneralGroupCommunicationMessage> networkService,
            AvroConfigurationSerializer configSerializer,
            IInjector injector)
        {
            _commGroups     = new Dictionary <string, ICommunicationGroupClientInternal>();
            _networkService = networkService;

            foreach (string serializedGroupConfig in groupConfigs)
            {
                IConfiguration groupConfig     = configSerializer.FromString(serializedGroupConfig);
                IInjector      groupInjector   = injector.ForkInjector(groupConfig);
                var            commGroupClient = (ICommunicationGroupClientInternal)groupInjector.GetInstance <ICommunicationGroupClient>();
                _commGroups[commGroupClient.GroupName] = commGroupClient;
            }

            networkService.Register(new StringIdentifier(taskId));

            try
            {
                foreach (var group in _commGroups.Values)
                {
                    group.WaitingForRegistration();
                }
            }
            catch (SystemException e)
            {
                networkService.Unregister();
                networkService.Dispose();
                Exceptions.CaughtAndThrow(e, Level.Error, "In GroupCommClient, exception from WaitingForRegistration.", Logger);
            }
        }
示例#7
0
        private OperatorTopology(
            [Parameter(typeof(GroupCommConfigurationOptions.OperatorName))] string operatorName,
            [Parameter(typeof(GroupCommConfigurationOptions.CommunicationGroupName))] string groupName,
            [Parameter(typeof(TaskConfigurationOptions.Identifier))] string taskId,
            [Parameter(typeof(GroupCommConfigurationOptions.Timeout))] int timeout,
            [Parameter(typeof(GroupCommConfigurationOptions.RetryCountWaitingForRegistration))] int retryCount,
            [Parameter(typeof(GroupCommConfigurationOptions.SleepTimeWaitingForRegistration))] int sleepTime,
            [Parameter(typeof(GroupCommConfigurationOptions.TopologyRootTaskId))] string rootId,
            [Parameter(typeof(GroupCommConfigurationOptions.TopologyChildTaskIds))] ISet <string> childIds,
            StreamingNetworkService <GeneralGroupCommunicationMessage> networkService,
            Sender sender)
        {
            _operatorName  = operatorName;
            _groupName     = groupName;
            _selfId        = taskId;
            _timeout       = timeout;
            _retryCount    = retryCount;
            _sleepTime     = sleepTime;
            _nameClient    = networkService.NamingClient;
            _sender        = sender;
            _nodesWithData = new BlockingCollection <NodeStruct <T> >();
            _children      = new List <NodeStruct <T> >();
            _idToNodeMap   = new Dictionary <string, NodeStruct <T> >();

            if (_selfId.Equals(rootId))
            {
                _parent = null;
            }
            else
            {
                _parent = new NodeStruct <T>(rootId);
                _idToNodeMap[rootId] = _parent;
            }
            foreach (var childId in childIds)
            {
                var node = new NodeStruct <T>(childId);
                _children.Add(node);
                _idToNodeMap[childId] = node;
            }
        }
示例#8
0
        private OperatorTopology(
            [Parameter(typeof(GroupCommConfigurationOptions.OperatorName))] string operatorName,
            [Parameter(typeof(GroupCommConfigurationOptions.CommunicationGroupName))] string groupName,
            [Parameter(typeof(TaskConfigurationOptions.Identifier))] string taskId,
            [Parameter(typeof(GroupCommConfigurationOptions.Timeout))] int timeout,
            [Parameter(typeof(GroupCommConfigurationOptions.RetryCountWaitingForRegistration))] int retryCount,
            [Parameter(typeof(GroupCommConfigurationOptions.SleepTimeWaitingForRegistration))] int sleepTime,
            [Parameter(typeof(GroupCommConfigurationOptions.TopologyRootTaskId))] string rootId,
            [Parameter(typeof(GroupCommConfigurationOptions.TopologyChildTaskIds))] ISet <string> childIds,
            GroupCommNetworkObserver networkObserver,
            StreamingNetworkService <GeneralGroupCommunicationMessage> networkService,
            Sender sender)
        {
            _operatorName = operatorName;
            _groupName    = groupName;
            _selfId       = taskId;
            _timeout      = timeout;
            _retryCount   = retryCount;
            _sleepTime    = sleepTime;
            _nameClient   = networkService.NamingClient;
            _sender       = sender;
            _parent       = _selfId.Equals(rootId) ? null : new NodeStruct <T>(rootId, groupName, operatorName);

            // Register the observers for Task IDs and nodes adjacent to the current node
            // in the group communication graph.
            if (_parent != null)
            {
                networkObserver.RegisterAndGetForTask(_parent.Identifier).RegisterNodeObserver(new NodeMessageObserver <T>(_parent));
            }

            foreach (var childId in childIds)
            {
                var childNode = new NodeStruct <T>(childId, groupName, operatorName);
                _childNodeContainer.PutNode(childNode);
                networkObserver.RegisterAndGetForTask(childId).RegisterNodeObserver(new NodeMessageObserver <T>(childNode));
            }
        }
 public TaskMessageObserver(StreamingNetworkService <GeneralGroupCommunicationMessage> networkService)
 {
     _networkService = networkService;
 }