private CommunicationGroupClient( [Parameter(typeof(GroupCommConfigurationOptions.CommunicationGroupName))] string groupName, [Parameter(typeof(GroupCommConfigurationOptions.SerializedOperatorConfigs))] ISet <string> operatorConfigs, IGroupCommNetworkObserver groupCommNetworkObserver, AvroConfigurationSerializer configSerializer, ICommunicationGroupNetworkObserver commGroupNetworkHandler, IInjector injector) { _operators = new Dictionary <string, object>(); GroupName = groupName; groupCommNetworkObserver.Register(groupName, commGroupNetworkHandler); foreach (string operatorConfigStr in operatorConfigs) { IConfiguration operatorConfig = configSerializer.FromString(operatorConfigStr); IInjector operatorInjector = injector.ForkInjector(operatorConfig); string operatorName = operatorInjector.GetNamedInstance <GroupCommConfigurationOptions.OperatorName, string>( GenericType <GroupCommConfigurationOptions.OperatorName> .Class); string msgType = operatorInjector.GetNamedInstance <GroupCommConfigurationOptions.MessageType, string>( GenericType <GroupCommConfigurationOptions.MessageType> .Class); Type groupCommOperatorGenericInterface = typeof(IGroupCommOperator <>); Type groupCommOperatorInterface = groupCommOperatorGenericInterface.MakeGenericType(Type.GetType(msgType)); var operatorObj = operatorInjector.GetInstance(groupCommOperatorInterface); _operators.Add(operatorName, operatorObj); } }
private ReduceReceiver( [Parameter(typeof(GroupCommConfigurationOptions.OperatorName))] string operatorName, [Parameter(typeof(GroupCommConfigurationOptions.CommunicationGroupName))] string groupName, [Parameter(typeof(GroupCommConfigurationOptions.Initialize))] bool initialize, OperatorTopology <PipelineMessage <T> > topology, ICommunicationGroupNetworkObserver networkHandler, IReduceFunction <T> reduceFunction, IPipelineDataConverter <T> dataConverter) { OperatorName = operatorName; GroupName = groupName; Version = PipelineVersion; ReduceFunction = reduceFunction; PipelineDataConverter = dataConverter; _pipelinedReduceFunc = new PipelinedReduceFunction <T>(ReduceFunction); _topology = topology; var msgHandler = Observer.Create <GeneralGroupCommunicationMessage>(message => topology.OnNext(message)); networkHandler.Register(operatorName, msgHandler); if (initialize) { topology.Initialize(); } }
private ScatterReceiver( [Parameter(typeof(GroupCommConfigurationOptions.OperatorName))] string operatorName, [Parameter(typeof(GroupCommConfigurationOptions.CommunicationGroupName))] string groupName, [Parameter(typeof(GroupCommConfigurationOptions.Initialize))] bool initialize, OperatorTopology <T> topology, ICommunicationGroupNetworkObserver networkHandler) { OperatorName = operatorName; GroupName = groupName; Version = DefaultVersion; _topology = topology; _initialize = initialize; var msgHandler = Observer.Create <GeneralGroupCommunicationMessage>(message => topology.OnNext(message)); networkHandler.Register(operatorName, msgHandler); }
private BroadcastSender( [Parameter(typeof(GroupCommConfigurationOptions.OperatorName))] string operatorName, [Parameter(typeof(GroupCommConfigurationOptions.CommunicationGroupName))] string groupName, [Parameter(typeof(GroupCommConfigurationOptions.Initialize))] bool initialize, OperatorTopology <PipelineMessage <T> > topology, ICommunicationGroupNetworkObserver networkHandler, IPipelineDataConverter <T> dataConverter) { _topology = topology; OperatorName = operatorName; GroupName = groupName; Version = PipelineVersion; PipelineDataConverter = dataConverter; _initialize = initialize; var msgHandler = Observer.Create <GeneralGroupCommunicationMessage>(message => topology.OnNext(message)); networkHandler.Register(operatorName, msgHandler); }