id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
18,900 | Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/metastore/rocks/RocksStore.java | RocksStore.restoreFromCheckpoint | public synchronized void restoreFromCheckpoint(CheckpointInputStream input) throws IOException {
LOG.info("Restoring rocksdb from checkpoint");
long startNano = System.nanoTime();
Preconditions.checkState(input.getType() == CheckpointType.ROCKS,
"Unexpected checkpoint type in RocksStore: " + input.g... | java | public synchronized void restoreFromCheckpoint(CheckpointInputStream input) throws IOException {
LOG.info("Restoring rocksdb from checkpoint");
long startNano = System.nanoTime();
Preconditions.checkState(input.getType() == CheckpointType.ROCKS,
"Unexpected checkpoint type in RocksStore: " + input.g... | [
"public",
"synchronized",
"void",
"restoreFromCheckpoint",
"(",
"CheckpointInputStream",
"input",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"info",
"(",
"\"Restoring rocksdb from checkpoint\"",
")",
";",
"long",
"startNano",
"=",
"System",
".",
"nanoTime",
"(",
... | Restores the database from a checkpoint.
@param input the checkpoint stream to restore from | [
"Restores",
"the",
"database",
"from",
"a",
"checkpoint",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/metastore/rocks/RocksStore.java#L184-L199 |
18,901 | Alluxio/alluxio | core/common/src/main/java/alluxio/conf/path/TrieNode.java | TrieNode.insert | public TrieNode insert(String path) {
TrieNode current = this;
for (String component : path.split("/")) {
if (!current.mChildren.containsKey(component)) {
current.mChildren.put(component, new TrieNode());
}
current = current.mChildren.get(component);
}
current.mIsTerminal = tru... | java | public TrieNode insert(String path) {
TrieNode current = this;
for (String component : path.split("/")) {
if (!current.mChildren.containsKey(component)) {
current.mChildren.put(component, new TrieNode());
}
current = current.mChildren.get(component);
}
current.mIsTerminal = tru... | [
"public",
"TrieNode",
"insert",
"(",
"String",
"path",
")",
"{",
"TrieNode",
"current",
"=",
"this",
";",
"for",
"(",
"String",
"component",
":",
"path",
".",
"split",
"(",
"\"/\"",
")",
")",
"{",
"if",
"(",
"!",
"current",
".",
"mChildren",
".",
"co... | Inserts a path into the trie.
Each path component forms a node in the trie,
root path "/" will correspond to the root of the trie.
@param path a path with components separated by "/"
@return the last inserted trie node or the last traversed trie node if no node is inserted | [
"Inserts",
"a",
"path",
"into",
"the",
"trie",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/conf/path/TrieNode.java#L38-L48 |
18,902 | Alluxio/alluxio | core/common/src/main/java/alluxio/conf/path/TrieNode.java | TrieNode.search | public List<TrieNode> search(String path) {
List<TrieNode> terminal = new ArrayList<>();
TrieNode current = this;
if (current.mIsTerminal) {
terminal.add(current);
}
for (String component : path.split("/")) {
if (current.mChildren.containsKey(component)) {
current = current.mChil... | java | public List<TrieNode> search(String path) {
List<TrieNode> terminal = new ArrayList<>();
TrieNode current = this;
if (current.mIsTerminal) {
terminal.add(current);
}
for (String component : path.split("/")) {
if (current.mChildren.containsKey(component)) {
current = current.mChil... | [
"public",
"List",
"<",
"TrieNode",
">",
"search",
"(",
"String",
"path",
")",
"{",
"List",
"<",
"TrieNode",
">",
"terminal",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"TrieNode",
"current",
"=",
"this",
";",
"if",
"(",
"current",
".",
"mIsTerminal"... | Traverses the trie along the path components until the traversal cannot proceed any more.
@param path the target path
@return the terminal nodes sorted by the time they are visited | [
"Traverses",
"the",
"trie",
"along",
"the",
"path",
"components",
"until",
"the",
"traversal",
"cannot",
"proceed",
"any",
"more",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/conf/path/TrieNode.java#L56-L73 |
18,903 | Alluxio/alluxio | core/common/src/main/java/alluxio/cli/CommandUtils.java | CommandUtils.checkNumOfArgsEquals | public static void checkNumOfArgsEquals(Command cmd, CommandLine cl, int n) throws
InvalidArgumentException {
if (cl.getArgs().length != n) {
throw new InvalidArgumentException(ExceptionMessage.INVALID_ARGS_NUM
.getMessage(cmd.getCommandName(), n, cl.getArgs().length));
}
} | java | public static void checkNumOfArgsEquals(Command cmd, CommandLine cl, int n) throws
InvalidArgumentException {
if (cl.getArgs().length != n) {
throw new InvalidArgumentException(ExceptionMessage.INVALID_ARGS_NUM
.getMessage(cmd.getCommandName(), n, cl.getArgs().length));
}
} | [
"public",
"static",
"void",
"checkNumOfArgsEquals",
"(",
"Command",
"cmd",
",",
"CommandLine",
"cl",
",",
"int",
"n",
")",
"throws",
"InvalidArgumentException",
"{",
"if",
"(",
"cl",
".",
"getArgs",
"(",
")",
".",
"length",
"!=",
"n",
")",
"{",
"throw",
... | Checks the number of non-option arguments equals n for command.
@param cmd command instance
@param cl parsed commandline arguments
@param n an integer
@throws InvalidArgumentException if the number does not equal n | [
"Checks",
"the",
"number",
"of",
"non",
"-",
"option",
"arguments",
"equals",
"n",
"for",
"command",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/cli/CommandUtils.java#L68-L74 |
18,904 | Alluxio/alluxio | core/common/src/main/java/alluxio/cli/CommandUtils.java | CommandUtils.checkNumOfArgsNoLessThan | public static void checkNumOfArgsNoLessThan(Command cmd, CommandLine cl, int n) throws
InvalidArgumentException {
if (cl.getArgs().length < n) {
throw new InvalidArgumentException(ExceptionMessage.INVALID_ARGS_NUM_INSUFFICIENT
.getMessage(cmd.getCommandName(), n, cl.getArgs().length));
}
... | java | public static void checkNumOfArgsNoLessThan(Command cmd, CommandLine cl, int n) throws
InvalidArgumentException {
if (cl.getArgs().length < n) {
throw new InvalidArgumentException(ExceptionMessage.INVALID_ARGS_NUM_INSUFFICIENT
.getMessage(cmd.getCommandName(), n, cl.getArgs().length));
}
... | [
"public",
"static",
"void",
"checkNumOfArgsNoLessThan",
"(",
"Command",
"cmd",
",",
"CommandLine",
"cl",
",",
"int",
"n",
")",
"throws",
"InvalidArgumentException",
"{",
"if",
"(",
"cl",
".",
"getArgs",
"(",
")",
".",
"length",
"<",
"n",
")",
"{",
"throw",... | Checks the number of non-option arguments is no less than n for command.
@param cmd command instance
@param cl parsed commandline arguments
@param n an integer
@throws InvalidArgumentException if the number is smaller than n | [
"Checks",
"the",
"number",
"of",
"non",
"-",
"option",
"arguments",
"is",
"no",
"less",
"than",
"n",
"for",
"command",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/cli/CommandUtils.java#L84-L90 |
18,905 | Alluxio/alluxio | core/common/src/main/java/alluxio/cli/CommandUtils.java | CommandUtils.checkNumOfArgsNoMoreThan | public static void checkNumOfArgsNoMoreThan(Command cmd, CommandLine cl, int n) throws
InvalidArgumentException {
if (cl.getArgs().length > n) {
throw new InvalidArgumentException(ExceptionMessage.INVALID_ARGS_NUM_TOO_MANY
.getMessage(cmd.getCommandName(), n, cl.getArgs().length));
}
} | java | public static void checkNumOfArgsNoMoreThan(Command cmd, CommandLine cl, int n) throws
InvalidArgumentException {
if (cl.getArgs().length > n) {
throw new InvalidArgumentException(ExceptionMessage.INVALID_ARGS_NUM_TOO_MANY
.getMessage(cmd.getCommandName(), n, cl.getArgs().length));
}
} | [
"public",
"static",
"void",
"checkNumOfArgsNoMoreThan",
"(",
"Command",
"cmd",
",",
"CommandLine",
"cl",
",",
"int",
"n",
")",
"throws",
"InvalidArgumentException",
"{",
"if",
"(",
"cl",
".",
"getArgs",
"(",
")",
".",
"length",
">",
"n",
")",
"{",
"throw",... | Checks the number of non-option arguments is no more than n for command.
@param cmd command instance
@param cl parsed commandline arguments
@param n an integer
@throws InvalidArgumentException if the number is greater than n | [
"Checks",
"the",
"number",
"of",
"non",
"-",
"option",
"arguments",
"is",
"no",
"more",
"than",
"n",
"for",
"command",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/cli/CommandUtils.java#L100-L106 |
18,906 | Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java | CapacityCommand.run | public int run(CommandLine cl) throws IOException {
if (cl.hasOption(ReportCommand.HELP_OPTION_NAME)) {
System.out.println(getUsage());
return 0;
}
GetWorkerReportOptions options = getOptions(cl);
generateCapacityReport(options);
return 0;
} | java | public int run(CommandLine cl) throws IOException {
if (cl.hasOption(ReportCommand.HELP_OPTION_NAME)) {
System.out.println(getUsage());
return 0;
}
GetWorkerReportOptions options = getOptions(cl);
generateCapacityReport(options);
return 0;
} | [
"public",
"int",
"run",
"(",
"CommandLine",
"cl",
")",
"throws",
"IOException",
"{",
"if",
"(",
"cl",
".",
"hasOption",
"(",
"ReportCommand",
".",
"HELP_OPTION_NAME",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"getUsage",
"(",
")",
")",
... | Runs report capacity command.
@param cl CommandLine to get client options
@return 0 on success, 1 otherwise | [
"Runs",
"report",
"capacity",
"command",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java#L73-L82 |
18,907 | Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java | CapacityCommand.generateCapacityReport | public void generateCapacityReport(GetWorkerReportOptions options) throws IOException {
List<WorkerInfo> workerInfoList = mBlockMasterClient.getWorkerReport(options);
if (workerInfoList.size() == 0) {
print("No workers found.");
return;
}
Collections.sort(workerInfoList, new WorkerInfo.LastC... | java | public void generateCapacityReport(GetWorkerReportOptions options) throws IOException {
List<WorkerInfo> workerInfoList = mBlockMasterClient.getWorkerReport(options);
if (workerInfoList.size() == 0) {
print("No workers found.");
return;
}
Collections.sort(workerInfoList, new WorkerInfo.LastC... | [
"public",
"void",
"generateCapacityReport",
"(",
"GetWorkerReportOptions",
"options",
")",
"throws",
"IOException",
"{",
"List",
"<",
"WorkerInfo",
">",
"workerInfoList",
"=",
"mBlockMasterClient",
".",
"getWorkerReport",
"(",
"options",
")",
";",
"if",
"(",
"worker... | Generates capacity report.
@param options GetWorkerReportOptions to get worker report | [
"Generates",
"capacity",
"report",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java#L89-L100 |
18,908 | Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java | CapacityCommand.collectWorkerInfo | private void collectWorkerInfo(List<WorkerInfo> workerInfoList) {
initVariables();
for (WorkerInfo workerInfo : workerInfoList) {
long usedBytes = workerInfo.getUsedBytes();
long capacityBytes = workerInfo.getCapacityBytes();
mSumCapacityBytes += capacityBytes;
mSumUsedBytes += usedBytes... | java | private void collectWorkerInfo(List<WorkerInfo> workerInfoList) {
initVariables();
for (WorkerInfo workerInfo : workerInfoList) {
long usedBytes = workerInfo.getUsedBytes();
long capacityBytes = workerInfo.getCapacityBytes();
mSumCapacityBytes += capacityBytes;
mSumUsedBytes += usedBytes... | [
"private",
"void",
"collectWorkerInfo",
"(",
"List",
"<",
"WorkerInfo",
">",
"workerInfoList",
")",
"{",
"initVariables",
"(",
")",
";",
"for",
"(",
"WorkerInfo",
"workerInfo",
":",
"workerInfoList",
")",
"{",
"long",
"usedBytes",
"=",
"workerInfo",
".",
"getU... | Collects worker capacity information.
@param workerInfoList the worker info list to collect info from | [
"Collects",
"worker",
"capacity",
"information",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java#L107-L141 |
18,909 | Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java | CapacityCommand.printAggregatedInfo | private void printAggregatedInfo(GetWorkerReportOptions options) {
mIndentationLevel = 0;
print(String.format("Capacity information for %s workers: ",
options.getWorkerRange().toString().toLowerCase()));
mIndentationLevel++;
print("Total Capacity: " + FormatUtils.getSizeFromBytes(mSumCapacityBy... | java | private void printAggregatedInfo(GetWorkerReportOptions options) {
mIndentationLevel = 0;
print(String.format("Capacity information for %s workers: ",
options.getWorkerRange().toString().toLowerCase()));
mIndentationLevel++;
print("Total Capacity: " + FormatUtils.getSizeFromBytes(mSumCapacityBy... | [
"private",
"void",
"printAggregatedInfo",
"(",
"GetWorkerReportOptions",
"options",
")",
"{",
"mIndentationLevel",
"=",
"0",
";",
"print",
"(",
"String",
".",
"format",
"(",
"\"Capacity information for %s workers: \"",
",",
"options",
".",
"getWorkerRange",
"(",
")",
... | Prints aggregated worker capacity information.
@param options GetWorkerReportOptions to check if input is invalid | [
"Prints",
"aggregated",
"worker",
"capacity",
"information",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java#L148-L178 |
18,910 | Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java | CapacityCommand.printWorkerInfo | private void printWorkerInfo(List<WorkerInfo> workerInfoList) {
mIndentationLevel = 0;
if (mCapacityTierInfoMap.size() == 0) {
return;
} else if (mCapacityTierInfoMap.size() == 1) {
// Do not print Total value when only one tier exists
printShortWorkerInfo(workerInfoList);
return;
... | java | private void printWorkerInfo(List<WorkerInfo> workerInfoList) {
mIndentationLevel = 0;
if (mCapacityTierInfoMap.size() == 0) {
return;
} else if (mCapacityTierInfoMap.size() == 1) {
// Do not print Total value when only one tier exists
printShortWorkerInfo(workerInfoList);
return;
... | [
"private",
"void",
"printWorkerInfo",
"(",
"List",
"<",
"WorkerInfo",
">",
"workerInfoList",
")",
"{",
"mIndentationLevel",
"=",
"0",
";",
"if",
"(",
"mCapacityTierInfoMap",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"else",
"if",
"(... | Prints worker capacity information.
@param workerInfoList the worker info list to get info from | [
"Prints",
"worker",
"capacity",
"information",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java#L185-L220 |
18,911 | Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java | CapacityCommand.printShortWorkerInfo | private void printShortWorkerInfo(List<WorkerInfo> workerInfoList) {
String tier = mCapacityTierInfoMap.firstKey();
String shortInfoFormat = getInfoFormat(workerInfoList, true);
print(String.format("%n" + shortInfoFormat,
"Worker Name", "Last Heartbeat", "Storage", tier));
for (WorkerInfo info ... | java | private void printShortWorkerInfo(List<WorkerInfo> workerInfoList) {
String tier = mCapacityTierInfoMap.firstKey();
String shortInfoFormat = getInfoFormat(workerInfoList, true);
print(String.format("%n" + shortInfoFormat,
"Worker Name", "Last Heartbeat", "Storage", tier));
for (WorkerInfo info ... | [
"private",
"void",
"printShortWorkerInfo",
"(",
"List",
"<",
"WorkerInfo",
">",
"workerInfoList",
")",
"{",
"String",
"tier",
"=",
"mCapacityTierInfoMap",
".",
"firstKey",
"(",
")",
";",
"String",
"shortInfoFormat",
"=",
"getInfoFormat",
"(",
"workerInfoList",
","... | Prints worker information when only one tier exists.
@param workerInfoList the worker info list to get info from | [
"Prints",
"worker",
"information",
"when",
"only",
"one",
"tier",
"exists",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java#L227-L247 |
18,912 | Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java | CapacityCommand.getInfoFormat | private String getInfoFormat(List<WorkerInfo> workerInfoList, boolean isShort) {
int maxWorkerNameLength = workerInfoList.stream().map(w -> w.getAddress().getHost().length())
.max(Comparator.comparing(Integer::intValue)).get();
int firstIndent = 16;
if (firstIndent <= maxWorkerNameLength) {
//... | java | private String getInfoFormat(List<WorkerInfo> workerInfoList, boolean isShort) {
int maxWorkerNameLength = workerInfoList.stream().map(w -> w.getAddress().getHost().length())
.max(Comparator.comparing(Integer::intValue)).get();
int firstIndent = 16;
if (firstIndent <= maxWorkerNameLength) {
//... | [
"private",
"String",
"getInfoFormat",
"(",
"List",
"<",
"WorkerInfo",
">",
"workerInfoList",
",",
"boolean",
"isShort",
")",
"{",
"int",
"maxWorkerNameLength",
"=",
"workerInfoList",
".",
"stream",
"(",
")",
".",
"map",
"(",
"w",
"->",
"w",
".",
"getAddress"... | Gets the info format according to the longest worker name.
@param workerInfoList the worker info list to get info from
@param isShort whether exists only one tier
@return the info format for printing long/short worker info | [
"Gets",
"the",
"info",
"format",
"according",
"to",
"the",
"longest",
"worker",
"name",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java#L255-L267 |
18,913 | Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java | CapacityCommand.getOptions | private GetWorkerReportOptions getOptions(CommandLine cl) throws IOException {
if (cl.getOptions().length > 1) {
System.out.println(getUsage());
throw new InvalidArgumentException("Too many arguments passed in.");
}
GetWorkerReportOptions workerOptions = GetWorkerReportOptions.defaults();
S... | java | private GetWorkerReportOptions getOptions(CommandLine cl) throws IOException {
if (cl.getOptions().length > 1) {
System.out.println(getUsage());
throw new InvalidArgumentException("Too many arguments passed in.");
}
GetWorkerReportOptions workerOptions = GetWorkerReportOptions.defaults();
S... | [
"private",
"GetWorkerReportOptions",
"getOptions",
"(",
"CommandLine",
"cl",
")",
"throws",
"IOException",
"{",
"if",
"(",
"cl",
".",
"getOptions",
"(",
")",
".",
"length",
">",
"1",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"getUsage",
"(",
"... | Gets the worker info options.
@param cl CommandLine that contains the client options
@return GetWorkerReportOptions to get worker information | [
"Gets",
"the",
"worker",
"info",
"options",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java#L275-L300 |
18,914 | Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java | CapacityCommand.getWorkerFormattedTierValues | private static String getWorkerFormattedTierValues(Map<String, Map<String, String>> map,
String workerName) {
return map.values().stream().map((tierMap)
-> (String.format("%-14s", tierMap.getOrDefault(workerName, "-"))))
.collect(Collectors.joining(""));
} | java | private static String getWorkerFormattedTierValues(Map<String, Map<String, String>> map,
String workerName) {
return map.values().stream().map((tierMap)
-> (String.format("%-14s", tierMap.getOrDefault(workerName, "-"))))
.collect(Collectors.joining(""));
} | [
"private",
"static",
"String",
"getWorkerFormattedTierValues",
"(",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"String",
">",
">",
"map",
",",
"String",
"workerName",
")",
"{",
"return",
"map",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",... | Gets the formatted tier values of a worker.
@param map the map to get worker tier values from
@param workerName name of the worker
@return the formatted tier values of the input worker name | [
"Gets",
"the",
"formatted",
"tier",
"values",
"of",
"a",
"worker",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java#L309-L314 |
18,915 | Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java | CapacityCommand.initVariables | private void initVariables() {
mSumCapacityBytes = 0;
mSumUsedBytes = 0;
mSumCapacityBytesOnTierMap = new TreeMap<>(FileSystemAdminShellUtils::compareTierNames);
mSumUsedBytesOnTierMap = new TreeMap<>(FileSystemAdminShellUtils::compareTierNames);
// TierInfoMap is of form Map<Tier_Name, Map<Worker_... | java | private void initVariables() {
mSumCapacityBytes = 0;
mSumUsedBytes = 0;
mSumCapacityBytesOnTierMap = new TreeMap<>(FileSystemAdminShellUtils::compareTierNames);
mSumUsedBytesOnTierMap = new TreeMap<>(FileSystemAdminShellUtils::compareTierNames);
// TierInfoMap is of form Map<Tier_Name, Map<Worker_... | [
"private",
"void",
"initVariables",
"(",
")",
"{",
"mSumCapacityBytes",
"=",
"0",
";",
"mSumUsedBytes",
"=",
"0",
";",
"mSumCapacityBytesOnTierMap",
"=",
"new",
"TreeMap",
"<>",
"(",
"FileSystemAdminShellUtils",
"::",
"compareTierNames",
")",
";",
"mSumUsedBytesOnTi... | Initializes member variables used to collect worker info. | [
"Initializes",
"member",
"variables",
"used",
"to",
"collect",
"worker",
"info",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java#L319-L328 |
18,916 | Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java | CapacityCommand.print | private void print(String text) {
String indent = Strings.repeat(" ", mIndentationLevel * INDENT_SIZE);
mPrintStream.println(indent + text);
} | java | private void print(String text) {
String indent = Strings.repeat(" ", mIndentationLevel * INDENT_SIZE);
mPrintStream.println(indent + text);
} | [
"private",
"void",
"print",
"(",
"String",
"text",
")",
"{",
"String",
"indent",
"=",
"Strings",
".",
"repeat",
"(",
"\" \"",
",",
"mIndentationLevel",
"*",
"INDENT_SIZE",
")",
";",
"mPrintStream",
".",
"println",
"(",
"indent",
"+",
"text",
")",
";",
"}... | Prints indented information.
@param text information to print | [
"Prints",
"indented",
"information",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/report/CapacityCommand.java#L335-L338 |
18,917 | Alluxio/alluxio | core/common/src/main/java/alluxio/conf/PropertyKey.java | PropertyKey.register | @VisibleForTesting
public static boolean register(PropertyKey key) {
String name = key.getName();
String[] aliases = key.getAliases();
if (DEFAULT_KEYS_MAP.containsKey(name)) {
if (DEFAULT_KEYS_MAP.get(name).isBuiltIn() || !key.isBuiltIn()) {
return false;
}
}
DEFAULT_KEYS_MAP.... | java | @VisibleForTesting
public static boolean register(PropertyKey key) {
String name = key.getName();
String[] aliases = key.getAliases();
if (DEFAULT_KEYS_MAP.containsKey(name)) {
if (DEFAULT_KEYS_MAP.get(name).isBuiltIn() || !key.isBuiltIn()) {
return false;
}
}
DEFAULT_KEYS_MAP.... | [
"@",
"VisibleForTesting",
"public",
"static",
"boolean",
"register",
"(",
"PropertyKey",
"key",
")",
"{",
"String",
"name",
"=",
"key",
".",
"getName",
"(",
")",
";",
"String",
"[",
"]",
"aliases",
"=",
"key",
".",
"getAliases",
"(",
")",
";",
"if",
"(... | Registers the given key to the global key map.
@param key th property
@return whether the property key is successfully registered | [
"Registers",
"the",
"given",
"key",
"to",
"the",
"global",
"key",
"map",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/conf/PropertyKey.java#L4635-L4651 |
18,918 | Alluxio/alluxio | core/common/src/main/java/alluxio/conf/PropertyKey.java | PropertyKey.unregister | @VisibleForTesting
public static void unregister(PropertyKey key) {
String name = key.getName();
DEFAULT_KEYS_MAP.remove(name);
DEFAULT_ALIAS_MAP.remove(name);
} | java | @VisibleForTesting
public static void unregister(PropertyKey key) {
String name = key.getName();
DEFAULT_KEYS_MAP.remove(name);
DEFAULT_ALIAS_MAP.remove(name);
} | [
"@",
"VisibleForTesting",
"public",
"static",
"void",
"unregister",
"(",
"PropertyKey",
"key",
")",
"{",
"String",
"name",
"=",
"key",
".",
"getName",
"(",
")",
";",
"DEFAULT_KEYS_MAP",
".",
"remove",
"(",
"name",
")",
";",
"DEFAULT_ALIAS_MAP",
".",
"remove"... | Unregisters the given key from the global key map.
@param key the property to unregister | [
"Unregisters",
"the",
"given",
"key",
"from",
"the",
"global",
"key",
"map",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/conf/PropertyKey.java#L4658-L4663 |
18,919 | Alluxio/alluxio | core/client/fs/src/main/java/alluxio/client/block/stream/BlockOutStream.java | BlockOutStream.createReplicatedBlockOutStream | public static BlockOutStream createReplicatedBlockOutStream(FileSystemContext context,
long blockId, long blockSize, java.util.List<WorkerNetAddress> workerNetAddresses,
OutStreamOptions options) throws IOException {
List<DataWriter> dataWriters = new ArrayList<>();
for (WorkerNetAddress address: wo... | java | public static BlockOutStream createReplicatedBlockOutStream(FileSystemContext context,
long blockId, long blockSize, java.util.List<WorkerNetAddress> workerNetAddresses,
OutStreamOptions options) throws IOException {
List<DataWriter> dataWriters = new ArrayList<>();
for (WorkerNetAddress address: wo... | [
"public",
"static",
"BlockOutStream",
"createReplicatedBlockOutStream",
"(",
"FileSystemContext",
"context",
",",
"long",
"blockId",
",",
"long",
"blockSize",
",",
"java",
".",
"util",
".",
"List",
"<",
"WorkerNetAddress",
">",
"workerNetAddresses",
",",
"OutStreamOpt... | Creates a new remote block output stream.
@param context the file system context
@param blockId the block id
@param blockSize the block size
@param workerNetAddresses the worker network addresses
@param options the options
@return the {@link BlockOutStream} instance created | [
"Creates",
"a",
"new",
"remote",
"block",
"output",
"stream",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/client/fs/src/main/java/alluxio/client/block/stream/BlockOutStream.java#L108-L118 |
18,920 | Alluxio/alluxio | core/client/fs/src/main/java/alluxio/client/block/stream/BlockOutStream.java | BlockOutStream.write | public void write(io.netty.buffer.ByteBuf buf) throws IOException {
write(buf, 0, buf.readableBytes());
} | java | public void write(io.netty.buffer.ByteBuf buf) throws IOException {
write(buf, 0, buf.readableBytes());
} | [
"public",
"void",
"write",
"(",
"io",
".",
"netty",
".",
"buffer",
".",
"ByteBuf",
"buf",
")",
"throws",
"IOException",
"{",
"write",
"(",
"buf",
",",
"0",
",",
"buf",
".",
"readableBytes",
"(",
")",
")",
";",
"}"
] | Writes the data in the specified byte buf to this output stream.
@param buf the buffer
@throws IOException | [
"Writes",
"the",
"data",
"in",
"the",
"specified",
"byte",
"buf",
"to",
"this",
"output",
"stream",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/client/fs/src/main/java/alluxio/client/block/stream/BlockOutStream.java#L173-L175 |
18,921 | Alluxio/alluxio | core/client/fs/src/main/java/alluxio/client/block/stream/BlockOutStream.java | BlockOutStream.write | public void write(io.netty.buffer.ByteBuf buf, int off, int len) throws IOException {
if (len == 0) {
return;
}
while (len > 0) {
updateCurrentChunk(false);
int toWrite = Math.min(len, mCurrentChunk.writableBytes());
mCurrentChunk.writeBytes(buf, off, toWrite);
off += toWrite;... | java | public void write(io.netty.buffer.ByteBuf buf, int off, int len) throws IOException {
if (len == 0) {
return;
}
while (len > 0) {
updateCurrentChunk(false);
int toWrite = Math.min(len, mCurrentChunk.writableBytes());
mCurrentChunk.writeBytes(buf, off, toWrite);
off += toWrite;... | [
"public",
"void",
"write",
"(",
"io",
".",
"netty",
".",
"buffer",
".",
"ByteBuf",
"buf",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"len",
"==",
"0",
")",
"{",
"return",
";",
"}",
"while",
"(",
"len",
">"... | Writes len bytes from the specified byte buf starting at offset off to this output stream.
@param buf the buffer
@param off the offset
@param len the length | [
"Writes",
"len",
"bytes",
"from",
"the",
"specified",
"byte",
"buf",
"starting",
"at",
"offset",
"off",
"to",
"this",
"output",
"stream",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/client/fs/src/main/java/alluxio/client/block/stream/BlockOutStream.java#L184-L197 |
18,922 | Alluxio/alluxio | core/client/fs/src/main/java/alluxio/client/block/stream/BlockOutStream.java | BlockOutStream.updateCurrentChunk | private void updateCurrentChunk(boolean lastChunk) throws IOException {
// Early return for the most common case.
if (mCurrentChunk != null && mCurrentChunk.writableBytes() > 0 && !lastChunk) {
return;
}
if (mCurrentChunk == null) {
if (!lastChunk) {
mCurrentChunk = allocateBuffer()... | java | private void updateCurrentChunk(boolean lastChunk) throws IOException {
// Early return for the most common case.
if (mCurrentChunk != null && mCurrentChunk.writableBytes() > 0 && !lastChunk) {
return;
}
if (mCurrentChunk == null) {
if (!lastChunk) {
mCurrentChunk = allocateBuffer()... | [
"private",
"void",
"updateCurrentChunk",
"(",
"boolean",
"lastChunk",
")",
"throws",
"IOException",
"{",
"// Early return for the most common case.",
"if",
"(",
"mCurrentChunk",
"!=",
"null",
"&&",
"mCurrentChunk",
".",
"writableBytes",
"(",
")",
">",
"0",
"&&",
"!"... | Updates the current chunk.
@param lastChunk if the current packet is the last packet | [
"Updates",
"the",
"current",
"chunk",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/client/fs/src/main/java/alluxio/client/block/stream/BlockOutStream.java#L261-L295 |
18,923 | Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/meta/MutableInode.java | MutableInode.removeAcl | public T removeAcl(List<AclEntry> entries) {
for (AclEntry entry : entries) {
if (entry.isDefault()) {
AccessControlList defaultAcl = getDefaultACL();
defaultAcl.removeEntry(entry);
} else {
mAcl.removeEntry(entry);
}
}
updateMask(entries);
return getThis();
} | java | public T removeAcl(List<AclEntry> entries) {
for (AclEntry entry : entries) {
if (entry.isDefault()) {
AccessControlList defaultAcl = getDefaultACL();
defaultAcl.removeEntry(entry);
} else {
mAcl.removeEntry(entry);
}
}
updateMask(entries);
return getThis();
} | [
"public",
"T",
"removeAcl",
"(",
"List",
"<",
"AclEntry",
">",
"entries",
")",
"{",
"for",
"(",
"AclEntry",
"entry",
":",
"entries",
")",
"{",
"if",
"(",
"entry",
".",
"isDefault",
"(",
")",
")",
"{",
"AccessControlList",
"defaultAcl",
"=",
"getDefaultAC... | Removes ACL entries.
@param entries the ACL entries to remove
@return the updated object | [
"Removes",
"ACL",
"entries",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/MutableInode.java#L181-L192 |
18,924 | Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/meta/MutableInode.java | MutableInode.replaceAcl | public T replaceAcl(List<AclEntry> entries) {
boolean clearACL = false;
for (AclEntry entry : entries) {
/**
* if we are only setting default ACLs, we do not need to clear access ACL entries
* observed same behavior on linux
*/
if (!entry.isDefault()) {
clearACL = true;
... | java | public T replaceAcl(List<AclEntry> entries) {
boolean clearACL = false;
for (AclEntry entry : entries) {
/**
* if we are only setting default ACLs, we do not need to clear access ACL entries
* observed same behavior on linux
*/
if (!entry.isDefault()) {
clearACL = true;
... | [
"public",
"T",
"replaceAcl",
"(",
"List",
"<",
"AclEntry",
">",
"entries",
")",
"{",
"boolean",
"clearACL",
"=",
"false",
";",
"for",
"(",
"AclEntry",
"entry",
":",
"entries",
")",
"{",
"/**\n * if we are only setting default ACLs, we do not need to clear access... | Replaces all existing ACL entries with a new list of entries.
@param entries the new list of ACL entries
@return the updated object | [
"Replaces",
"all",
"existing",
"ACL",
"entries",
"with",
"a",
"new",
"list",
"of",
"entries",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/MutableInode.java#L200-L215 |
18,925 | Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/meta/MutableInode.java | MutableInode.updateMask | public T updateMask(List<AclEntry> entries) {
boolean needToUpdateACL = false;
boolean needToUpdateDefaultACL = false;
for (AclEntry entry : entries) {
if (entry.getType().equals(AclEntryType.NAMED_USER)
|| entry.getType().equals(AclEntryType.NAMED_GROUP)
|| entry.getType().equals... | java | public T updateMask(List<AclEntry> entries) {
boolean needToUpdateACL = false;
boolean needToUpdateDefaultACL = false;
for (AclEntry entry : entries) {
if (entry.getType().equals(AclEntryType.NAMED_USER)
|| entry.getType().equals(AclEntryType.NAMED_GROUP)
|| entry.getType().equals... | [
"public",
"T",
"updateMask",
"(",
"List",
"<",
"AclEntry",
">",
"entries",
")",
"{",
"boolean",
"needToUpdateACL",
"=",
"false",
";",
"boolean",
"needToUpdateDefaultACL",
"=",
"false",
";",
"for",
"(",
"AclEntry",
"entry",
":",
"entries",
")",
"{",
"if",
"... | Update Mask for the Inode.
This method should be called after updates to ACL and defaultACL.
@param entries the list of ACL entries
@return the updated object | [
"Update",
"Mask",
"for",
"the",
"Inode",
".",
"This",
"method",
"should",
"be",
"called",
"after",
"updates",
"to",
"ACL",
"and",
"defaultACL",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/MutableInode.java#L224-L251 |
18,926 | Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/meta/MutableInode.java | MutableInode.setAcl | public T setAcl(List<AclEntry> entries) {
if (entries == null || entries.isEmpty()) {
return getThis();
}
for (AclEntry entry : entries) {
if (entry.isDefault()) {
getDefaultACL().setEntry(entry);
} else {
mAcl.setEntry(entry);
}
}
updateMask(entries);
ret... | java | public T setAcl(List<AclEntry> entries) {
if (entries == null || entries.isEmpty()) {
return getThis();
}
for (AclEntry entry : entries) {
if (entry.isDefault()) {
getDefaultACL().setEntry(entry);
} else {
mAcl.setEntry(entry);
}
}
updateMask(entries);
ret... | [
"public",
"T",
"setAcl",
"(",
"List",
"<",
"AclEntry",
">",
"entries",
")",
"{",
"if",
"(",
"entries",
"==",
"null",
"||",
"entries",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"getThis",
"(",
")",
";",
"}",
"for",
"(",
"AclEntry",
"entry",
":",... | Sets ACL entries into the internal ACL.
The entries will overwrite any existing correspondent entries in the internal ACL.
@param entries the ACL entries
@return the updated object | [
"Sets",
"ACL",
"entries",
"into",
"the",
"internal",
"ACL",
".",
"The",
"entries",
"will",
"overwrite",
"any",
"existing",
"correspondent",
"entries",
"in",
"the",
"internal",
"ACL",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/MutableInode.java#L399-L412 |
18,927 | Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/meta/MutableInode.java | MutableInode.updateFromEntry | public void updateFromEntry(UpdateInodeEntry entry) {
if (entry.hasAcl()) {
setInternalAcl(ProtoUtils.fromProto(entry.getAcl()));
}
if (entry.hasCreationTimeMs()) {
setCreationTimeMs(entry.getCreationTimeMs());
}
if (entry.hasGroup()) {
setGroup(entry.getGroup());
}
if (ent... | java | public void updateFromEntry(UpdateInodeEntry entry) {
if (entry.hasAcl()) {
setInternalAcl(ProtoUtils.fromProto(entry.getAcl()));
}
if (entry.hasCreationTimeMs()) {
setCreationTimeMs(entry.getCreationTimeMs());
}
if (entry.hasGroup()) {
setGroup(entry.getGroup());
}
if (ent... | [
"public",
"void",
"updateFromEntry",
"(",
"UpdateInodeEntry",
"entry",
")",
"{",
"if",
"(",
"entry",
".",
"hasAcl",
"(",
")",
")",
"{",
"setInternalAcl",
"(",
"ProtoUtils",
".",
"fromProto",
"(",
"entry",
".",
"getAcl",
"(",
")",
")",
")",
";",
"}",
"i... | Updates this inode's state from the given entry.
@param entry the entry | [
"Updates",
"this",
"inode",
"s",
"state",
"from",
"the",
"given",
"entry",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/MutableInode.java#L487-L528 |
18,928 | Alluxio/alluxio | core/server/common/src/main/java/alluxio/cli/Format.java | Format.formatWorkerDataFolder | private static void formatWorkerDataFolder(String folder) throws IOException {
Path path = Paths.get(folder);
FileUtils.deletePathRecursively(folder);
Files.createDirectory(path);
// For short-circuit read/write to work, others needs to be able to access this directory.
// Therefore, default is 777 ... | java | private static void formatWorkerDataFolder(String folder) throws IOException {
Path path = Paths.get(folder);
FileUtils.deletePathRecursively(folder);
Files.createDirectory(path);
// For short-circuit read/write to work, others needs to be able to access this directory.
// Therefore, default is 777 ... | [
"private",
"static",
"void",
"formatWorkerDataFolder",
"(",
"String",
"folder",
")",
"throws",
"IOException",
"{",
"Path",
"path",
"=",
"Paths",
".",
"get",
"(",
"folder",
")",
";",
"FileUtils",
".",
"deletePathRecursively",
"(",
"folder",
")",
";",
"Files",
... | Formats the worker data folder.
@param folder folder path | [
"Formats",
"the",
"worker",
"data",
"folder",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/cli/Format.java#L63-L73 |
18,929 | Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/FileSystemAdminShellUtils.java | FileSystemAdminShellUtils.compareTierNames | public static int compareTierNames(String a, String b) {
int aValue = getTierRankValue(a);
int bValue = getTierRankValue(b);
if (aValue == bValue) {
return a.compareTo(b);
}
return aValue - bValue;
} | java | public static int compareTierNames(String a, String b) {
int aValue = getTierRankValue(a);
int bValue = getTierRankValue(b);
if (aValue == bValue) {
return a.compareTo(b);
}
return aValue - bValue;
} | [
"public",
"static",
"int",
"compareTierNames",
"(",
"String",
"a",
",",
"String",
"b",
")",
"{",
"int",
"aValue",
"=",
"getTierRankValue",
"(",
"a",
")",
";",
"int",
"bValue",
"=",
"getTierRankValue",
"(",
"b",
")",
";",
"if",
"(",
"aValue",
"==",
"bVa... | Compares two tier names according to their rank values.
@param a one tier name
@param b another tier name
@return compared result | [
"Compares",
"two",
"tier",
"names",
"according",
"to",
"their",
"rank",
"values",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/FileSystemAdminShellUtils.java#L43-L50 |
18,930 | Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/FileSystemAdminShellUtils.java | FileSystemAdminShellUtils.checkMasterClientService | public static void checkMasterClientService(AlluxioConfiguration alluxioConf) throws IOException {
try (CloseableResource<FileSystemMasterClient> client =
FileSystemContext.create(ClientContext.create(alluxioConf))
.acquireMasterClientResource()) {
InetSocketAddress address = client.get().getA... | java | public static void checkMasterClientService(AlluxioConfiguration alluxioConf) throws IOException {
try (CloseableResource<FileSystemMasterClient> client =
FileSystemContext.create(ClientContext.create(alluxioConf))
.acquireMasterClientResource()) {
InetSocketAddress address = client.get().getA... | [
"public",
"static",
"void",
"checkMasterClientService",
"(",
"AlluxioConfiguration",
"alluxioConf",
")",
"throws",
"IOException",
"{",
"try",
"(",
"CloseableResource",
"<",
"FileSystemMasterClient",
">",
"client",
"=",
"FileSystemContext",
".",
"create",
"(",
"ClientCon... | Checks if the master client service is available.
Throws an exception if fails to determine that the master client service is running.
@param alluxioConf Alluxio configuration | [
"Checks",
"if",
"the",
"master",
"client",
"service",
"is",
"available",
".",
"Throws",
"an",
"exception",
"if",
"fails",
"to",
"determine",
"that",
"the",
"master",
"client",
"service",
"is",
"running",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/FileSystemAdminShellUtils.java#L58-L71 |
18,931 | Alluxio/alluxio | shell/src/main/java/alluxio/cli/fsadmin/FileSystemAdminShellUtils.java | FileSystemAdminShellUtils.getTierRankValue | private static int getTierRankValue(String input) {
// MEM, SSD, and HDD are the most commonly used Alluxio tier alias,
// so we want them to show before other tier names
// MEM, SSD, and HDD are sorted according to the speed of access
List<String> tierOrder = Arrays.asList("MEM", "SSD", "HDD");
int... | java | private static int getTierRankValue(String input) {
// MEM, SSD, and HDD are the most commonly used Alluxio tier alias,
// so we want them to show before other tier names
// MEM, SSD, and HDD are sorted according to the speed of access
List<String> tierOrder = Arrays.asList("MEM", "SSD", "HDD");
int... | [
"private",
"static",
"int",
"getTierRankValue",
"(",
"String",
"input",
")",
"{",
"// MEM, SSD, and HDD are the most commonly used Alluxio tier alias,",
"// so we want them to show before other tier names",
"// MEM, SSD, and HDD are sorted according to the speed of access",
"List",
"<",
... | Assigns a rank value to the input string.
@param input the input to turn to rank value
@return a rank value used to sort tiers | [
"Assigns",
"a",
"rank",
"value",
"to",
"the",
"input",
"string",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fsadmin/FileSystemAdminShellUtils.java#L79-L89 |
18,932 | Alluxio/alluxio | core/client/fs/src/main/java/alluxio/client/block/stream/BlockInStream.java | BlockInStream.readChunk | private void readChunk() throws IOException {
if (mDataReader == null) {
mDataReader = mDataReaderFactory.create(mPos, mLength - mPos);
}
if (mCurrentChunk != null && mCurrentChunk.readableBytes() == 0) {
mCurrentChunk.release();
mCurrentChunk = null;
}
if (mCurrentChunk == null) ... | java | private void readChunk() throws IOException {
if (mDataReader == null) {
mDataReader = mDataReaderFactory.create(mPos, mLength - mPos);
}
if (mCurrentChunk != null && mCurrentChunk.readableBytes() == 0) {
mCurrentChunk.release();
mCurrentChunk = null;
}
if (mCurrentChunk == null) ... | [
"private",
"void",
"readChunk",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"mDataReader",
"==",
"null",
")",
"{",
"mDataReader",
"=",
"mDataReaderFactory",
".",
"create",
"(",
"mPos",
",",
"mLength",
"-",
"mPos",
")",
";",
"}",
"if",
"(",
"mCurre... | Reads a new chunk from the channel if all of the current chunk is read. | [
"Reads",
"a",
"new",
"chunk",
"from",
"the",
"channel",
"if",
"all",
"of",
"the",
"current",
"chunk",
"is",
"read",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/client/fs/src/main/java/alluxio/client/block/stream/BlockInStream.java#L366-L378 |
18,933 | Alluxio/alluxio | core/client/fs/src/main/java/alluxio/client/block/stream/BlockInStream.java | BlockInStream.closeDataReader | private void closeDataReader() throws IOException {
if (mCurrentChunk != null) {
mCurrentChunk.release();
mCurrentChunk = null;
}
if (mDataReader != null) {
mDataReader.close();
}
mDataReader = null;
} | java | private void closeDataReader() throws IOException {
if (mCurrentChunk != null) {
mCurrentChunk.release();
mCurrentChunk = null;
}
if (mDataReader != null) {
mDataReader.close();
}
mDataReader = null;
} | [
"private",
"void",
"closeDataReader",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"mCurrentChunk",
"!=",
"null",
")",
"{",
"mCurrentChunk",
".",
"release",
"(",
")",
";",
"mCurrentChunk",
"=",
"null",
";",
"}",
"if",
"(",
"mDataReader",
"!=",
"null"... | Close the current data reader. | [
"Close",
"the",
"current",
"data",
"reader",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/client/fs/src/main/java/alluxio/client/block/stream/BlockInStream.java#L383-L392 |
18,934 | Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/contexts/CreatePathContext.java | CreatePathContext.setAcl | public K setAcl(List<AclEntry> acl) {
mAcl = ImmutableList.copyOf(acl);
return getThis();
} | java | public K setAcl(List<AclEntry> acl) {
mAcl = ImmutableList.copyOf(acl);
return getThis();
} | [
"public",
"K",
"setAcl",
"(",
"List",
"<",
"AclEntry",
">",
"acl",
")",
"{",
"mAcl",
"=",
"ImmutableList",
".",
"copyOf",
"(",
"acl",
")",
";",
"return",
"getThis",
"(",
")",
";",
"}"
] | Sets an immutable copy of acl as the internal access control list.
@param acl the ACL entries
@return the updated context | [
"Sets",
"an",
"immutable",
"copy",
"of",
"acl",
"as",
"the",
"internal",
"access",
"control",
"list",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/contexts/CreatePathContext.java#L174-L177 |
18,935 | Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/block/BlockMasterClient.java | BlockMasterClient.commitBlock | public void commitBlock(final long workerId, final long usedBytesOnTier,
final String tierAlias, final long blockId, final long length) throws IOException {
retryRPC((RpcCallable<Void>) () -> {
CommitBlockPRequest request =
CommitBlockPRequest.newBuilder().setWorkerId(workerId).setUsedBytesOnT... | java | public void commitBlock(final long workerId, final long usedBytesOnTier,
final String tierAlias, final long blockId, final long length) throws IOException {
retryRPC((RpcCallable<Void>) () -> {
CommitBlockPRequest request =
CommitBlockPRequest.newBuilder().setWorkerId(workerId).setUsedBytesOnT... | [
"public",
"void",
"commitBlock",
"(",
"final",
"long",
"workerId",
",",
"final",
"long",
"usedBytesOnTier",
",",
"final",
"String",
"tierAlias",
",",
"final",
"long",
"blockId",
",",
"final",
"long",
"length",
")",
"throws",
"IOException",
"{",
"retryRPC",
"("... | Commits a block on a worker.
@param workerId the worker id committing the block
@param usedBytesOnTier the amount of used bytes on the tier the block is committing to
@param tierAlias the alias of the tier the block is being committed to
@param blockId the block id being committed
@param length the length of the block... | [
"Commits",
"a",
"block",
"on",
"a",
"worker",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/BlockMasterClient.java#L87-L96 |
18,936 | Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/block/BlockMasterClient.java | BlockMasterClient.commitBlockInUfs | public void commitBlockInUfs(final long blockId, final long length)
throws IOException {
retryRPC((RpcCallable<Void>) () -> {
CommitBlockInUfsPRequest request =
CommitBlockInUfsPRequest.newBuilder().setBlockId(blockId).setLength(length).build();
mClient.commitBlockInUfs(request);
r... | java | public void commitBlockInUfs(final long blockId, final long length)
throws IOException {
retryRPC((RpcCallable<Void>) () -> {
CommitBlockInUfsPRequest request =
CommitBlockInUfsPRequest.newBuilder().setBlockId(blockId).setLength(length).build();
mClient.commitBlockInUfs(request);
r... | [
"public",
"void",
"commitBlockInUfs",
"(",
"final",
"long",
"blockId",
",",
"final",
"long",
"length",
")",
"throws",
"IOException",
"{",
"retryRPC",
"(",
"(",
"RpcCallable",
"<",
"Void",
">",
")",
"(",
")",
"->",
"{",
"CommitBlockInUfsPRequest",
"request",
... | Commits a block in Ufs.
@param blockId the block id being committed
@param length the length of the block being committed | [
"Commits",
"a",
"block",
"in",
"Ufs",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/BlockMasterClient.java#L104-L112 |
18,937 | Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/block/BlockMasterClient.java | BlockMasterClient.getId | public long getId(final WorkerNetAddress address) throws IOException {
return retryRPC((RpcCallable<Long>) () -> {
GetWorkerIdPRequest request =
GetWorkerIdPRequest.newBuilder().setWorkerNetAddress(GrpcUtils.toProto(address)).build();
return mClient.getWorkerId(request).getWorkerId();
});
... | java | public long getId(final WorkerNetAddress address) throws IOException {
return retryRPC((RpcCallable<Long>) () -> {
GetWorkerIdPRequest request =
GetWorkerIdPRequest.newBuilder().setWorkerNetAddress(GrpcUtils.toProto(address)).build();
return mClient.getWorkerId(request).getWorkerId();
});
... | [
"public",
"long",
"getId",
"(",
"final",
"WorkerNetAddress",
"address",
")",
"throws",
"IOException",
"{",
"return",
"retryRPC",
"(",
"(",
"RpcCallable",
"<",
"Long",
">",
")",
"(",
")",
"->",
"{",
"GetWorkerIdPRequest",
"request",
"=",
"GetWorkerIdPRequest",
... | Returns a worker id for a workers net address.
@param address the net address to get a worker id for
@return a worker id | [
"Returns",
"a",
"worker",
"id",
"for",
"a",
"workers",
"net",
"address",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/BlockMasterClient.java#L120-L126 |
18,938 | Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/block/DefaultBlockWorker.java | DefaultBlockWorker.stop | @Override
public void stop() {
// Steps to shutdown:
// 1. Gracefully shut down the runnables running in the executors.
// 2. Shutdown the executors.
// 3. Shutdown the clients. This needs to happen after the executors is shutdown because
// runnables running in the executors might be using the... | java | @Override
public void stop() {
// Steps to shutdown:
// 1. Gracefully shut down the runnables running in the executors.
// 2. Shutdown the executors.
// 3. Shutdown the clients. This needs to happen after the executors is shutdown because
// runnables running in the executors might be using the... | [
"@",
"Override",
"public",
"void",
"stop",
"(",
")",
"{",
"// Steps to shutdown:",
"// 1. Gracefully shut down the runnables running in the executors.",
"// 2. Shutdown the executors.",
"// 3. Shutdown the clients. This needs to happen after the executors is shutdown because",
"// runnabl... | Stops the block worker. This method should only be called to terminate the worker. | [
"Stops",
"the",
"block",
"worker",
".",
"This",
"method",
"should",
"only",
"be",
"called",
"to",
"terminate",
"the",
"worker",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/DefaultBlockWorker.java#L257-L290 |
18,939 | Alluxio/alluxio | underfs/gcs/src/main/java/alluxio/underfs/gcs/GCSInputStream.java | GCSInputStream.skip | @Override
public long skip(long n) throws IOException {
if (mInputStream.available() >= n) {
return mInputStream.skip(n);
}
// The number of bytes to skip is possibly large, open a new stream from GCS.
mInputStream.close();
mPos += n;
try {
mObject = mClient.getObject(mBucketName, ... | java | @Override
public long skip(long n) throws IOException {
if (mInputStream.available() >= n) {
return mInputStream.skip(n);
}
// The number of bytes to skip is possibly large, open a new stream from GCS.
mInputStream.close();
mPos += n;
try {
mObject = mClient.getObject(mBucketName, ... | [
"@",
"Override",
"public",
"long",
"skip",
"(",
"long",
"n",
")",
"throws",
"IOException",
"{",
"if",
"(",
"mInputStream",
".",
"available",
"(",
")",
">=",
"n",
")",
"{",
"return",
"mInputStream",
".",
"skip",
"(",
"n",
")",
";",
"}",
"// The number o... | This method leverages the ability to open a stream from GCS from a given offset. When the
underlying stream has fewer bytes buffered than the skip request, the stream is closed, and
a new stream is opened starting at the requested offset.
@param n number of bytes to skip
@return the number of bytes skipped | [
"This",
"method",
"leverages",
"the",
"ability",
"to",
"open",
"a",
"stream",
"from",
"GCS",
"from",
"a",
"given",
"offset",
".",
"When",
"the",
"underlying",
"stream",
"has",
"fewer",
"bytes",
"buffered",
"than",
"the",
"skip",
"request",
"the",
"stream",
... | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/underfs/gcs/src/main/java/alluxio/underfs/gcs/GCSInputStream.java#L148-L166 |
18,940 | Alluxio/alluxio | underfs/gcs/src/main/java/alluxio/underfs/gcs/GCSUtils.java | GCSUtils.translateBucketAcl | public static short translateBucketAcl(GSAccessControlList acl, String userId) {
short mode = (short) 0;
for (GrantAndPermission gp : acl.getGrantAndPermissions()) {
Permission perm = gp.getPermission();
GranteeInterface grantee = gp.getGrantee();
if (perm.equals(Permission.PERMISSION_READ)) {... | java | public static short translateBucketAcl(GSAccessControlList acl, String userId) {
short mode = (short) 0;
for (GrantAndPermission gp : acl.getGrantAndPermissions()) {
Permission perm = gp.getPermission();
GranteeInterface grantee = gp.getGrantee();
if (perm.equals(Permission.PERMISSION_READ)) {... | [
"public",
"static",
"short",
"translateBucketAcl",
"(",
"GSAccessControlList",
"acl",
",",
"String",
"userId",
")",
"{",
"short",
"mode",
"=",
"(",
"short",
")",
"0",
";",
"for",
"(",
"GrantAndPermission",
"gp",
":",
"acl",
".",
"getGrantAndPermissions",
"(",
... | Translates GCS bucket owner ACL to Alluxio owner mode.
@param acl the acl of GCS bucket
@param userId the S3 user id of the Alluxio owner
@return the translated posix mode in short format | [
"Translates",
"GCS",
"bucket",
"owner",
"ACL",
"to",
"Alluxio",
"owner",
"mode",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/underfs/gcs/src/main/java/alluxio/underfs/gcs/GCSUtils.java#L31-L54 |
18,941 | Alluxio/alluxio | core/common/src/main/java/alluxio/wire/SyncPointInfo.java | SyncPointInfo.fromProto | public static SyncPointInfo fromProto(alluxio.grpc.SyncPointInfo syncPointInfo) {
SyncStatus syncStatus;
switch (syncPointInfo.getSyncStatus()) {
case Not_Initially_Synced:
syncStatus = SyncStatus.NOT_INITIALLY_SYNCED;
break;
case Syncing:
syncStatus = SyncStatus.SYNCING;
... | java | public static SyncPointInfo fromProto(alluxio.grpc.SyncPointInfo syncPointInfo) {
SyncStatus syncStatus;
switch (syncPointInfo.getSyncStatus()) {
case Not_Initially_Synced:
syncStatus = SyncStatus.NOT_INITIALLY_SYNCED;
break;
case Syncing:
syncStatus = SyncStatus.SYNCING;
... | [
"public",
"static",
"SyncPointInfo",
"fromProto",
"(",
"alluxio",
".",
"grpc",
".",
"SyncPointInfo",
"syncPointInfo",
")",
"{",
"SyncStatus",
"syncStatus",
";",
"switch",
"(",
"syncPointInfo",
".",
"getSyncStatus",
"(",
")",
")",
"{",
"case",
"Not_Initially_Synced... | Generate sync point information from the proto representation.
@param syncPointInfo the proto representation
@return sync point info object | [
"Generate",
"sync",
"point",
"information",
"from",
"the",
"proto",
"representation",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/wire/SyncPointInfo.java#L77-L93 |
18,942 | Alluxio/alluxio | core/common/src/main/java/alluxio/grpc/GrpcChannelBuilder.java | GrpcChannelBuilder.setChannelType | public GrpcChannelBuilder setChannelType(Class<? extends io.netty.channel.Channel> channelType) {
mChannelKey.setChannelType(channelType);
return this;
} | java | public GrpcChannelBuilder setChannelType(Class<? extends io.netty.channel.Channel> channelType) {
mChannelKey.setChannelType(channelType);
return this;
} | [
"public",
"GrpcChannelBuilder",
"setChannelType",
"(",
"Class",
"<",
"?",
"extends",
"io",
".",
"netty",
".",
"channel",
".",
"Channel",
">",
"channelType",
")",
"{",
"mChannelKey",
".",
"setChannelType",
"(",
"channelType",
")",
";",
"return",
"this",
";",
... | Sets the channel type.
@param channelType the channel type
@return a new instance of {@link GrpcChannelBuilder} | [
"Sets",
"the",
"channel",
"type",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/grpc/GrpcChannelBuilder.java#L168-L171 |
18,943 | Alluxio/alluxio | job/server/src/main/java/alluxio/master/job/JobMasterClientRestServiceHandler.java | JobMasterClientRestServiceHandler.getStatus | @GET
@Path(ServiceConstants.GET_STATUS)
@JacksonFeatures(serializationEnable = {SerializationFeature.INDENT_OUTPUT})
public Response getStatus(@QueryParam("jobId") final long jobId) {
return RestUtils.call(new RestUtils.RestCallable<JobInfo>() {
@Override
public JobInfo call() throws Exception {
... | java | @GET
@Path(ServiceConstants.GET_STATUS)
@JacksonFeatures(serializationEnable = {SerializationFeature.INDENT_OUTPUT})
public Response getStatus(@QueryParam("jobId") final long jobId) {
return RestUtils.call(new RestUtils.RestCallable<JobInfo>() {
@Override
public JobInfo call() throws Exception {
... | [
"@",
"GET",
"@",
"Path",
"(",
"ServiceConstants",
".",
"GET_STATUS",
")",
"@",
"JacksonFeatures",
"(",
"serializationEnable",
"=",
"{",
"SerializationFeature",
".",
"INDENT_OUTPUT",
"}",
")",
"public",
"Response",
"getStatus",
"(",
"@",
"QueryParam",
"(",
"\"job... | Gets the job status.
@param jobId the job id
@return the response of the job status | [
"Gets",
"the",
"job",
"status",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/master/job/JobMasterClientRestServiceHandler.java#L111-L121 |
18,944 | Alluxio/alluxio | job/server/src/main/java/alluxio/master/job/JobMasterClientRestServiceHandler.java | JobMasterClientRestServiceHandler.list | @GET
@Path(ServiceConstants.LIST)
public Response list() {
return RestUtils.call(new RestUtils.RestCallable<List<Long>>() {
@Override
public List<Long> call() throws Exception {
return mJobMaster.list();
}
}, ServerConfiguration.global());
} | java | @GET
@Path(ServiceConstants.LIST)
public Response list() {
return RestUtils.call(new RestUtils.RestCallable<List<Long>>() {
@Override
public List<Long> call() throws Exception {
return mJobMaster.list();
}
}, ServerConfiguration.global());
} | [
"@",
"GET",
"@",
"Path",
"(",
"ServiceConstants",
".",
"LIST",
")",
"public",
"Response",
"list",
"(",
")",
"{",
"return",
"RestUtils",
".",
"call",
"(",
"new",
"RestUtils",
".",
"RestCallable",
"<",
"List",
"<",
"Long",
">",
">",
"(",
")",
"{",
"@",... | Lists all the jobs in the history.
@return the response of the names of all the jobs | [
"Lists",
"all",
"the",
"jobs",
"in",
"the",
"history",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/master/job/JobMasterClientRestServiceHandler.java#L128-L137 |
18,945 | Alluxio/alluxio | job/server/src/main/java/alluxio/master/job/JobMasterClientRestServiceHandler.java | JobMasterClientRestServiceHandler.run | @POST
@Path(ServiceConstants.RUN)
@Consumes(MediaType.APPLICATION_JSON)
public Response run(final JobConfig jobConfig) {
return RestUtils.call(new RestUtils.RestCallable<Long>() {
@Override
public Long call() throws Exception {
return mJobMaster.run(jobConfig);
}
}, ServerConfigu... | java | @POST
@Path(ServiceConstants.RUN)
@Consumes(MediaType.APPLICATION_JSON)
public Response run(final JobConfig jobConfig) {
return RestUtils.call(new RestUtils.RestCallable<Long>() {
@Override
public Long call() throws Exception {
return mJobMaster.run(jobConfig);
}
}, ServerConfigu... | [
"@",
"POST",
"@",
"Path",
"(",
"ServiceConstants",
".",
"RUN",
")",
"@",
"Consumes",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"public",
"Response",
"run",
"(",
"final",
"JobConfig",
"jobConfig",
")",
"{",
"return",
"RestUtils",
".",
"call",
"(",
"ne... | Runs a job.
@param jobConfig the configuration of the job
@return the job id that tracks the job | [
"Runs",
"a",
"job",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/master/job/JobMasterClientRestServiceHandler.java#L145-L155 |
18,946 | Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/meta/PathProperties.java | PathProperties.add | public void add(Supplier<JournalContext> ctx, String path, Map<PropertyKey, String> properties) {
try (LockResource r = new LockResource(mLock.writeLock())) {
if (!properties.isEmpty()) {
Map<String, String> newProperties = mState.getProperties(path);
properties.forEach((key, value) -> newProp... | java | public void add(Supplier<JournalContext> ctx, String path, Map<PropertyKey, String> properties) {
try (LockResource r = new LockResource(mLock.writeLock())) {
if (!properties.isEmpty()) {
Map<String, String> newProperties = mState.getProperties(path);
properties.forEach((key, value) -> newProp... | [
"public",
"void",
"add",
"(",
"Supplier",
"<",
"JournalContext",
">",
"ctx",
",",
"String",
"path",
",",
"Map",
"<",
"PropertyKey",
",",
"String",
">",
"properties",
")",
"{",
"try",
"(",
"LockResource",
"r",
"=",
"new",
"LockResource",
"(",
"mLock",
"."... | Adds properties for path.
If there are existing properties for path, they are merged with the new properties.
If a property key already exists, its old value is overwritten.
@param ctx the journal context
@param path the path
@param properties the new properties | [
"Adds",
"properties",
"for",
"path",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/meta/PathProperties.java#L78-L87 |
18,947 | Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/meta/PathProperties.java | PathProperties.remove | public void remove(Supplier<JournalContext> ctx, String path, Set<String> keys) {
try (LockResource r = new LockResource(mLock.writeLock())) {
Map<String, String> properties = mState.getProperties(path);
if (!properties.isEmpty()) {
keys.forEach(key -> properties.remove(key));
if (proper... | java | public void remove(Supplier<JournalContext> ctx, String path, Set<String> keys) {
try (LockResource r = new LockResource(mLock.writeLock())) {
Map<String, String> properties = mState.getProperties(path);
if (!properties.isEmpty()) {
keys.forEach(key -> properties.remove(key));
if (proper... | [
"public",
"void",
"remove",
"(",
"Supplier",
"<",
"JournalContext",
">",
"ctx",
",",
"String",
"path",
",",
"Set",
"<",
"String",
">",
"keys",
")",
"{",
"try",
"(",
"LockResource",
"r",
"=",
"new",
"LockResource",
"(",
"mLock",
".",
"writeLock",
"(",
"... | Removes the specified set of keys from the properties for path.
@param ctx the journal context
@param path the path
@param keys the keys to remove | [
"Removes",
"the",
"specified",
"set",
"of",
"keys",
"from",
"the",
"properties",
"for",
"path",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/meta/PathProperties.java#L96-L109 |
18,948 | Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/meta/PathProperties.java | PathProperties.removeAll | public void removeAll(Supplier<JournalContext> ctx, String path) {
try (LockResource r = new LockResource(mLock.writeLock())) {
Map<String, String> properties = mState.getProperties(path);
if (!properties.isEmpty()) {
mState.applyAndJournal(ctx, RemovePathPropertiesEntry.newBuilder().setPath(pat... | java | public void removeAll(Supplier<JournalContext> ctx, String path) {
try (LockResource r = new LockResource(mLock.writeLock())) {
Map<String, String> properties = mState.getProperties(path);
if (!properties.isEmpty()) {
mState.applyAndJournal(ctx, RemovePathPropertiesEntry.newBuilder().setPath(pat... | [
"public",
"void",
"removeAll",
"(",
"Supplier",
"<",
"JournalContext",
">",
"ctx",
",",
"String",
"path",
")",
"{",
"try",
"(",
"LockResource",
"r",
"=",
"new",
"LockResource",
"(",
"mLock",
".",
"writeLock",
"(",
")",
")",
")",
"{",
"Map",
"<",
"Strin... | Removes all properties for path.
@param ctx the journal context
@param path the path | [
"Removes",
"all",
"properties",
"for",
"path",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/meta/PathProperties.java#L117-L124 |
18,949 | Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/meta/TtlBucketList.java | TtlBucketList.getBucketContaining | @Nullable
private TtlBucket getBucketContaining(InodeView inode) {
if (inode.getTtl() == Constants.NO_TTL) {
// no bucket will contain a inode with NO_TTL.
return null;
}
long ttlEndTimeMs = inode.getCreationTimeMs() + inode.getTtl();
// Gets the last bucket with interval start time less ... | java | @Nullable
private TtlBucket getBucketContaining(InodeView inode) {
if (inode.getTtl() == Constants.NO_TTL) {
// no bucket will contain a inode with NO_TTL.
return null;
}
long ttlEndTimeMs = inode.getCreationTimeMs() + inode.getTtl();
// Gets the last bucket with interval start time less ... | [
"@",
"Nullable",
"private",
"TtlBucket",
"getBucketContaining",
"(",
"InodeView",
"inode",
")",
"{",
"if",
"(",
"inode",
".",
"getTtl",
"(",
")",
"==",
"Constants",
".",
"NO_TTL",
")",
"{",
"// no bucket will contain a inode with NO_TTL.",
"return",
"null",
";",
... | Gets the bucket in the list that contains the inode.
@param inode the inode to be contained
@return the bucket containing the inode, or null if no such bucket exists | [
"Gets",
"the",
"bucket",
"in",
"the",
"list",
"that",
"contains",
"the",
"inode",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/TtlBucketList.java#L69-L90 |
18,950 | Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/meta/TtlBucketList.java | TtlBucketList.remove | public void remove(InodeView inode) {
TtlBucket bucket = getBucketContaining(inode);
if (bucket != null) {
bucket.removeInode(inode);
}
} | java | public void remove(InodeView inode) {
TtlBucket bucket = getBucketContaining(inode);
if (bucket != null) {
bucket.removeInode(inode);
}
} | [
"public",
"void",
"remove",
"(",
"InodeView",
"inode",
")",
"{",
"TtlBucket",
"bucket",
"=",
"getBucketContaining",
"(",
"inode",
")",
";",
"if",
"(",
"bucket",
"!=",
"null",
")",
"{",
"bucket",
".",
"removeInode",
"(",
"inode",
")",
";",
"}",
"}"
] | Removes a inode from the bucket containing it if the inode is in one of the buckets, otherwise,
do nothing.
<p>
Assume that no inode in the buckets has ttl value that equals {@link Constants#NO_TTL}.
If a inode with valid ttl value is inserted to the buckets and its ttl value is going to be set
to {@link Constants#NO_... | [
"Removes",
"a",
"inode",
"from",
"the",
"bucket",
"containing",
"it",
"if",
"the",
"inode",
"is",
"in",
"one",
"of",
"the",
"buckets",
"otherwise",
"do",
"nothing",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/TtlBucketList.java#L141-L146 |
18,951 | Alluxio/alluxio | core/server/common/src/main/java/alluxio/master/journalv0/ufs/UfsCheckpointManager.java | UfsCheckpointManager.recover | public void recover() {
try {
boolean checkpointExists = mUfs.isFile(mCheckpoint.toString());
boolean backupCheckpointExists = mUfs.isFile(mBackupCheckpoint.toString());
boolean tempBackupCheckpointExists = mUfs.isFile(mTempBackupCheckpoint.toString());
Preconditions
.checkState(!(... | java | public void recover() {
try {
boolean checkpointExists = mUfs.isFile(mCheckpoint.toString());
boolean backupCheckpointExists = mUfs.isFile(mBackupCheckpoint.toString());
boolean tempBackupCheckpointExists = mUfs.isFile(mTempBackupCheckpoint.toString());
Preconditions
.checkState(!(... | [
"public",
"void",
"recover",
"(",
")",
"{",
"try",
"{",
"boolean",
"checkpointExists",
"=",
"mUfs",
".",
"isFile",
"(",
"mCheckpoint",
".",
"toString",
"(",
")",
")",
";",
"boolean",
"backupCheckpointExists",
"=",
"mUfs",
".",
"isFile",
"(",
"mBackupCheckpoi... | Recovers the checkpoint in case the master crashed while updating it. | [
"Recovers",
"the",
"checkpoint",
"in",
"case",
"the",
"master",
"crashed",
"while",
"updating",
"it",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journalv0/ufs/UfsCheckpointManager.java#L94-L122 |
18,952 | Alluxio/alluxio | core/server/common/src/main/java/alluxio/master/journalv0/ufs/UfsCheckpointManager.java | UfsCheckpointManager.update | public void update(URI location) {
try {
if (mUfs.isFile(mCheckpoint.toString())) {
UnderFileSystemUtils.deleteFileIfExists(mUfs, mTempBackupCheckpoint.toString());
UnderFileSystemUtils.deleteFileIfExists(mUfs, mBackupCheckpoint.toString());
// Rename in two steps so that we never have... | java | public void update(URI location) {
try {
if (mUfs.isFile(mCheckpoint.toString())) {
UnderFileSystemUtils.deleteFileIfExists(mUfs, mTempBackupCheckpoint.toString());
UnderFileSystemUtils.deleteFileIfExists(mUfs, mBackupCheckpoint.toString());
// Rename in two steps so that we never have... | [
"public",
"void",
"update",
"(",
"URI",
"location",
")",
"{",
"try",
"{",
"if",
"(",
"mUfs",
".",
"isFile",
"(",
"mCheckpoint",
".",
"toString",
"(",
")",
")",
")",
"{",
"UnderFileSystemUtils",
".",
"deleteFileIfExists",
"(",
"mUfs",
",",
"mTempBackupCheck... | Updates the checkpoint to the specified URI.
@param location the location of the new checkpoint | [
"Updates",
"the",
"checkpoint",
"to",
"the",
"specified",
"URI",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journalv0/ufs/UfsCheckpointManager.java#L129-L150 |
18,953 | Alluxio/alluxio | core/common/src/main/java/alluxio/metrics/Metric.java | Metric.getMetricNameWithUserTag | public static String getMetricNameWithUserTag(String metricName, String userName) {
UserMetricKey k = new UserMetricKey(metricName, userName);
String result = CACHED_METRICS.get(k);
if (result != null) {
return result;
}
return CACHED_METRICS.computeIfAbsent(k, key -> metricName + "." + Common... | java | public static String getMetricNameWithUserTag(String metricName, String userName) {
UserMetricKey k = new UserMetricKey(metricName, userName);
String result = CACHED_METRICS.get(k);
if (result != null) {
return result;
}
return CACHED_METRICS.computeIfAbsent(k, key -> metricName + "." + Common... | [
"public",
"static",
"String",
"getMetricNameWithUserTag",
"(",
"String",
"metricName",
",",
"String",
"userName",
")",
"{",
"UserMetricKey",
"k",
"=",
"new",
"UserMetricKey",
"(",
"metricName",
",",
"userName",
")",
";",
"String",
"result",
"=",
"CACHED_METRICS",
... | Gets a metric name with a specific user tag.
@param metricName the name of the metric
@param userName the user
@return a metric name with the user tagged | [
"Gets",
"a",
"metric",
"name",
"with",
"a",
"specific",
"user",
"tag",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/metrics/Metric.java#L223-L231 |
18,954 | Alluxio/alluxio | core/common/src/main/java/alluxio/metrics/Metric.java | Metric.from | public static Metric from(String fullName, double value) {
String[] pieces = fullName.split("\\.");
Preconditions.checkArgument(pieces.length > 1, "Incorrect metrics name: %s.", fullName);
String hostname = null;
String id = null;
String name = null;
int tagStartIdx = 0;
// Master or cluste... | java | public static Metric from(String fullName, double value) {
String[] pieces = fullName.split("\\.");
Preconditions.checkArgument(pieces.length > 1, "Incorrect metrics name: %s.", fullName);
String hostname = null;
String id = null;
String name = null;
int tagStartIdx = 0;
// Master or cluste... | [
"public",
"static",
"Metric",
"from",
"(",
"String",
"fullName",
",",
"double",
"value",
")",
"{",
"String",
"[",
"]",
"pieces",
"=",
"fullName",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"pieces",
".",
"length",... | Creates the metric from the full name and the value.
@param fullName the full name
@param value the value
@return the created metric | [
"Creates",
"the",
"metric",
"from",
"the",
"full",
"name",
"and",
"the",
"value",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/metrics/Metric.java#L240-L278 |
18,955 | Alluxio/alluxio | core/common/src/main/java/alluxio/metrics/Metric.java | Metric.fromProto | public static Metric fromProto(alluxio.grpc.Metric metric) {
Metric created = new Metric(MetricsSystem.InstanceType.fromString(metric.getInstance()),
metric.getHostname(), metric.hasInstanceId() ? metric.getInstanceId() : null,
metric.getName(), metric.getValue());
for (Entry<String, String> ent... | java | public static Metric fromProto(alluxio.grpc.Metric metric) {
Metric created = new Metric(MetricsSystem.InstanceType.fromString(metric.getInstance()),
metric.getHostname(), metric.hasInstanceId() ? metric.getInstanceId() : null,
metric.getName(), metric.getValue());
for (Entry<String, String> ent... | [
"public",
"static",
"Metric",
"fromProto",
"(",
"alluxio",
".",
"grpc",
".",
"Metric",
"metric",
")",
"{",
"Metric",
"created",
"=",
"new",
"Metric",
"(",
"MetricsSystem",
".",
"InstanceType",
".",
"fromString",
"(",
"metric",
".",
"getInstance",
"(",
")",
... | Constructs the metric object from the proto format.
@param metric the metric in proto format
@return the constructed metric | [
"Constructs",
"the",
"metric",
"object",
"from",
"the",
"proto",
"format",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/metrics/Metric.java#L286-L294 |
18,956 | Alluxio/alluxio | underfs/hdfs/src/main/java/alluxio/underfs/hdfs/HdfsUnderFileSystem.java | HdfsUnderFileSystem.delete | private boolean delete(String path, boolean recursive) throws IOException {
IOException te = null;
FileSystem hdfs = getFs();
RetryPolicy retryPolicy = new CountingRetry(MAX_TRY);
while (retryPolicy.attempt()) {
try {
return hdfs.delete(new Path(path), recursive);
} catch (IOExceptio... | java | private boolean delete(String path, boolean recursive) throws IOException {
IOException te = null;
FileSystem hdfs = getFs();
RetryPolicy retryPolicy = new CountingRetry(MAX_TRY);
while (retryPolicy.attempt()) {
try {
return hdfs.delete(new Path(path), recursive);
} catch (IOExceptio... | [
"private",
"boolean",
"delete",
"(",
"String",
"path",
",",
"boolean",
"recursive",
")",
"throws",
"IOException",
"{",
"IOException",
"te",
"=",
"null",
";",
"FileSystem",
"hdfs",
"=",
"getFs",
"(",
")",
";",
"RetryPolicy",
"retryPolicy",
"=",
"new",
"Counti... | Delete a file or directory at path.
@param path file or directory path
@param recursive whether to delete path recursively
@return true, if succeed | [
"Delete",
"a",
"file",
"or",
"directory",
"at",
"path",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/underfs/hdfs/src/main/java/alluxio/underfs/hdfs/HdfsUnderFileSystem.java#L691-L704 |
18,957 | Alluxio/alluxio | underfs/hdfs/src/main/java/alluxio/underfs/hdfs/HdfsUnderFileSystem.java | HdfsUnderFileSystem.rename | private boolean rename(String src, String dst) throws IOException {
IOException te = null;
FileSystem hdfs = getFs();
RetryPolicy retryPolicy = new CountingRetry(MAX_TRY);
while (retryPolicy.attempt()) {
try {
return hdfs.rename(new Path(src), new Path(dst));
} catch (IOException e) ... | java | private boolean rename(String src, String dst) throws IOException {
IOException te = null;
FileSystem hdfs = getFs();
RetryPolicy retryPolicy = new CountingRetry(MAX_TRY);
while (retryPolicy.attempt()) {
try {
return hdfs.rename(new Path(src), new Path(dst));
} catch (IOException e) ... | [
"private",
"boolean",
"rename",
"(",
"String",
"src",
",",
"String",
"dst",
")",
"throws",
"IOException",
"{",
"IOException",
"te",
"=",
"null",
";",
"FileSystem",
"hdfs",
"=",
"getFs",
"(",
")",
";",
"RetryPolicy",
"retryPolicy",
"=",
"new",
"CountingRetry"... | Rename a file or folder to a file or folder.
@param src path of source file or directory
@param dst path of destination file or directory
@return true if rename succeeds | [
"Rename",
"a",
"file",
"or",
"folder",
"to",
"a",
"file",
"or",
"folder",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/underfs/hdfs/src/main/java/alluxio/underfs/hdfs/HdfsUnderFileSystem.java#L736-L750 |
18,958 | Alluxio/alluxio | core/server/common/src/main/java/alluxio/web/WebInterfaceAbstractMetricsServlet.java | WebInterfaceAbstractMetricsServlet.populateCounterValues | protected void populateCounterValues(Map<String, Metric> operations,
Map<String, Counter> rpcInvocations, HttpServletRequest request) {
for (Map.Entry<String, Metric> entry : operations.entrySet()) {
if (entry.getValue() instanceof Gauge) {
request.setAttribute(entry.getKey(), ((Gauge<?>) entry... | java | protected void populateCounterValues(Map<String, Metric> operations,
Map<String, Counter> rpcInvocations, HttpServletRequest request) {
for (Map.Entry<String, Metric> entry : operations.entrySet()) {
if (entry.getValue() instanceof Gauge) {
request.setAttribute(entry.getKey(), ((Gauge<?>) entry... | [
"protected",
"void",
"populateCounterValues",
"(",
"Map",
"<",
"String",
",",
"Metric",
">",
"operations",
",",
"Map",
"<",
"String",
",",
"Counter",
">",
"rpcInvocations",
",",
"HttpServletRequest",
"request",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",... | Populates operation metrics for displaying in the UI.
@param request The {@link HttpServletRequest} object | [
"Populates",
"operation",
"metrics",
"for",
"displaying",
"in",
"the",
"UI",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/web/WebInterfaceAbstractMetricsServlet.java#L47-L61 |
18,959 | Alluxio/alluxio | core/common/src/main/java/alluxio/util/io/BufferUtils.java | BufferUtils.cleanDirectBuffer | public static synchronized void cleanDirectBuffer(ByteBuffer buffer) {
Preconditions.checkNotNull(buffer, "buffer");
Preconditions.checkArgument(buffer.isDirect(), "buffer isn't a DirectByteBuffer");
try {
if (sByteBufferCleanerMethod == null) {
sByteBufferCleanerMethod = buffer.getClass().get... | java | public static synchronized void cleanDirectBuffer(ByteBuffer buffer) {
Preconditions.checkNotNull(buffer, "buffer");
Preconditions.checkArgument(buffer.isDirect(), "buffer isn't a DirectByteBuffer");
try {
if (sByteBufferCleanerMethod == null) {
sByteBufferCleanerMethod = buffer.getClass().get... | [
"public",
"static",
"synchronized",
"void",
"cleanDirectBuffer",
"(",
"ByteBuffer",
"buffer",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"buffer",
",",
"\"buffer\"",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"buffer",
".",
"isDirect",
"(",
... | Forces to unmap a direct buffer if this buffer is no longer used. After calling this method,
this direct buffer should be discarded. This is unsafe operation and currently a work-around to
avoid huge memory occupation caused by memory map.
<p>
NOTE: DirectByteBuffers are not guaranteed to be garbage-collected immediat... | [
"Forces",
"to",
"unmap",
"a",
"direct",
"buffer",
"if",
"this",
"buffer",
"is",
"no",
"longer",
"used",
".",
"After",
"calling",
"this",
"method",
"this",
"direct",
"buffer",
"should",
"be",
"discarded",
".",
"This",
"is",
"unsafe",
"operation",
"and",
"cu... | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/io/BufferUtils.java#L63-L90 |
18,960 | Alluxio/alluxio | core/common/src/main/java/alluxio/util/io/BufferUtils.java | BufferUtils.getIncreasingByteArray | public static byte[] getIncreasingByteArray(int start, int len) {
byte[] ret = new byte[len];
for (int k = 0; k < len; k++) {
ret[k] = (byte) (k + start);
}
return ret;
} | java | public static byte[] getIncreasingByteArray(int start, int len) {
byte[] ret = new byte[len];
for (int k = 0; k < len; k++) {
ret[k] = (byte) (k + start);
}
return ret;
} | [
"public",
"static",
"byte",
"[",
"]",
"getIncreasingByteArray",
"(",
"int",
"start",
",",
"int",
"len",
")",
"{",
"byte",
"[",
"]",
"ret",
"=",
"new",
"byte",
"[",
"len",
"]",
";",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"len",
";",
"k... | Gets an increasing sequence of bytes starting with the given value.
@param start the starting value to use
@param len the target length of the sequence
@return an increasing sequence of bytes | [
"Gets",
"an",
"increasing",
"sequence",
"of",
"bytes",
"starting",
"with",
"the",
"given",
"value",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/io/BufferUtils.java#L154-L160 |
18,961 | Alluxio/alluxio | core/common/src/main/java/alluxio/util/io/BufferUtils.java | BufferUtils.equalConstantByteArray | public static boolean equalConstantByteArray(byte value, int len, byte[] arr) {
if (arr == null || arr.length != len) {
return false;
}
for (int k = 0; k < len; k++) {
if (arr[k] != value) {
return false;
}
}
return true;
} | java | public static boolean equalConstantByteArray(byte value, int len, byte[] arr) {
if (arr == null || arr.length != len) {
return false;
}
for (int k = 0; k < len; k++) {
if (arr[k] != value) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"equalConstantByteArray",
"(",
"byte",
"value",
",",
"int",
"len",
",",
"byte",
"[",
"]",
"arr",
")",
"{",
"if",
"(",
"arr",
"==",
"null",
"||",
"arr",
".",
"length",
"!=",
"len",
")",
"{",
"return",
"false",
";",
"}",
... | Checks if the given byte array starts with a constant sequence of bytes of the given value
and length.
@param value the value to check for
@param len the target length of the sequence
@param arr the byte array to check
@return true if the byte array has a prefix of length {@code len} that is a constant
sequence of byt... | [
"Checks",
"if",
"the",
"given",
"byte",
"array",
"starts",
"with",
"a",
"constant",
"sequence",
"of",
"bytes",
"of",
"the",
"given",
"value",
"and",
"length",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/io/BufferUtils.java#L172-L182 |
18,962 | Alluxio/alluxio | core/common/src/main/java/alluxio/util/io/BufferUtils.java | BufferUtils.equalIncreasingByteArray | public static boolean equalIncreasingByteArray(int start, int len, byte[] arr) {
if (arr == null || arr.length != len) {
return false;
}
for (int k = 0; k < len; k++) {
if (arr[k] != (byte) (start + k)) {
return false;
}
}
return true;
} | java | public static boolean equalIncreasingByteArray(int start, int len, byte[] arr) {
if (arr == null || arr.length != len) {
return false;
}
for (int k = 0; k < len; k++) {
if (arr[k] != (byte) (start + k)) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"equalIncreasingByteArray",
"(",
"int",
"start",
",",
"int",
"len",
",",
"byte",
"[",
"]",
"arr",
")",
"{",
"if",
"(",
"arr",
"==",
"null",
"||",
"arr",
".",
"length",
"!=",
"len",
")",
"{",
"return",
"false",
";",
"}",... | Checks if the given byte array starts with an increasing sequence of bytes of the given
length, starting from the given value. The array length must be equal to the length checked.
@param start the starting value to use
@param len the target length of the sequence
@param arr the byte array to check
@return true if the... | [
"Checks",
"if",
"the",
"given",
"byte",
"array",
"starts",
"with",
"an",
"increasing",
"sequence",
"of",
"bytes",
"of",
"the",
"given",
"length",
"starting",
"from",
"the",
"given",
"value",
".",
"The",
"array",
"length",
"must",
"be",
"equal",
"to",
"the"... | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/io/BufferUtils.java#L207-L217 |
18,963 | Alluxio/alluxio | core/common/src/main/java/alluxio/util/io/BufferUtils.java | BufferUtils.writeBufferToFile | public static void writeBufferToFile(String path, byte[] buffer) throws IOException {
try (FileOutputStream os = new FileOutputStream(path)) {
os.write(buffer);
}
} | java | public static void writeBufferToFile(String path, byte[] buffer) throws IOException {
try (FileOutputStream os = new FileOutputStream(path)) {
os.write(buffer);
}
} | [
"public",
"static",
"void",
"writeBufferToFile",
"(",
"String",
"path",
",",
"byte",
"[",
"]",
"buffer",
")",
"throws",
"IOException",
"{",
"try",
"(",
"FileOutputStream",
"os",
"=",
"new",
"FileOutputStream",
"(",
"path",
")",
")",
"{",
"os",
".",
"write"... | Writes buffer to the given file path.
@param path file path to write the data
@param buffer raw data | [
"Writes",
"buffer",
"to",
"the",
"given",
"file",
"path",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/io/BufferUtils.java#L273-L277 |
18,964 | Alluxio/alluxio | job/server/src/main/java/alluxio/master/job/JobCoordinator.java | JobCoordinator.cancel | public synchronized void cancel() {
for (int taskId : mJobInfo.getTaskIdList()) {
mCommandManager.submitCancelTaskCommand(mJobInfo.getId(), taskId,
mTaskIdToWorkerInfo.get(taskId).getId());
}
} | java | public synchronized void cancel() {
for (int taskId : mJobInfo.getTaskIdList()) {
mCommandManager.submitCancelTaskCommand(mJobInfo.getId(), taskId,
mTaskIdToWorkerInfo.get(taskId).getId());
}
} | [
"public",
"synchronized",
"void",
"cancel",
"(",
")",
"{",
"for",
"(",
"int",
"taskId",
":",
"mJobInfo",
".",
"getTaskIdList",
"(",
")",
")",
"{",
"mCommandManager",
".",
"submitCancelTaskCommand",
"(",
"mJobInfo",
".",
"getId",
"(",
")",
",",
"taskId",
",... | Cancels the current job. | [
"Cancels",
"the",
"current",
"job",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/master/job/JobCoordinator.java#L143-L148 |
18,965 | Alluxio/alluxio | job/server/src/main/java/alluxio/master/job/JobCoordinator.java | JobCoordinator.updateTasks | public synchronized void updateTasks(List<TaskInfo> taskInfoList) {
for (TaskInfo taskInfo : taskInfoList) {
mJobInfo.setTaskInfo(taskInfo.getTaskId(), taskInfo);
}
updateStatus();
} | java | public synchronized void updateTasks(List<TaskInfo> taskInfoList) {
for (TaskInfo taskInfo : taskInfoList) {
mJobInfo.setTaskInfo(taskInfo.getTaskId(), taskInfo);
}
updateStatus();
} | [
"public",
"synchronized",
"void",
"updateTasks",
"(",
"List",
"<",
"TaskInfo",
">",
"taskInfoList",
")",
"{",
"for",
"(",
"TaskInfo",
"taskInfo",
":",
"taskInfoList",
")",
"{",
"mJobInfo",
".",
"setTaskInfo",
"(",
"taskInfo",
".",
"getTaskId",
"(",
")",
",",... | Updates internal status with given tasks.
@param taskInfoList List of @TaskInfo instances to update | [
"Updates",
"internal",
"status",
"with",
"given",
"tasks",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/master/job/JobCoordinator.java#L155-L160 |
18,966 | Alluxio/alluxio | job/server/src/main/java/alluxio/master/job/JobCoordinator.java | JobCoordinator.setJobAsFailed | public synchronized void setJobAsFailed(String errorMessage) {
mJobInfo.setStatus(Status.FAILED);
mJobInfo.setErrorMessage(errorMessage);
} | java | public synchronized void setJobAsFailed(String errorMessage) {
mJobInfo.setStatus(Status.FAILED);
mJobInfo.setErrorMessage(errorMessage);
} | [
"public",
"synchronized",
"void",
"setJobAsFailed",
"(",
"String",
"errorMessage",
")",
"{",
"mJobInfo",
".",
"setStatus",
"(",
"Status",
".",
"FAILED",
")",
";",
"mJobInfo",
".",
"setErrorMessage",
"(",
"errorMessage",
")",
";",
"}"
] | Sets the job as failed with given error message.
@param errorMessage Error message to set for failure | [
"Sets",
"the",
"job",
"as",
"failed",
"with",
"given",
"error",
"message",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/master/job/JobCoordinator.java#L174-L177 |
18,967 | Alluxio/alluxio | job/server/src/main/java/alluxio/master/job/JobCoordinator.java | JobCoordinator.failTasksForWorker | public synchronized void failTasksForWorker(long workerId) {
Integer taskId = mWorkerIdToTaskId.get(workerId);
if (taskId == null) {
return;
}
TaskInfo taskInfo = mJobInfo.getTaskInfo(taskId);
if (taskInfo.getStatus().isFinished()) {
return;
}
taskInfo.setStatus(Status.FAILED);
... | java | public synchronized void failTasksForWorker(long workerId) {
Integer taskId = mWorkerIdToTaskId.get(workerId);
if (taskId == null) {
return;
}
TaskInfo taskInfo = mJobInfo.getTaskInfo(taskId);
if (taskInfo.getStatus().isFinished()) {
return;
}
taskInfo.setStatus(Status.FAILED);
... | [
"public",
"synchronized",
"void",
"failTasksForWorker",
"(",
"long",
"workerId",
")",
"{",
"Integer",
"taskId",
"=",
"mWorkerIdToTaskId",
".",
"get",
"(",
"workerId",
")",
";",
"if",
"(",
"taskId",
"==",
"null",
")",
"{",
"return",
";",
"}",
"TaskInfo",
"t... | Fails any incomplete tasks being run on the specified worker.
@param workerId the id of the worker to fail tasks for | [
"Fails",
"any",
"incomplete",
"tasks",
"being",
"run",
"on",
"the",
"specified",
"worker",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/master/job/JobCoordinator.java#L184-L196 |
18,968 | Alluxio/alluxio | job/server/src/main/java/alluxio/master/job/JobCoordinator.java | JobCoordinator.updateStatus | private void updateStatus() {
int completed = 0;
List<TaskInfo> taskInfoList = mJobInfo.getTaskInfoList();
for (TaskInfo info : taskInfoList) {
switch (info.getStatus()) {
case FAILED:
mJobInfo.setStatus(Status.FAILED);
if (mJobInfo.getErrorMessage().isEmpty()) {
... | java | private void updateStatus() {
int completed = 0;
List<TaskInfo> taskInfoList = mJobInfo.getTaskInfoList();
for (TaskInfo info : taskInfoList) {
switch (info.getStatus()) {
case FAILED:
mJobInfo.setStatus(Status.FAILED);
if (mJobInfo.getErrorMessage().isEmpty()) {
... | [
"private",
"void",
"updateStatus",
"(",
")",
"{",
"int",
"completed",
"=",
"0",
";",
"List",
"<",
"TaskInfo",
">",
"taskInfoList",
"=",
"mJobInfo",
".",
"getTaskInfoList",
"(",
")",
";",
"for",
"(",
"TaskInfo",
"info",
":",
"taskInfoList",
")",
"{",
"swi... | Updates the status of the job. When all the tasks are completed, run the join method in the
definition. | [
"Updates",
"the",
"status",
"of",
"the",
"job",
".",
"When",
"all",
"the",
"tasks",
"are",
"completed",
"run",
"the",
"join",
"method",
"in",
"the",
"definition",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/master/job/JobCoordinator.java#L209-L254 |
18,969 | Alluxio/alluxio | job/server/src/main/java/alluxio/master/job/JobCoordinator.java | JobCoordinator.join | private String join(List<TaskInfo> taskInfoList) throws Exception {
// get the job definition
JobDefinition<JobConfig, Serializable, Serializable> definition =
JobDefinitionRegistry.INSTANCE.getJobDefinition(mJobInfo.getJobConfig());
Map<WorkerInfo, Serializable> taskResults = Maps.newHashMap();
... | java | private String join(List<TaskInfo> taskInfoList) throws Exception {
// get the job definition
JobDefinition<JobConfig, Serializable, Serializable> definition =
JobDefinitionRegistry.INSTANCE.getJobDefinition(mJobInfo.getJobConfig());
Map<WorkerInfo, Serializable> taskResults = Maps.newHashMap();
... | [
"private",
"String",
"join",
"(",
"List",
"<",
"TaskInfo",
">",
"taskInfoList",
")",
"throws",
"Exception",
"{",
"// get the job definition",
"JobDefinition",
"<",
"JobConfig",
",",
"Serializable",
",",
"Serializable",
">",
"definition",
"=",
"JobDefinitionRegistry",
... | Joins the task results and produces a final result.
@param taskInfoList the list of task information
@return the aggregated result as a String
@throws Exception if any error occurs | [
"Joins",
"the",
"task",
"results",
"and",
"produces",
"a",
"final",
"result",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/master/job/JobCoordinator.java#L263-L272 |
18,970 | Alluxio/alluxio | core/common/src/main/java/alluxio/underfs/MultiRangeObjectInputStream.java | MultiRangeObjectInputStream.openStream | private void openStream() throws IOException {
if (mClosed) {
throw new IOException("Stream closed");
}
if (mMultiRangeChunkSize <= 0) {
throw new IOException(ExceptionMessage.BLOCK_SIZE_INVALID.getMessage(mMultiRangeChunkSize));
}
if (mStream != null) { // stream is already open
... | java | private void openStream() throws IOException {
if (mClosed) {
throw new IOException("Stream closed");
}
if (mMultiRangeChunkSize <= 0) {
throw new IOException(ExceptionMessage.BLOCK_SIZE_INVALID.getMessage(mMultiRangeChunkSize));
}
if (mStream != null) { // stream is already open
... | [
"private",
"void",
"openStream",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"mClosed",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Stream closed\"",
")",
";",
"}",
"if",
"(",
"mMultiRangeChunkSize",
"<=",
"0",
")",
"{",
"throw",
"new",
"IOExce... | Opens a new stream at mPos if the wrapped stream mStream is null. | [
"Opens",
"a",
"new",
"stream",
"at",
"mPos",
"if",
"the",
"wrapped",
"stream",
"mStream",
"is",
"null",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/underfs/MultiRangeObjectInputStream.java#L134-L148 |
18,971 | Alluxio/alluxio | core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalSnapshot.java | UfsJournalSnapshot.getSnapshot | public static UfsJournalSnapshot getSnapshot(UfsJournal journal) throws IOException {
// Checkpoints.
List<UfsJournalFile> checkpoints = new ArrayList<>();
UfsStatus[] statuses = journal.getUfs().listStatus(journal.getCheckpointDir().toString());
if (statuses != null) {
for (UfsStatus status : sta... | java | public static UfsJournalSnapshot getSnapshot(UfsJournal journal) throws IOException {
// Checkpoints.
List<UfsJournalFile> checkpoints = new ArrayList<>();
UfsStatus[] statuses = journal.getUfs().listStatus(journal.getCheckpointDir().toString());
if (statuses != null) {
for (UfsStatus status : sta... | [
"public",
"static",
"UfsJournalSnapshot",
"getSnapshot",
"(",
"UfsJournal",
"journal",
")",
"throws",
"IOException",
"{",
"// Checkpoints.",
"List",
"<",
"UfsJournalFile",
">",
"checkpoints",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"UfsStatus",
"[",
"]",
"... | Creates a snapshot of the journal.
@param journal the journal
@return the journal snapshot | [
"Creates",
"a",
"snapshot",
"of",
"the",
"journal",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalSnapshot.java#L89-L124 |
18,972 | Alluxio/alluxio | core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalSnapshot.java | UfsJournalSnapshot.getNextLogSequenceNumberToCheckpoint | static long getNextLogSequenceNumberToCheckpoint(UfsJournal journal) throws IOException {
List<UfsJournalFile> checkpoints = new ArrayList<>();
UfsStatus[] statuses = journal.getUfs().listStatus(journal.getCheckpointDir().toString());
if (statuses != null) {
for (UfsStatus status : statuses) {
... | java | static long getNextLogSequenceNumberToCheckpoint(UfsJournal journal) throws IOException {
List<UfsJournalFile> checkpoints = new ArrayList<>();
UfsStatus[] statuses = journal.getUfs().listStatus(journal.getCheckpointDir().toString());
if (statuses != null) {
for (UfsStatus status : statuses) {
... | [
"static",
"long",
"getNextLogSequenceNumberToCheckpoint",
"(",
"UfsJournal",
"journal",
")",
"throws",
"IOException",
"{",
"List",
"<",
"UfsJournalFile",
">",
"checkpoints",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"UfsStatus",
"[",
"]",
"statuses",
"=",
"j... | Gets the first journal log sequence number that is not yet checkpointed.
@return the first journal log sequence number that is not yet checkpointed | [
"Gets",
"the",
"first",
"journal",
"log",
"sequence",
"number",
"that",
"is",
"not",
"yet",
"checkpointed",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalSnapshot.java#L158-L174 |
18,973 | Alluxio/alluxio | core/base/src/main/java/alluxio/util/io/PathUtils.java | PathUtils.cleanPath | public static String cleanPath(String path) throws InvalidPathException {
validatePath(path);
return FilenameUtils.separatorsToUnix(FilenameUtils.normalizeNoEndSeparator(path));
} | java | public static String cleanPath(String path) throws InvalidPathException {
validatePath(path);
return FilenameUtils.separatorsToUnix(FilenameUtils.normalizeNoEndSeparator(path));
} | [
"public",
"static",
"String",
"cleanPath",
"(",
"String",
"path",
")",
"throws",
"InvalidPathException",
"{",
"validatePath",
"(",
"path",
")",
";",
"return",
"FilenameUtils",
".",
"separatorsToUnix",
"(",
"FilenameUtils",
".",
"normalizeNoEndSeparator",
"(",
"path"... | Checks and normalizes the given path.
@param path The path to clean up
@return a normalized version of the path, with single separators between path components and
dot components resolved
@throws InvalidPathException if the path is invalid | [
"Checks",
"and",
"normalizes",
"the",
"given",
"path",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/util/io/PathUtils.java#L44-L47 |
18,974 | Alluxio/alluxio | core/base/src/main/java/alluxio/util/io/PathUtils.java | PathUtils.getParent | public static String getParent(String path) throws InvalidPathException {
String cleanedPath = cleanPath(path);
String name = FilenameUtils.getName(cleanedPath);
String parent = cleanedPath.substring(0, cleanedPath.length() - name.length() - 1);
if (parent.isEmpty()) {
// The parent is the root pa... | java | public static String getParent(String path) throws InvalidPathException {
String cleanedPath = cleanPath(path);
String name = FilenameUtils.getName(cleanedPath);
String parent = cleanedPath.substring(0, cleanedPath.length() - name.length() - 1);
if (parent.isEmpty()) {
// The parent is the root pa... | [
"public",
"static",
"String",
"getParent",
"(",
"String",
"path",
")",
"throws",
"InvalidPathException",
"{",
"String",
"cleanedPath",
"=",
"cleanPath",
"(",
"path",
")",
";",
"String",
"name",
"=",
"FilenameUtils",
".",
"getName",
"(",
"cleanedPath",
")",
";"... | Gets the parent of the file at a path.
@param path The path
@return the parent path of the file; this is "/" if the given path is the root
@throws InvalidPathException if the path is invalid | [
"Gets",
"the",
"parent",
"of",
"the",
"file",
"at",
"a",
"path",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/util/io/PathUtils.java#L131-L140 |
18,975 | Alluxio/alluxio | core/base/src/main/java/alluxio/util/io/PathUtils.java | PathUtils.getPathComponents | public static String[] getPathComponents(String path) throws InvalidPathException {
path = cleanPath(path);
if (isRoot(path)) {
return new String[]{""};
}
return path.split(AlluxioURI.SEPARATOR);
} | java | public static String[] getPathComponents(String path) throws InvalidPathException {
path = cleanPath(path);
if (isRoot(path)) {
return new String[]{""};
}
return path.split(AlluxioURI.SEPARATOR);
} | [
"public",
"static",
"String",
"[",
"]",
"getPathComponents",
"(",
"String",
"path",
")",
"throws",
"InvalidPathException",
"{",
"path",
"=",
"cleanPath",
"(",
"path",
")",
";",
"if",
"(",
"isRoot",
"(",
"path",
")",
")",
"{",
"return",
"new",
"String",
"... | Gets the path components of the given path. The first component will be an empty string.
"/a/b/c" => {"", "a", "b", "c"}
"/" => {""}
@param path The path to split
@return the path split into components
@throws InvalidPathException if the path is invalid | [
"Gets",
"the",
"path",
"components",
"of",
"the",
"given",
"path",
".",
"The",
"first",
"component",
"will",
"be",
"an",
"empty",
"string",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/util/io/PathUtils.java#L152-L158 |
18,976 | Alluxio/alluxio | core/base/src/main/java/alluxio/util/io/PathUtils.java | PathUtils.subtractPaths | public static String subtractPaths(String path, String prefix) throws InvalidPathException {
String cleanedPath = cleanPath(path);
String cleanedPrefix = cleanPath(prefix);
if (cleanedPath.equals(cleanedPrefix)) {
return "";
}
if (!hasPrefix(cleanedPath, cleanedPrefix)) {
throw new Runti... | java | public static String subtractPaths(String path, String prefix) throws InvalidPathException {
String cleanedPath = cleanPath(path);
String cleanedPrefix = cleanPath(prefix);
if (cleanedPath.equals(cleanedPrefix)) {
return "";
}
if (!hasPrefix(cleanedPath, cleanedPrefix)) {
throw new Runti... | [
"public",
"static",
"String",
"subtractPaths",
"(",
"String",
"path",
",",
"String",
"prefix",
")",
"throws",
"InvalidPathException",
"{",
"String",
"cleanedPath",
"=",
"cleanPath",
"(",
"path",
")",
";",
"String",
"cleanedPrefix",
"=",
"cleanPath",
"(",
"prefix... | Removes the prefix from the path, yielding a relative path from the second path to the first.
If the paths are the same, this method returns the empty string.
@param path the full path
@param prefix the prefix to remove
@return the path with the prefix removed
@throws InvalidPathException if either of the arguments a... | [
"Removes",
"the",
"prefix",
"from",
"the",
"path",
"yielding",
"a",
"relative",
"path",
"from",
"the",
"second",
"path",
"to",
"the",
"first",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/util/io/PathUtils.java#L170-L184 |
18,977 | Alluxio/alluxio | core/base/src/main/java/alluxio/util/io/PathUtils.java | PathUtils.validatePath | public static void validatePath(String path) throws InvalidPathException {
boolean invalid = (path == null || path.isEmpty());
if (!OSUtils.isWindows()) {
invalid = (invalid || !path.startsWith(AlluxioURI.SEPARATOR));
}
if (invalid) {
throw new InvalidPathException(ExceptionMessage.PATH_INV... | java | public static void validatePath(String path) throws InvalidPathException {
boolean invalid = (path == null || path.isEmpty());
if (!OSUtils.isWindows()) {
invalid = (invalid || !path.startsWith(AlluxioURI.SEPARATOR));
}
if (invalid) {
throw new InvalidPathException(ExceptionMessage.PATH_INV... | [
"public",
"static",
"void",
"validatePath",
"(",
"String",
"path",
")",
"throws",
"InvalidPathException",
"{",
"boolean",
"invalid",
"=",
"(",
"path",
"==",
"null",
"||",
"path",
".",
"isEmpty",
"(",
")",
")",
";",
"if",
"(",
"!",
"OSUtils",
".",
"isWind... | Checks if the given path is properly formed.
@param path The path to check
@throws InvalidPathException If the path is not properly formed | [
"Checks",
"if",
"the",
"given",
"path",
"is",
"properly",
"formed",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/util/io/PathUtils.java#L227-L236 |
18,978 | Alluxio/alluxio | core/base/src/main/java/alluxio/util/io/PathUtils.java | PathUtils.temporaryFileName | public static String temporaryFileName(long nonce, String path) {
return path + String.format(TEMPORARY_SUFFIX_FORMAT, nonce);
} | java | public static String temporaryFileName(long nonce, String path) {
return path + String.format(TEMPORARY_SUFFIX_FORMAT, nonce);
} | [
"public",
"static",
"String",
"temporaryFileName",
"(",
"long",
"nonce",
",",
"String",
"path",
")",
"{",
"return",
"path",
"+",
"String",
".",
"format",
"(",
"TEMPORARY_SUFFIX_FORMAT",
",",
"nonce",
")",
";",
"}"
] | Generates a deterministic temporary file name for the a path and a file id and a nonce.
@param nonce a nonce token
@param path a file path
@return a deterministic temporary file name | [
"Generates",
"a",
"deterministic",
"temporary",
"file",
"name",
"for",
"the",
"a",
"path",
"and",
"a",
"file",
"id",
"and",
"a",
"nonce",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/util/io/PathUtils.java#L245-L247 |
18,979 | Alluxio/alluxio | core/base/src/main/java/alluxio/util/io/PathUtils.java | PathUtils.uniqPath | public static String uniqPath() {
StackTraceElement caller = new Throwable().getStackTrace()[1];
long time = System.nanoTime();
return "/" + caller.getClassName() + "/" + caller.getMethodName() + "/" + time;
} | java | public static String uniqPath() {
StackTraceElement caller = new Throwable().getStackTrace()[1];
long time = System.nanoTime();
return "/" + caller.getClassName() + "/" + caller.getMethodName() + "/" + time;
} | [
"public",
"static",
"String",
"uniqPath",
"(",
")",
"{",
"StackTraceElement",
"caller",
"=",
"new",
"Throwable",
"(",
")",
".",
"getStackTrace",
"(",
")",
"[",
"1",
"]",
";",
"long",
"time",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"return",
"\"/... | Creates a unique path based off the caller.
@return unique path based off the caller | [
"Creates",
"a",
"unique",
"path",
"based",
"off",
"the",
"caller",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/util/io/PathUtils.java#L275-L279 |
18,980 | Alluxio/alluxio | core/base/src/main/java/alluxio/util/io/PathUtils.java | PathUtils.normalizePath | public static String normalizePath(String path, String separator) {
return path.endsWith(separator) ? path : path + separator;
} | java | public static String normalizePath(String path, String separator) {
return path.endsWith(separator) ? path : path + separator;
} | [
"public",
"static",
"String",
"normalizePath",
"(",
"String",
"path",
",",
"String",
"separator",
")",
"{",
"return",
"path",
".",
"endsWith",
"(",
"separator",
")",
"?",
"path",
":",
"path",
"+",
"separator",
";",
"}"
] | Adds a trailing separator if it does not exist in path.
@param path the file name
@param separator trailing separator to add
@return updated path with trailing separator | [
"Adds",
"a",
"trailing",
"separator",
"if",
"it",
"does",
"not",
"exist",
"in",
"path",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/util/io/PathUtils.java#L288-L290 |
18,981 | Alluxio/alluxio | minicluster/src/main/java/alluxio/multi/process/Worker.java | Worker.start | public synchronized void start() throws IOException {
Preconditions.checkState(mProcess == null, "Worker is already running");
mProcess = new ExternalProcess(mProperties, LimitedLifeWorkerProcess.class,
new File(mLogsDir, "worker.out"));
mProcess.start();
} | java | public synchronized void start() throws IOException {
Preconditions.checkState(mProcess == null, "Worker is already running");
mProcess = new ExternalProcess(mProperties, LimitedLifeWorkerProcess.class,
new File(mLogsDir, "worker.out"));
mProcess.start();
} | [
"public",
"synchronized",
"void",
"start",
"(",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkState",
"(",
"mProcess",
"==",
"null",
",",
"\"Worker is already running\"",
")",
";",
"mProcess",
"=",
"new",
"ExternalProcess",
"(",
"mProperties",
","... | Launches the worker process. | [
"Launches",
"the",
"worker",
"process",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/minicluster/src/main/java/alluxio/multi/process/Worker.java#L51-L56 |
18,982 | Alluxio/alluxio | core/common/src/main/java/alluxio/util/executor/ControllableQueue.java | ControllableQueue.add | public void add(long delay, T value) {
mQueue.add(new DelayNode<>(value, delay + mPastTime));
} | java | public void add(long delay, T value) {
mQueue.add(new DelayNode<>(value, delay + mPastTime));
} | [
"public",
"void",
"add",
"(",
"long",
"delay",
",",
"T",
"value",
")",
"{",
"mQueue",
".",
"add",
"(",
"new",
"DelayNode",
"<>",
"(",
"value",
",",
"delay",
"+",
"mPastTime",
")",
")",
";",
"}"
] | Adds a new node into the queue.
@param delay the delay in milliseconds
@param value the value | [
"Adds",
"a",
"new",
"node",
"into",
"the",
"queue",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/executor/ControllableQueue.java#L62-L64 |
18,983 | Alluxio/alluxio | core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalLogWriter.java | UfsJournalLogWriter.maybeRecoverFromUfsFailures | private void maybeRecoverFromUfsFailures() throws IOException, JournalClosedException {
if (!mNeedsRecovery) {
return;
}
long lastPersistSeq = recoverLastPersistedJournalEntry();
createNewLogFile(lastPersistSeq + 1);
if (!mEntriesToFlush.isEmpty()) {
JournalEntry firstEntryToFlush = mE... | java | private void maybeRecoverFromUfsFailures() throws IOException, JournalClosedException {
if (!mNeedsRecovery) {
return;
}
long lastPersistSeq = recoverLastPersistedJournalEntry();
createNewLogFile(lastPersistSeq + 1);
if (!mEntriesToFlush.isEmpty()) {
JournalEntry firstEntryToFlush = mE... | [
"private",
"void",
"maybeRecoverFromUfsFailures",
"(",
")",
"throws",
"IOException",
",",
"JournalClosedException",
"{",
"if",
"(",
"!",
"mNeedsRecovery",
")",
"{",
"return",
";",
"}",
"long",
"lastPersistSeq",
"=",
"recoverLastPersistedJournalEntry",
"(",
")",
";",... | Core logic of UFS journal recovery from UFS failures.
If Alluxio stores its journals in UFS, then Alluxio needs to handle UFS failures.
When UFS is dead, there is nothing Alluxio can do because Alluxio relies on UFS to
persist journal entries. Consequently any metadata operation will block because Alluxio
cannot flush... | [
"Core",
"logic",
"of",
"UFS",
"journal",
"recovery",
"from",
"UFS",
"failures",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalLogWriter.java#L156-L191 |
18,984 | Alluxio/alluxio | core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalLogWriter.java | UfsJournalLogWriter.recoverLastPersistedJournalEntry | private long recoverLastPersistedJournalEntry() throws IOException {
UfsJournalSnapshot snapshot = UfsJournalSnapshot.getSnapshot(mJournal);
long lastPersistSeq = -1;
UfsJournalFile currentLog = snapshot.getCurrentLog(mJournal);
if (currentLog != null) {
LOG.info("Recovering from previous UFS jour... | java | private long recoverLastPersistedJournalEntry() throws IOException {
UfsJournalSnapshot snapshot = UfsJournalSnapshot.getSnapshot(mJournal);
long lastPersistSeq = -1;
UfsJournalFile currentLog = snapshot.getCurrentLog(mJournal);
if (currentLog != null) {
LOG.info("Recovering from previous UFS jour... | [
"private",
"long",
"recoverLastPersistedJournalEntry",
"(",
")",
"throws",
"IOException",
"{",
"UfsJournalSnapshot",
"snapshot",
"=",
"UfsJournalSnapshot",
".",
"getSnapshot",
"(",
"mJournal",
")",
";",
"long",
"lastPersistSeq",
"=",
"-",
"1",
";",
"UfsJournalFile",
... | Examine the UFS to determine the most recent journal entry, and return its sequence number.
1. Locate the most recent incomplete journal file, i.e. journal file that starts with
a valid sequence number S (hex), and ends with 0x7fffffffffffffff. The journal file
name encodes this information, i.e. S-0x7fffffffffffffff.... | [
"Examine",
"the",
"UFS",
"to",
"determine",
"the",
"most",
"recent",
"journal",
"entry",
"and",
"return",
"its",
"sequence",
"number",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalLogWriter.java#L208-L245 |
18,985 | Alluxio/alluxio | core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalLogWriter.java | UfsJournalLogWriter.maybeRotateLog | private void maybeRotateLog() throws IOException {
if (!mRotateLogForNextWrite) {
return;
}
if (mJournalOutputStream != null) {
mJournalOutputStream.close();
mJournalOutputStream = null;
}
createNewLogFile(mNextSequenceNumber);
mRotateLogForNextWrite = false;
} | java | private void maybeRotateLog() throws IOException {
if (!mRotateLogForNextWrite) {
return;
}
if (mJournalOutputStream != null) {
mJournalOutputStream.close();
mJournalOutputStream = null;
}
createNewLogFile(mNextSequenceNumber);
mRotateLogForNextWrite = false;
} | [
"private",
"void",
"maybeRotateLog",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"mRotateLogForNextWrite",
")",
"{",
"return",
";",
"}",
"if",
"(",
"mJournalOutputStream",
"!=",
"null",
")",
"{",
"mJournalOutputStream",
".",
"close",
"(",
")",
";... | Closes the current journal output stream and creates a new one.
The implementation must be idempotent so that it can work when retrying during failures. | [
"Closes",
"the",
"current",
"journal",
"output",
"stream",
"and",
"creates",
"a",
"new",
"one",
".",
"The",
"implementation",
"must",
"be",
"idempotent",
"so",
"that",
"it",
"can",
"work",
"when",
"retrying",
"during",
"failures",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalLogWriter.java#L251-L262 |
18,986 | Alluxio/alluxio | core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalLogWriter.java | UfsJournalLogWriter.completeLog | private void completeLog(UfsJournalFile currentLog, long nextSequenceNumber) throws IOException {
String current = currentLog.getLocation().toString();
if (nextSequenceNumber <= currentLog.getStart()) {
LOG.info("No journal entry found in current journal file {}. Deleting it", current);
if (!mUfs.de... | java | private void completeLog(UfsJournalFile currentLog, long nextSequenceNumber) throws IOException {
String current = currentLog.getLocation().toString();
if (nextSequenceNumber <= currentLog.getStart()) {
LOG.info("No journal entry found in current journal file {}. Deleting it", current);
if (!mUfs.de... | [
"private",
"void",
"completeLog",
"(",
"UfsJournalFile",
"currentLog",
",",
"long",
"nextSequenceNumber",
")",
"throws",
"IOException",
"{",
"String",
"current",
"=",
"currentLog",
".",
"getLocation",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"nextS... | Completes the given log.
If the log is empty, it will be deleted.
This method must be safe to run by multiple masters at the same time. This could happen if a
primary master loses leadership and takes a while to close its journal. By the time it
completes the current log, the new primary might be trying to close it a... | [
"Completes",
"the",
"given",
"log",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalLogWriter.java#L288-L315 |
18,987 | Alluxio/alluxio | core/common/src/main/java/alluxio/grpc/GrpcSerializationUtils.java | GrpcSerializationUtils.getBufferFromStream | public static ReadableBuffer getBufferFromStream(InputStream stream) {
if (!sZeroCopyReceiveSupported
|| !stream.getClass().equals(sReadableBufferField.getDeclaringClass())) {
return null;
}
try {
return (ReadableBuffer) sReadableBufferField.get(stream);
} catch (Exception e) {
... | java | public static ReadableBuffer getBufferFromStream(InputStream stream) {
if (!sZeroCopyReceiveSupported
|| !stream.getClass().equals(sReadableBufferField.getDeclaringClass())) {
return null;
}
try {
return (ReadableBuffer) sReadableBufferField.get(stream);
} catch (Exception e) {
... | [
"public",
"static",
"ReadableBuffer",
"getBufferFromStream",
"(",
"InputStream",
"stream",
")",
"{",
"if",
"(",
"!",
"sZeroCopyReceiveSupported",
"||",
"!",
"stream",
".",
"getClass",
"(",
")",
".",
"equals",
"(",
"sReadableBufferField",
".",
"getDeclaringClass",
... | Gets a buffer directly from a gRPC input stream.
@param stream the input stream
@return the raw data buffer | [
"Gets",
"a",
"buffer",
"directly",
"from",
"a",
"gRPC",
"input",
"stream",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/grpc/GrpcSerializationUtils.java#L124-L135 |
18,988 | Alluxio/alluxio | core/common/src/main/java/alluxio/grpc/GrpcSerializationUtils.java | GrpcSerializationUtils.getByteBufFromReadableBuffer | public static ByteBuf getByteBufFromReadableBuffer(ReadableBuffer buffer) {
if (!sZeroCopyReceiveSupported) {
return null;
}
try {
if (buffer instanceof CompositeReadableBuffer) {
Queue<ReadableBuffer> buffers = (Queue<ReadableBuffer>) sCompositeBuffers.get(buffer);
if (buffers.s... | java | public static ByteBuf getByteBufFromReadableBuffer(ReadableBuffer buffer) {
if (!sZeroCopyReceiveSupported) {
return null;
}
try {
if (buffer instanceof CompositeReadableBuffer) {
Queue<ReadableBuffer> buffers = (Queue<ReadableBuffer>) sCompositeBuffers.get(buffer);
if (buffers.s... | [
"public",
"static",
"ByteBuf",
"getByteBufFromReadableBuffer",
"(",
"ReadableBuffer",
"buffer",
")",
"{",
"if",
"(",
"!",
"sZeroCopyReceiveSupported",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"if",
"(",
"buffer",
"instanceof",
"CompositeReadableBuffer",
"... | Gets a Netty buffer directly from a gRPC ReadableBuffer.
@param buffer the input buffer
@return the raw ByteBuf, or null if the ByteBuf cannot be extracted | [
"Gets",
"a",
"Netty",
"buffer",
"directly",
"from",
"a",
"gRPC",
"ReadableBuffer",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/grpc/GrpcSerializationUtils.java#L143-L171 |
18,989 | Alluxio/alluxio | core/common/src/main/java/alluxio/grpc/GrpcSerializationUtils.java | GrpcSerializationUtils.addBuffersToStream | public static boolean addBuffersToStream(ByteBuf[] buffers, OutputStream stream) {
if (!sZeroCopySendSupported || !stream.getClass().equals(sBufferList.getDeclaringClass())) {
return false;
}
try {
if (sCurrent.get(stream) != null) {
return false;
}
for (ByteBuf buffer : buff... | java | public static boolean addBuffersToStream(ByteBuf[] buffers, OutputStream stream) {
if (!sZeroCopySendSupported || !stream.getClass().equals(sBufferList.getDeclaringClass())) {
return false;
}
try {
if (sCurrent.get(stream) != null) {
return false;
}
for (ByteBuf buffer : buff... | [
"public",
"static",
"boolean",
"addBuffersToStream",
"(",
"ByteBuf",
"[",
"]",
"buffers",
",",
"OutputStream",
"stream",
")",
"{",
"if",
"(",
"!",
"sZeroCopySendSupported",
"||",
"!",
"stream",
".",
"getClass",
"(",
")",
".",
"equals",
"(",
"sBufferList",
".... | Add the given buffers directly to the gRPC output stream.
@param buffers the buffers to be added
@param stream the output stream
@return whether the buffers are added successfully | [
"Add",
"the",
"given",
"buffers",
"directly",
"to",
"the",
"gRPC",
"output",
"stream",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/grpc/GrpcSerializationUtils.java#L180-L200 |
18,990 | Alluxio/alluxio | core/common/src/main/java/alluxio/grpc/GrpcSerializationUtils.java | GrpcSerializationUtils.overrideMethods | public static ServerServiceDefinition overrideMethods(
final ServerServiceDefinition service,
final Map<MethodDescriptor, MethodDescriptor> marshallers) {
List<ServerMethodDefinition<?, ?>> newMethods = new ArrayList<ServerMethodDefinition<?, ?>>();
List<MethodDescriptor<?, ?>> newDescriptors = new ... | java | public static ServerServiceDefinition overrideMethods(
final ServerServiceDefinition service,
final Map<MethodDescriptor, MethodDescriptor> marshallers) {
List<ServerMethodDefinition<?, ?>> newMethods = new ArrayList<ServerMethodDefinition<?, ?>>();
List<MethodDescriptor<?, ?>> newDescriptors = new ... | [
"public",
"static",
"ServerServiceDefinition",
"overrideMethods",
"(",
"final",
"ServerServiceDefinition",
"service",
",",
"final",
"Map",
"<",
"MethodDescriptor",
",",
"MethodDescriptor",
">",
"marshallers",
")",
"{",
"List",
"<",
"ServerMethodDefinition",
"<",
"?",
... | Creates a service definition that uses custom marshallers.
@param service the service to intercept
@param marshallers a map that specifies which marshaller to use for each method
@return the new service definition | [
"Creates",
"a",
"service",
"definition",
"that",
"uses",
"custom",
"marshallers",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/grpc/GrpcSerializationUtils.java#L209-L228 |
18,991 | Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/ForkJoinTask.java | ForkJoinTask.uncheckedThrow | @SuppressWarnings("unchecked")
static <T extends Throwable> void uncheckedThrow(Throwable t) throws T {
if (t != null)
throw (T) t; // rely on vacuous cast
else
throw new Error("Unknown Exception");
} | java | @SuppressWarnings("unchecked")
static <T extends Throwable> void uncheckedThrow(Throwable t) throws T {
if (t != null)
throw (T) t; // rely on vacuous cast
else
throw new Error("Unknown Exception");
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"static",
"<",
"T",
"extends",
"Throwable",
">",
"void",
"uncheckedThrow",
"(",
"Throwable",
"t",
")",
"throws",
"T",
"{",
"if",
"(",
"t",
"!=",
"null",
")",
"throw",
"(",
"T",
")",
"t",
";",
"// rely... | The sneaky part of sneaky throw, relying on generics limitations to evade compiler complaints
about rethrowing unchecked exceptions. | [
"The",
"sneaky",
"part",
"of",
"sneaky",
"throw",
"relying",
"on",
"generics",
"limitations",
"to",
"evade",
"compiler",
"complaints",
"about",
"rethrowing",
"unchecked",
"exceptions",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/ForkJoinTask.java#L287-L293 |
18,992 | Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/ForkJoinTask.java | ForkJoinTask.getQueuedTaskCount | public static int getQueuedTaskCount() {
Thread t;
ForkJoinPool.WorkQueue q;
if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
q = ((ForkJoinWorkerThread) t).workQueue;
else
q = ForkJoinPool.commonSubmitterQueue();
return (q == null) ? 0 : q.queueSize();
} | java | public static int getQueuedTaskCount() {
Thread t;
ForkJoinPool.WorkQueue q;
if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
q = ((ForkJoinWorkerThread) t).workQueue;
else
q = ForkJoinPool.commonSubmitterQueue();
return (q == null) ? 0 : q.queueSize();
} | [
"public",
"static",
"int",
"getQueuedTaskCount",
"(",
")",
"{",
"Thread",
"t",
";",
"ForkJoinPool",
".",
"WorkQueue",
"q",
";",
"if",
"(",
"(",
"t",
"=",
"Thread",
".",
"currentThread",
"(",
")",
")",
"instanceof",
"ForkJoinWorkerThread",
")",
"q",
"=",
... | Returns an estimate of the number of tasks that have been forked by the current worker thread
but not yet executed. This value may be useful for heuristic decisions about whether to fork
other tasks.
@return the number of tasks | [
"Returns",
"an",
"estimate",
"of",
"the",
"number",
"of",
"tasks",
"that",
"have",
"been",
"forked",
"by",
"the",
"current",
"worker",
"thread",
"but",
"not",
"yet",
"executed",
".",
"This",
"value",
"may",
"be",
"useful",
"for",
"heuristic",
"decisions",
... | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/ForkJoinTask.java#L448-L456 |
18,993 | Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/ForkJoinTask.java | ForkJoinTask.peekNextLocalTask | protected static ForkJoinTask<?> peekNextLocalTask() {
Thread t;
ForkJoinPool.WorkQueue q;
if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
q = ((ForkJoinWorkerThread) t).workQueue;
else
q = ForkJoinPool.commonSubmitterQueue();
return (q == null) ? null : q.peek();
} | java | protected static ForkJoinTask<?> peekNextLocalTask() {
Thread t;
ForkJoinPool.WorkQueue q;
if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
q = ((ForkJoinWorkerThread) t).workQueue;
else
q = ForkJoinPool.commonSubmitterQueue();
return (q == null) ? null : q.peek();
} | [
"protected",
"static",
"ForkJoinTask",
"<",
"?",
">",
"peekNextLocalTask",
"(",
")",
"{",
"Thread",
"t",
";",
"ForkJoinPool",
".",
"WorkQueue",
"q",
";",
"if",
"(",
"(",
"t",
"=",
"Thread",
".",
"currentThread",
"(",
")",
")",
"instanceof",
"ForkJoinWorker... | Returns, but does not unschedule or execute, a task queued by the current thread but not yet
executed, if one is immediately available. There is no guarantee that this task will actually
be polled or executed next. Conversely, this method may return null even if a task exists but
cannot be accessed without contention w... | [
"Returns",
"but",
"does",
"not",
"unschedule",
"or",
"execute",
"a",
"task",
"queued",
"by",
"the",
"current",
"thread",
"but",
"not",
"yet",
"executed",
"if",
"one",
"is",
"immediately",
"available",
".",
"There",
"is",
"no",
"guarantee",
"that",
"this",
... | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/ForkJoinTask.java#L481-L489 |
18,994 | Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/ForkJoinTask.java | ForkJoinTask.pollNextLocalTask | protected static ForkJoinTask<?> pollNextLocalTask() {
Thread t;
return ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
? ((ForkJoinWorkerThread) t).workQueue.nextLocalTask()
: null;
} | java | protected static ForkJoinTask<?> pollNextLocalTask() {
Thread t;
return ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
? ((ForkJoinWorkerThread) t).workQueue.nextLocalTask()
: null;
} | [
"protected",
"static",
"ForkJoinTask",
"<",
"?",
">",
"pollNextLocalTask",
"(",
")",
"{",
"Thread",
"t",
";",
"return",
"(",
"(",
"t",
"=",
"Thread",
".",
"currentThread",
"(",
")",
")",
"instanceof",
"ForkJoinWorkerThread",
")",
"?",
"(",
"(",
"ForkJoinWo... | Unschedules and returns, without executing, the next task queued by the current thread but not
yet executed, if the current thread is operating in a ForkJoinPool. This method is designed
primarily to support extensions, and is unlikely to be useful otherwise.
@return the next task, or {@code null} if none are availabl... | [
"Unschedules",
"and",
"returns",
"without",
"executing",
"the",
"next",
"task",
"queued",
"by",
"the",
"current",
"thread",
"but",
"not",
"yet",
"executed",
"if",
"the",
"current",
"thread",
"is",
"operating",
"in",
"a",
"ForkJoinPool",
".",
"This",
"method",
... | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/ForkJoinTask.java#L498-L503 |
18,995 | Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/ForkJoinTask.java | ForkJoinTask.getThrowableException | private Throwable getThrowableException() {
int h = System.identityHashCode(this);
ExceptionNode e;
final ReentrantLock lock = exceptionTableLock;
lock.lock();
try {
expungeStaleExceptions();
ExceptionNode[] t = exceptionTable;
e = t[h & (t.length - 1)];
while (e != null && e... | java | private Throwable getThrowableException() {
int h = System.identityHashCode(this);
ExceptionNode e;
final ReentrantLock lock = exceptionTableLock;
lock.lock();
try {
expungeStaleExceptions();
ExceptionNode[] t = exceptionTable;
e = t[h & (t.length - 1)];
while (e != null && e... | [
"private",
"Throwable",
"getThrowableException",
"(",
")",
"{",
"int",
"h",
"=",
"System",
".",
"identityHashCode",
"(",
"this",
")",
";",
"ExceptionNode",
"e",
";",
"final",
"ReentrantLock",
"lock",
"=",
"exceptionTableLock",
";",
"lock",
".",
"lock",
"(",
... | Returns a rethrowable exception for this task, if available. To provide accurate stack traces,
if the exception was not thrown by the current thread, we try to create a new exception of the
same type as the one thrown, but with the recorded exception as its cause. If there is no such
constructor, we instead try to use ... | [
"Returns",
"a",
"rethrowable",
"exception",
"for",
"this",
"task",
"if",
"available",
".",
"To",
"provide",
"accurate",
"stack",
"traces",
"if",
"the",
"exception",
"was",
"not",
"thrown",
"by",
"the",
"current",
"thread",
"we",
"try",
"to",
"create",
"a",
... | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/ForkJoinTask.java#L819-L856 |
18,996 | Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/ForkJoinTask.java | ForkJoinTask.setForkJoinTaskTag | public final short setForkJoinTaskTag(short newValue) {
for (int s;;) {
if (U.compareAndSwapInt(this, STATUS, s = status, (s & ~SMASK) | (newValue & SMASK)))
return (short) s;
}
} | java | public final short setForkJoinTaskTag(short newValue) {
for (int s;;) {
if (U.compareAndSwapInt(this, STATUS, s = status, (s & ~SMASK) | (newValue & SMASK)))
return (short) s;
}
} | [
"public",
"final",
"short",
"setForkJoinTaskTag",
"(",
"short",
"newValue",
")",
"{",
"for",
"(",
"int",
"s",
";",
";",
")",
"{",
"if",
"(",
"U",
".",
"compareAndSwapInt",
"(",
"this",
",",
"STATUS",
",",
"s",
"=",
"status",
",",
"(",
"s",
"&",
"~"... | Atomically sets the tag value for this task and returns the old value.
@param newValue the new tag value
@return the previous value of the tag
@since 1.8 | [
"Atomically",
"sets",
"the",
"tag",
"value",
"for",
"this",
"task",
"and",
"returns",
"the",
"old",
"value",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/ForkJoinTask.java#L1209-L1214 |
18,997 | Alluxio/alluxio | core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java | NetworkAddressUtils.getBindAddress | public static InetSocketAddress getBindAddress(ServiceType service, AlluxioConfiguration conf) {
int port = getPort(service, conf);
assertValidPort(port);
return new InetSocketAddress(getBindHost(service, conf), getPort(service, conf));
} | java | public static InetSocketAddress getBindAddress(ServiceType service, AlluxioConfiguration conf) {
int port = getPort(service, conf);
assertValidPort(port);
return new InetSocketAddress(getBindHost(service, conf), getPort(service, conf));
} | [
"public",
"static",
"InetSocketAddress",
"getBindAddress",
"(",
"ServiceType",
"service",
",",
"AlluxioConfiguration",
"conf",
")",
"{",
"int",
"port",
"=",
"getPort",
"(",
"service",
",",
"conf",
")",
";",
"assertValidPort",
"(",
"port",
")",
";",
"return",
"... | Helper method to get the bind hostname for a given service.
@param service the service name
@param conf Alluxio configuration
@return the InetSocketAddress the service will bind to | [
"Helper",
"method",
"to",
"get",
"the",
"bind",
"hostname",
"for",
"a",
"given",
"service",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java#L319-L323 |
18,998 | Alluxio/alluxio | core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java | NetworkAddressUtils.getClientHostName | @Deprecated
public static String getClientHostName(AlluxioConfiguration conf) {
if (conf.isSet(PropertyKey.USER_HOSTNAME)) {
return conf.get(PropertyKey.USER_HOSTNAME);
}
return getLocalHostName((int) conf.getMs(PropertyKey.NETWORK_HOST_RESOLUTION_TIMEOUT_MS));
} | java | @Deprecated
public static String getClientHostName(AlluxioConfiguration conf) {
if (conf.isSet(PropertyKey.USER_HOSTNAME)) {
return conf.get(PropertyKey.USER_HOSTNAME);
}
return getLocalHostName((int) conf.getMs(PropertyKey.NETWORK_HOST_RESOLUTION_TIMEOUT_MS));
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"getClientHostName",
"(",
"AlluxioConfiguration",
"conf",
")",
"{",
"if",
"(",
"conf",
".",
"isSet",
"(",
"PropertyKey",
".",
"USER_HOSTNAME",
")",
")",
"{",
"return",
"conf",
".",
"get",
"(",
"PropertyKey",
"... | Gets the local hostname to be used by the client. If this isn't configured, a
non-loopback local hostname will be looked up.
@param conf Alluxio configuration
@return the local hostname for the client
@deprecated This should not be used anymore as the USER_HOSTNAME key is deprecated | [
"Gets",
"the",
"local",
"hostname",
"to",
"be",
"used",
"by",
"the",
"client",
".",
"If",
"this",
"isn",
"t",
"configured",
"a",
"non",
"-",
"loopback",
"local",
"hostname",
"will",
"be",
"looked",
"up",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java#L356-L362 |
18,999 | Alluxio/alluxio | core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java | NetworkAddressUtils.getLocalNodeName | public static String getLocalNodeName(AlluxioConfiguration conf) {
switch (CommonUtils.PROCESS_TYPE.get()) {
case JOB_MASTER:
if (conf.isSet(PropertyKey.JOB_MASTER_HOSTNAME)) {
return conf.get(PropertyKey.JOB_MASTER_HOSTNAME);
}
break;
case JOB_WORKER:
if (conf.... | java | public static String getLocalNodeName(AlluxioConfiguration conf) {
switch (CommonUtils.PROCESS_TYPE.get()) {
case JOB_MASTER:
if (conf.isSet(PropertyKey.JOB_MASTER_HOSTNAME)) {
return conf.get(PropertyKey.JOB_MASTER_HOSTNAME);
}
break;
case JOB_WORKER:
if (conf.... | [
"public",
"static",
"String",
"getLocalNodeName",
"(",
"AlluxioConfiguration",
"conf",
")",
"{",
"switch",
"(",
"CommonUtils",
".",
"PROCESS_TYPE",
".",
"get",
"(",
")",
")",
"{",
"case",
"JOB_MASTER",
":",
"if",
"(",
"conf",
".",
"isSet",
"(",
"PropertyKey"... | Gets a local node name from configuration if it is available, falling back on localhost lookup.
@param conf Alluxio configuration
@return the local node name | [
"Gets",
"a",
"local",
"node",
"name",
"from",
"configuration",
"if",
"it",
"is",
"available",
"falling",
"back",
"on",
"localhost",
"lookup",
"."
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java#L370-L401 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.