コード例 #1
0
        public object Any(Ls request)
        {
            var result = DfsUtils.listFiles();

            return(new LsResponse {
                Result = new List <FileHeader>(result.Item1.Values.ToArray()), inactiveWorkers = result.Item2
            });
        }
コード例 #2
0
        public object Get(GetFile request)
        {
            var result = DfsUtils.readFileFromDfs(request.FileName);

            return(new GetFileResponse {
                Result = result
            });
        }
コード例 #3
0
        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));
        }
コード例 #4
0
 public object Put(SaveFile request)
 {
     DfsUtils.saveFileInDfs(request.file, request.numOfReplicas);
     return(new SaveFileResponse());
 }
コード例 #5
0
 public object Delete(DeleteFile request)
 {
     DfsUtils.deleteFileFromDfs(request.FileName);
     return(new DeleteFileResponse());
 }
コード例 #6
0
        public static List <string> getActiveWorkers()
        {
            var lsResult = DfsUtils.listFiles();

            return(WorkersUtil.listOfWorkers.Except(lsResult.Item2).ToList());
        }