コード例 #1
0
 public Task <Empty> MapDoneAsync(MapOutputInfoDto request)
 {
     Console.WriteLine($"[info] {request.WorkerInfo.WorkerUuid}: Map done.");
     Console.WriteLine($"[info] {request.WorkerInfo.WorkerUuid}: Files are:");
     foreach (var fileInfo in request.FileInfos)
     {
         Console.WriteLine($"[info] {fileInfo.FilePath}");
     }
     lock (_mapTasks)
     {
         var mapTask = _mapTasks.Find(xxxx => xxxx.Assignee?.WorkerUuid == request.WorkerInfo.WorkerUuid);
         if (mapTask != null)
         {
             mapTask.Assignee.AssignedTask = null;
             mapTask.Assignee           = null;
             mapTask.CompletedFileInfos = new List <SimpleFileInfo>();
             foreach (var fileInfo in request.FileInfos)
             {
                 mapTask.CompletedFileInfos.Add(new()
                 {
                     FilePath       = fileInfo.FilePath,
                     FileSize       = fileInfo.FileSize,
                     PartitionIndex = fileInfo.PartitionIndex
                 });
             }
         }
         return(Task.FromResult(new Empty()));
     }
 }
コード例 #2
0
 public override Task <Empty> MapDone(MapOutputInfoDto request, ServerCallContext context)
 {
     return(_master.MapDoneAsync(request));
 }