Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
 public Reducer(
     IReducing <TKey, TValueIn, TValueOut> reducingPhase,
     RpcMapReduceService.RpcMapReduceServiceClient rpcClient,
     WorkerSettings settings)
 {
     _reducingPhase = reducingPhase;
     _rpcClient     = rpcClient;
     _settings      = settings;
 }