public object Any(Ls request) { var result = DfsUtils.listFiles(); return(new LsResponse { Result = new List <FileHeader>(result.Item1.Values.ToArray()), inactiveWorkers = result.Item2 }); }
public object Get(GetFile request) { var result = DfsUtils.readFileFromDfs(request.FileName); return(new GetFileResponse { Result = result }); }
public static List <TaskAssigment> scheduleMRJob(string fileIn, string fileOut) { var listResult = DfsUtils.listFiles(); var listOfActiveWorker = WorkersUtil.listOfWorkers.Except(listResult.Item2).ToList(); var files = listResult.Item1; if (files.ContainsKey(fileOut)) { throw new ArgumentException("Output file already exists!"); } if (!files.ContainsKey(fileIn)) { throw new ArgumentException("Input file does not exists!"); } if (files [fileIn].corrupted) { throw new ArgumentException("Input file is corrupted: starting MapReduce is inpossible!"); } return(assignTaskToWorkers(files [fileIn], listOfActiveWorker)); }
public object Put(SaveFile request) { DfsUtils.saveFileInDfs(request.file, request.numOfReplicas); return(new SaveFileResponse()); }
public object Delete(DeleteFile request) { DfsUtils.deleteFileFromDfs(request.FileName); return(new DeleteFileResponse()); }
public static List <string> getActiveWorkers() { var lsResult = DfsUtils.listFiles(); return(WorkersUtil.listOfWorkers.Except(lsResult.Item2).ToList()); }