-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from amplab/ui
Merge UI Branch
- Loading branch information
Showing
23 changed files
with
655 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ data/ | |
logs/ | ||
src/main/java/tachyon/thrift | ||
tachyon.iml | ||
target/ | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,6 @@ | |
* @author Haoyuan Li [email protected] | ||
*/ | ||
public class MasterInfo { | ||
public static final String SEPARATOR = "/"; | ||
public static final String COL = "COL_"; | ||
|
||
private final Logger LOG = LoggerFactory.getLogger(MasterInfo.class); | ||
|
@@ -226,7 +225,7 @@ public int createRawTable(String path, int columns, List<Byte> metadata) | |
int id = createFile(path, true, columns, metadata); | ||
|
||
for (int k = 0; k < columns; k ++) { | ||
createFile(path + SEPARATOR + COL + k, true); | ||
createFile(path + Config.SEPARATOR + COL + k, true); | ||
} | ||
|
||
return id; | ||
|
@@ -272,7 +271,6 @@ public List<ClientFileInfo> getFilesInfo(String path) | |
throw new FileDoesNotExistException(path); | ||
} | ||
|
||
ret.add(getClientFileInfo(inode.getId())); | ||
if (inode.isDirectory()) { | ||
List<Integer> childernIds = ((InodeFolder) inode).getChildrenIds(); | ||
|
||
|
@@ -284,11 +282,22 @@ public List<ClientFileInfo> getFilesInfo(String path) | |
ret.add(getClientFileInfo(k)); | ||
} | ||
} | ||
} else { | ||
ret.add(getClientFileInfo(inode.getId())); | ||
} | ||
|
||
return ret; | ||
} | ||
|
||
public ClientFileInfo getFileInfo(String path) | ||
throws FileDoesNotExistException, InvalidPathException { | ||
Inode inode = getInode(path); | ||
if (inode == null) { | ||
throw new FileDoesNotExistException(path); | ||
} | ||
return getClientFileInfo(inode.getId()); | ||
} | ||
|
||
public void delete(int id) { | ||
LOG.info("delete(" + id + ")"); | ||
// Only remove meta data from master. The data in workers will be evicted since no further | ||
|
@@ -367,21 +376,14 @@ private Inode getInode(String[] pathNames) throws InvalidPathException { | |
} | ||
} | ||
|
||
private static void validatePath(String path) throws InvalidPathException { | ||
if (path == null || !path.startsWith(SEPARATOR) || | ||
(path.length() > 1 && path.endsWith(SEPARATOR))) { | ||
throw new InvalidPathException("Path " + path + " is invalid."); | ||
} | ||
} | ||
|
||
private static String[] getPathNames(String path) throws InvalidPathException { | ||
validatePath(path); | ||
if (path.length() == 1 && path.equals(SEPARATOR)) { | ||
CommonUtils.validatePath(path); | ||
if (path.length() == 1 && path.equals(Config.SEPARATOR)) { | ||
String[] ret = new String[1]; | ||
ret[0] = ""; | ||
return ret; | ||
} | ||
return path.split(SEPARATOR); | ||
return path.split(Config.SEPARATOR); | ||
} | ||
|
||
private void writeCheckpoint() { | ||
|
@@ -472,7 +474,7 @@ private void recoveryFromLog() { | |
public String toHtml() { | ||
long timeMs = System.currentTimeMillis() - START_TIME_MS; | ||
StringBuilder sb = new StringBuilder("<h1> Tachyon has been running @ " + MASTER_ADDRESS + | ||
" for " + CommonUtils.convertMillis(timeMs) + " </h1> \n"); | ||
" for " + CommonUtils.convertMsToClockTime(timeMs) + " </h1> \n"); | ||
|
||
sb.append(mWhiteList.toHtml("WhiteList")); | ||
|
||
|
@@ -513,7 +515,7 @@ private int generateFileNamesForHtml(String curPath, Inode inode, StringBuilder | |
if (inode.isDirectory()) { | ||
List<Integer> childrenIds = ((InodeFolder) inode).getChildrenIds(); | ||
if (inode.getId() != 1) { | ||
curPath += SEPARATOR; | ||
curPath += Config.SEPARATOR; | ||
} | ||
for (int id : childrenIds) { | ||
int t = generateFileNamesForHtml(curPath, mInodes.get(id), sb, cnt); | ||
|
@@ -715,9 +717,9 @@ private String getPath(Inode inode) { | |
return "/"; | ||
} | ||
if (inode.getParentId() == 1) { | ||
return SEPARATOR + inode.getName(); | ||
return Config.SEPARATOR + inode.getName(); | ||
} | ||
return getPath(mInodes.get(inode.getParentId())) + SEPARATOR + inode.getName(); | ||
return getPath(mInodes.get(inode.getParentId())) + Config.SEPARATOR + inode.getName(); | ||
} | ||
} | ||
|
||
|
@@ -897,6 +899,10 @@ public long registerWorker(NetAddress workerNetAddress, long totalBytes, | |
return id; | ||
} | ||
|
||
public long getStarttimeMs() { | ||
return START_TIME_MS; | ||
} | ||
|
||
public int getNumberOfFiles(String path) throws InvalidPathException, FileDoesNotExistException { | ||
Inode inode = getInode(path); | ||
if (inode == null) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.