示例#1
0
文件: Worker.cs 项目: Banyc/MapReduce
        public Worker(
            WorkerSettings settings,
            RpcClientFactory rpcClientFactory,
            IMapping <TKey, TValueIn> mappingPhase,
            IReducing <TKey, TValueIn, TValueOut> reducingPhase,
            IPartitioning <TKey, TValueIn> partitioningPhase)
        {
            _settings          = settings;
            _mappingPhase      = mappingPhase;
            _reducingPhase     = reducingPhase;
            _partitioningPhase = partitioningPhase;
            _workerInfoDto     = new()
            {
                WorkerUuid = settings.WorkerUuid
            };
            _channel         = rpcClientFactory.CreateRpcChannel();
            _heartBeatTicker = new()
            {
                Interval = TimeSpan.FromSeconds(4).TotalMilliseconds
            };
            StartHeartbeat();
        }

        public void Dispose()
        {
            _heartBeatTicker.Dispose();
            _channel.Dispose();
        }
示例#2
0
 public Reducer(
     IReducing <TKey, TValueIn, TValueOut> reducingPhase,
     RpcMapReduceService.RpcMapReduceServiceClient rpcClient,
     WorkerSettings settings)
 {
     _reducingPhase = reducingPhase;
     _rpcClient     = rpcClient;
     _settings      = settings;
 }