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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
13,600 | OpenTSDB/opentsdb | src/core/TSDB.java | TSDB.preFetchHBaseMeta | public void preFetchHBaseMeta() {
LOG.info("Pre-fetching meta data for all tables");
final long start = System.currentTimeMillis();
final ArrayList<Deferred<Object>> deferreds = new ArrayList<Deferred<Object>>();
deferreds.add(client.prefetchMeta(table));
deferreds.add(client.prefetchMeta(uidtable))... | java | public void preFetchHBaseMeta() {
LOG.info("Pre-fetching meta data for all tables");
final long start = System.currentTimeMillis();
final ArrayList<Deferred<Object>> deferreds = new ArrayList<Deferred<Object>>();
deferreds.add(client.prefetchMeta(table));
deferreds.add(client.prefetchMeta(uidtable))... | [
"public",
"void",
"preFetchHBaseMeta",
"(",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Pre-fetching meta data for all tables\"",
")",
";",
"final",
"long",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"final",
"ArrayList",
"<",
"Deferred",
"<",
... | Blocks while pre-fetching meta data from the data and uid tables
so that performance improves, particularly with a large number of
regions and region servers.
@since 2.2 | [
"Blocks",
"while",
"pre",
"-",
"fetching",
"meta",
"data",
"from",
"the",
"data",
"and",
"uid",
"tables",
"so",
"that",
"performance",
"improves",
"particularly",
"with",
"a",
"large",
"number",
"of",
"regions",
"and",
"region",
"servers",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/TSDB.java#L2080-L2100 |
13,601 | OpenTSDB/opentsdb | src/core/TSDB.java | TSDB.get | final Deferred<ArrayList<KeyValue>> get(final byte[] key) {
return client.get(new GetRequest(table, key, FAMILY));
} | java | final Deferred<ArrayList<KeyValue>> get(final byte[] key) {
return client.get(new GetRequest(table, key, FAMILY));
} | [
"final",
"Deferred",
"<",
"ArrayList",
"<",
"KeyValue",
">",
">",
"get",
"(",
"final",
"byte",
"[",
"]",
"key",
")",
"{",
"return",
"client",
".",
"get",
"(",
"new",
"GetRequest",
"(",
"table",
",",
"key",
",",
"FAMILY",
")",
")",
";",
"}"
] | Gets the entire given row from the data table. | [
"Gets",
"the",
"entire",
"given",
"row",
"from",
"the",
"data",
"table",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/TSDB.java#L2175-L2177 |
13,602 | OpenTSDB/opentsdb | src/core/TSDB.java | TSDB.put | final Deferred<Object> put(final byte[] key,
final byte[] qualifier,
final byte[] value,
long timestamp) {
return client.put(RequestBuilder.buildPutRequest(config, table, key, FAMILY, qualifier, value, timestamp));
} | java | final Deferred<Object> put(final byte[] key,
final byte[] qualifier,
final byte[] value,
long timestamp) {
return client.put(RequestBuilder.buildPutRequest(config, table, key, FAMILY, qualifier, value, timestamp));
} | [
"final",
"Deferred",
"<",
"Object",
">",
"put",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"byte",
"[",
"]",
"qualifier",
",",
"final",
"byte",
"[",
"]",
"value",
",",
"long",
"timestamp",
")",
"{",
"return",
"client",
".",
"put",
"(",
"R... | Puts the given value into the data table. | [
"Puts",
"the",
"given",
"value",
"into",
"the",
"data",
"table",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/TSDB.java#L2180-L2185 |
13,603 | OpenTSDB/opentsdb | src/core/TSDB.java | TSDB.delete | final Deferred<Object> delete(final byte[] key, final byte[][] qualifiers) {
return client.delete(new DeleteRequest(table, key, FAMILY, qualifiers));
} | java | final Deferred<Object> delete(final byte[] key, final byte[][] qualifiers) {
return client.delete(new DeleteRequest(table, key, FAMILY, qualifiers));
} | [
"final",
"Deferred",
"<",
"Object",
">",
"delete",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"byte",
"[",
"]",
"[",
"]",
"qualifiers",
")",
"{",
"return",
"client",
".",
"delete",
"(",
"new",
"DeleteRequest",
"(",
"table",
",",
"key",
",",... | Deletes the given cells from the data table. | [
"Deletes",
"the",
"given",
"cells",
"from",
"the",
"data",
"table",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/TSDB.java#L2188-L2190 |
13,604 | OpenTSDB/opentsdb | src/tools/DumpSeries.java | DumpSeries.date | static String date(final long timestamp) {
if ((timestamp & Const.SECOND_MASK) != 0) {
return new Date(timestamp).toString();
} else {
return new Date(timestamp * 1000).toString();
}
} | java | static String date(final long timestamp) {
if ((timestamp & Const.SECOND_MASK) != 0) {
return new Date(timestamp).toString();
} else {
return new Date(timestamp * 1000).toString();
}
} | [
"static",
"String",
"date",
"(",
"final",
"long",
"timestamp",
")",
"{",
"if",
"(",
"(",
"timestamp",
"&",
"Const",
".",
"SECOND_MASK",
")",
"!=",
"0",
")",
"{",
"return",
"new",
"Date",
"(",
"timestamp",
")",
".",
"toString",
"(",
")",
";",
"}",
"... | Transforms a UNIX timestamp into a human readable date. | [
"Transforms",
"a",
"UNIX",
"timestamp",
"into",
"a",
"human",
"readable",
"date",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/DumpSeries.java#L294-L300 |
13,605 | OpenTSDB/opentsdb | src/core/Internal.java | Internal.getScanners | public static List<Scanner> getScanners(final Query query) {
final List<Scanner> scanners = new ArrayList<Scanner>(
Const.SALT_WIDTH() > 0 ? Const.SALT_BUCKETS() : 1);
if (Const.SALT_WIDTH() > 0) {
for (int i = 0; i < Const.SALT_BUCKETS(); i++) {
scanners.add(((TsdbQuery) query).getScanner... | java | public static List<Scanner> getScanners(final Query query) {
final List<Scanner> scanners = new ArrayList<Scanner>(
Const.SALT_WIDTH() > 0 ? Const.SALT_BUCKETS() : 1);
if (Const.SALT_WIDTH() > 0) {
for (int i = 0; i < Const.SALT_BUCKETS(); i++) {
scanners.add(((TsdbQuery) query).getScanner... | [
"public",
"static",
"List",
"<",
"Scanner",
">",
"getScanners",
"(",
"final",
"Query",
"query",
")",
"{",
"final",
"List",
"<",
"Scanner",
">",
"scanners",
"=",
"new",
"ArrayList",
"<",
"Scanner",
">",
"(",
"Const",
".",
"SALT_WIDTH",
"(",
")",
">",
"0... | Returns a set of scanners, one for each bucket if salted, or one scanner
if salting is disabled.
@see TsdbQuery#getScanner() | [
"Returns",
"a",
"set",
"of",
"scanners",
"one",
"for",
"each",
"bucket",
"if",
"salted",
"or",
"one",
"scanner",
"if",
"salting",
"is",
"disabled",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L96-L107 |
13,606 | OpenTSDB/opentsdb | src/core/Internal.java | Internal.baseTime | public static long baseTime(final TSDB tsdb, final byte[] row) {
return Bytes.getUnsignedInt(row, Const.SALT_WIDTH() + TSDB.metrics_width());
} | java | public static long baseTime(final TSDB tsdb, final byte[] row) {
return Bytes.getUnsignedInt(row, Const.SALT_WIDTH() + TSDB.metrics_width());
} | [
"public",
"static",
"long",
"baseTime",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"byte",
"[",
"]",
"row",
")",
"{",
"return",
"Bytes",
".",
"getUnsignedInt",
"(",
"row",
",",
"Const",
".",
"SALT_WIDTH",
"(",
")",
"+",
"TSDB",
".",
"metrics_width",
"... | Extracts the timestamp from a row key. | [
"Extracts",
"the",
"timestamp",
"from",
"a",
"row",
"key",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L115-L117 |
13,607 | OpenTSDB/opentsdb | src/core/Internal.java | Internal.setBaseTime | public static void setBaseTime(final byte[] row, int base_time) {
Bytes.setInt(row, base_time, Const.SALT_WIDTH() +
TSDB.metrics_width());
} | java | public static void setBaseTime(final byte[] row, int base_time) {
Bytes.setInt(row, base_time, Const.SALT_WIDTH() +
TSDB.metrics_width());
} | [
"public",
"static",
"void",
"setBaseTime",
"(",
"final",
"byte",
"[",
"]",
"row",
",",
"int",
"base_time",
")",
"{",
"Bytes",
".",
"setInt",
"(",
"row",
",",
"base_time",
",",
"Const",
".",
"SALT_WIDTH",
"(",
")",
"+",
"TSDB",
".",
"metrics_width",
"("... | Sets the time in a raw data table row key
@param row The row to modify
@param base_time The base time to store
@since 2.3 | [
"Sets",
"the",
"time",
"in",
"a",
"raw",
"data",
"table",
"row",
"key"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L146-L149 |
13,608 | OpenTSDB/opentsdb | src/core/Internal.java | Internal.parseSingleValue | public static Cell parseSingleValue(final KeyValue column) {
if (column.qualifier().length == 2 || (column.qualifier().length == 4 &&
inMilliseconds(column.qualifier()))) {
final ArrayList<KeyValue> row = new ArrayList<KeyValue>(1);
row.add(column);
final ArrayList<Cell> cells = extractDa... | java | public static Cell parseSingleValue(final KeyValue column) {
if (column.qualifier().length == 2 || (column.qualifier().length == 4 &&
inMilliseconds(column.qualifier()))) {
final ArrayList<KeyValue> row = new ArrayList<KeyValue>(1);
row.add(column);
final ArrayList<Cell> cells = extractDa... | [
"public",
"static",
"Cell",
"parseSingleValue",
"(",
"final",
"KeyValue",
"column",
")",
"{",
"if",
"(",
"column",
".",
"qualifier",
"(",
")",
".",
"length",
"==",
"2",
"||",
"(",
"column",
".",
"qualifier",
"(",
")",
".",
"length",
"==",
"4",
"&&",
... | Extracts a Cell from a single data point, fixing potential errors with
the qualifier flags
@param column The column to parse
@return A Cell if successful, null if the column did not contain a data
point (i.e. it was meta data) or failed to parse
@throws IllegalDataException if the qualifier was not 2 bytes long or
it ... | [
"Extracts",
"a",
"Cell",
"from",
"a",
"single",
"data",
"point",
"fixing",
"potential",
"errors",
"with",
"the",
"qualifier",
"flags"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L185-L198 |
13,609 | OpenTSDB/opentsdb | src/core/Internal.java | Internal.getValueLengthFromQualifier | public static byte getValueLengthFromQualifier(final byte[] qualifier,
final int offset) {
validateQualifier(qualifier, offset);
short length;
if ((qualifier[offset] & Const.MS_BYTE_FLAG) == Const.MS_BYTE_FLAG) {
length = (short) (qualifier[offset + 3] & Internal.LENGTH_MASK);
} else {... | java | public static byte getValueLengthFromQualifier(final byte[] qualifier,
final int offset) {
validateQualifier(qualifier, offset);
short length;
if ((qualifier[offset] & Const.MS_BYTE_FLAG) == Const.MS_BYTE_FLAG) {
length = (short) (qualifier[offset + 3] & Internal.LENGTH_MASK);
} else {... | [
"public",
"static",
"byte",
"getValueLengthFromQualifier",
"(",
"final",
"byte",
"[",
"]",
"qualifier",
",",
"final",
"int",
"offset",
")",
"{",
"validateQualifier",
"(",
"qualifier",
",",
"offset",
")",
";",
"short",
"length",
";",
"if",
"(",
"(",
"qualifie... | Returns the length of the value, in bytes, parsed from the qualifier
@param qualifier The qualifier to parse
@param offset An offset within the byte array
@return The length of the value in bytes, from 1 to 8.
@throws IllegalArgumentException if the qualifier is null or the offset falls
outside of the qualifier array
@... | [
"Returns",
"the",
"length",
"of",
"the",
"value",
"in",
"bytes",
"parsed",
"from",
"the",
"qualifier"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L659-L669 |
13,610 | OpenTSDB/opentsdb | src/core/Internal.java | Internal.getFlagsFromQualifier | public static short getFlagsFromQualifier(final byte[] qualifier,
final int offset) {
validateQualifier(qualifier, offset);
if ((qualifier[offset] & Const.MS_BYTE_FLAG) == Const.MS_BYTE_FLAG) {
return (short) (qualifier[offset + 3] & Internal.FLAGS_MASK);
} else {
return (short) (qualifi... | java | public static short getFlagsFromQualifier(final byte[] qualifier,
final int offset) {
validateQualifier(qualifier, offset);
if ((qualifier[offset] & Const.MS_BYTE_FLAG) == Const.MS_BYTE_FLAG) {
return (short) (qualifier[offset + 3] & Internal.FLAGS_MASK);
} else {
return (short) (qualifi... | [
"public",
"static",
"short",
"getFlagsFromQualifier",
"(",
"final",
"byte",
"[",
"]",
"qualifier",
",",
"final",
"int",
"offset",
")",
"{",
"validateQualifier",
"(",
"qualifier",
",",
"offset",
")",
";",
"if",
"(",
"(",
"qualifier",
"[",
"offset",
"]",
"&"... | Parses the flag bits from the qualifier
@param qualifier The qualifier to parse
@param offset An offset within the byte array
@return A short representing the last 4 bits of the qualifier
@throws IllegalArgumentException if the qualifier is null or the offset falls
outside of the qualifier array
@since 2.0 | [
"Parses",
"the",
"flag",
"bits",
"from",
"the",
"qualifier"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L756-L764 |
13,611 | OpenTSDB/opentsdb | src/core/Internal.java | Internal.isFloat | public static boolean isFloat(final byte[] qualifier, final int offset) {
validateQualifier(qualifier, offset);
if ((qualifier[offset] & Const.MS_BYTE_FLAG) == Const.MS_BYTE_FLAG) {
return (qualifier[offset + 3] & Const.FLAG_FLOAT) == Const.FLAG_FLOAT;
} else {
return (qualifier[offset + 1] & C... | java | public static boolean isFloat(final byte[] qualifier, final int offset) {
validateQualifier(qualifier, offset);
if ((qualifier[offset] & Const.MS_BYTE_FLAG) == Const.MS_BYTE_FLAG) {
return (qualifier[offset + 3] & Const.FLAG_FLOAT) == Const.FLAG_FLOAT;
} else {
return (qualifier[offset + 1] & C... | [
"public",
"static",
"boolean",
"isFloat",
"(",
"final",
"byte",
"[",
"]",
"qualifier",
",",
"final",
"int",
"offset",
")",
"{",
"validateQualifier",
"(",
"qualifier",
",",
"offset",
")",
";",
"if",
"(",
"(",
"qualifier",
"[",
"offset",
"]",
"&",
"Const",... | Parses the qualifier to determine if the data is a floating point value.
4 bytes == Float, 8 bytes == Double
@param qualifier The qualifier to parse
@param offset An offset within the byte array
@return True if the encoded data is a floating point value
@throws IllegalArgumentException if the qualifier is null or the o... | [
"Parses",
"the",
"qualifier",
"to",
"determine",
"if",
"the",
"data",
"is",
"a",
"floating",
"point",
"value",
".",
"4",
"bytes",
"==",
"Float",
"8",
"bytes",
"==",
"Double"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L789-L796 |
13,612 | OpenTSDB/opentsdb | src/core/Internal.java | Internal.extractQualifier | public static byte[] extractQualifier(final byte[] qualifier,
final int offset) {
validateQualifier(qualifier, offset);
if ((qualifier[offset] & Const.MS_BYTE_FLAG) == Const.MS_BYTE_FLAG) {
return new byte[] { qualifier[offset], qualifier[offset + 1],
qualifier[offset + 2], qualifier[offs... | java | public static byte[] extractQualifier(final byte[] qualifier,
final int offset) {
validateQualifier(qualifier, offset);
if ((qualifier[offset] & Const.MS_BYTE_FLAG) == Const.MS_BYTE_FLAG) {
return new byte[] { qualifier[offset], qualifier[offset + 1],
qualifier[offset + 2], qualifier[offs... | [
"public",
"static",
"byte",
"[",
"]",
"extractQualifier",
"(",
"final",
"byte",
"[",
"]",
"qualifier",
",",
"final",
"int",
"offset",
")",
"{",
"validateQualifier",
"(",
"qualifier",
",",
"offset",
")",
";",
"if",
"(",
"(",
"qualifier",
"[",
"offset",
"]... | Extracts the 2 or 4 byte qualifier from a compacted byte array
@param qualifier The qualifier to parse
@param offset An offset within the byte array
@return A byte array with only the requested qualifier
@throws IllegalArgumentException if the qualifier is null or the offset falls
outside of the qualifier array
@since ... | [
"Extracts",
"the",
"2",
"or",
"4",
"byte",
"qualifier",
"from",
"a",
"compacted",
"byte",
"array"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L807-L816 |
13,613 | OpenTSDB/opentsdb | src/core/Internal.java | Internal.buildQualifier | public static byte[] buildQualifier(final long timestamp, final short flags) {
final long base_time;
if ((timestamp & Const.SECOND_MASK) != 0) {
// drop the ms timestamp to seconds to calculate the base timestamp
base_time = ((timestamp / 1000) - ((timestamp / 1000)
% Const.MAX_TIMESPAN))... | java | public static byte[] buildQualifier(final long timestamp, final short flags) {
final long base_time;
if ((timestamp & Const.SECOND_MASK) != 0) {
// drop the ms timestamp to seconds to calculate the base timestamp
base_time = ((timestamp / 1000) - ((timestamp / 1000)
% Const.MAX_TIMESPAN))... | [
"public",
"static",
"byte",
"[",
"]",
"buildQualifier",
"(",
"final",
"long",
"timestamp",
",",
"final",
"short",
"flags",
")",
"{",
"final",
"long",
"base_time",
";",
"if",
"(",
"(",
"timestamp",
"&",
"Const",
".",
"SECOND_MASK",
")",
"!=",
"0",
")",
... | Returns a 2 or 4 byte qualifier based on the timestamp and the flags. If
the timestamp is in seconds, this returns a 2 byte qualifier. If it's in
milliseconds, returns a 4 byte qualifier
@param timestamp A Unix epoch timestamp in seconds or milliseconds
@param flags Flags to set on the qualifier (length &| float)
@... | [
"Returns",
"a",
"2",
"or",
"4",
"byte",
"qualifier",
"based",
"on",
"the",
"timestamp",
"and",
"the",
"flags",
".",
"If",
"the",
"timestamp",
"is",
"in",
"seconds",
"this",
"returns",
"a",
"2",
"byte",
"qualifier",
".",
"If",
"it",
"s",
"in",
"millisec... | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L827-L842 |
13,614 | OpenTSDB/opentsdb | src/core/Internal.java | Internal.validateQualifier | private static void validateQualifier(final byte[] qualifier,
final int offset) {
if (offset < 0 || offset >= qualifier.length - 1) {
throw new IllegalDataException("Offset of [" + offset +
"] is out of bounds for the qualifier length of [" +
qualifier.length + "]");
}
} | java | private static void validateQualifier(final byte[] qualifier,
final int offset) {
if (offset < 0 || offset >= qualifier.length - 1) {
throw new IllegalDataException("Offset of [" + offset +
"] is out of bounds for the qualifier length of [" +
qualifier.length + "]");
}
} | [
"private",
"static",
"void",
"validateQualifier",
"(",
"final",
"byte",
"[",
"]",
"qualifier",
",",
"final",
"int",
"offset",
")",
"{",
"if",
"(",
"offset",
"<",
"0",
"||",
"offset",
">=",
"qualifier",
".",
"length",
"-",
"1",
")",
"{",
"throw",
"new",... | Checks the qualifier to verify that it has data and that the offset is
within bounds
@param qualifier The qualifier to validate
@param offset An optional offset
@throws IllegalDataException if the qualifier is null or the offset falls
outside of the qualifier array
@since 2.0 | [
"Checks",
"the",
"qualifier",
"to",
"verify",
"that",
"it",
"has",
"data",
"and",
"that",
"the",
"offset",
"is",
"within",
"bounds"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L853-L860 |
13,615 | OpenTSDB/opentsdb | src/core/Internal.java | Internal.getMaxUnsignedValueOnBytes | public static long getMaxUnsignedValueOnBytes(final int width) {
if (width < 0 || width > 8) {
throw new IllegalArgumentException("Width must be from 1 to 8 bytes: "
+ width);
}
if (width < 8) {
return ((long) 1 << width * Byte.SIZE) - 1;
} else {
return Long.MAX_VALUE;
... | java | public static long getMaxUnsignedValueOnBytes(final int width) {
if (width < 0 || width > 8) {
throw new IllegalArgumentException("Width must be from 1 to 8 bytes: "
+ width);
}
if (width < 8) {
return ((long) 1 << width * Byte.SIZE) - 1;
} else {
return Long.MAX_VALUE;
... | [
"public",
"static",
"long",
"getMaxUnsignedValueOnBytes",
"(",
"final",
"int",
"width",
")",
"{",
"if",
"(",
"width",
"<",
"0",
"||",
"width",
">",
"8",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Width must be from 1 to 8 bytes: \"",
"+",
"wid... | Simple helper to calculate the max value for any width of long from 0 to 8
bytes.
@param width The width of the byte array we're comparing
@return The maximum unsigned integer value on {@code width} bytes. Note:
If you ask for 8 bytes, it will return the max signed value. This is due
to Java lacking unsigned integers..... | [
"Simple",
"helper",
"to",
"calculate",
"the",
"max",
"value",
"for",
"any",
"width",
"of",
"long",
"from",
"0",
"to",
"8",
"bytes",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L924-L934 |
13,616 | OpenTSDB/opentsdb | src/core/Internal.java | Internal.vleEncodeLong | public static byte[] vleEncodeLong(final long value) {
if (Byte.MIN_VALUE <= value && value <= Byte.MAX_VALUE) {
return new byte[] { (byte) value };
} else if (Short.MIN_VALUE <= value && value <= Short.MAX_VALUE) {
return Bytes.fromShort((short) value);
} else if (Integer.MIN_VALUE <= value && ... | java | public static byte[] vleEncodeLong(final long value) {
if (Byte.MIN_VALUE <= value && value <= Byte.MAX_VALUE) {
return new byte[] { (byte) value };
} else if (Short.MIN_VALUE <= value && value <= Short.MAX_VALUE) {
return Bytes.fromShort((short) value);
} else if (Integer.MIN_VALUE <= value && ... | [
"public",
"static",
"byte",
"[",
"]",
"vleEncodeLong",
"(",
"final",
"long",
"value",
")",
"{",
"if",
"(",
"Byte",
".",
"MIN_VALUE",
"<=",
"value",
"&&",
"value",
"<=",
"Byte",
".",
"MAX_VALUE",
")",
"{",
"return",
"new",
"byte",
"[",
"]",
"{",
"(",
... | Encodes a long on 1, 2, 4 or 8 bytes
@param value The value to encode
@return A byte array containing the encoded value
@since 2.4 | [
"Encodes",
"a",
"long",
"on",
"1",
"2",
"4",
"or",
"8",
"bytes"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L942-L952 |
13,617 | OpenTSDB/opentsdb | src/core/Internal.java | Internal.getTimeStampFromNonDP | public static long getTimeStampFromNonDP(final long base_time, byte[] quantifier) {
long ret = base_time;
if (quantifier.length == 3) {
ret += quantifier[1] << 8 | (quantifier[2] & 0xFF);
ret *= 1000;
} else if (quantifier.length == 5) {
ret *= 1000;
ret += (quantifier[1] & 0xFF) << ... | java | public static long getTimeStampFromNonDP(final long base_time, byte[] quantifier) {
long ret = base_time;
if (quantifier.length == 3) {
ret += quantifier[1] << 8 | (quantifier[2] & 0xFF);
ret *= 1000;
} else if (quantifier.length == 5) {
ret *= 1000;
ret += (quantifier[1] & 0xFF) << ... | [
"public",
"static",
"long",
"getTimeStampFromNonDP",
"(",
"final",
"long",
"base_time",
",",
"byte",
"[",
"]",
"quantifier",
")",
"{",
"long",
"ret",
"=",
"base_time",
";",
"if",
"(",
"quantifier",
".",
"length",
"==",
"3",
")",
"{",
"ret",
"+=",
"quanti... | Get timestamp from base time and quantifier for non datapoints. The returned time
will always be in ms.
@param base_time the base time of the point
@param quantifier the quantifier of the point, it is expected to be either length of
3 or length of 5 (the first byte represents the type of the point)
@return The timestam... | [
"Get",
"timestamp",
"from",
"base",
"time",
"and",
"quantifier",
"for",
"non",
"datapoints",
".",
"The",
"returned",
"time",
"will",
"always",
"be",
"in",
"ms",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L1038-L1053 |
13,618 | OpenTSDB/opentsdb | src/core/Internal.java | Internal.decodeHistogramDataPoint | public static HistogramDataPoint decodeHistogramDataPoint(final TSDB tsdb,
final KeyValue kv) {
long timestamp = Internal.baseTime(kv.key());
return decodeHistogramDataPoint(tsdb, timestamp, kv.qualifier(), kv.value());
} | java | public static HistogramDataPoint decodeHistogramDataPoint(final TSDB tsdb,
final KeyValue kv) {
long timestamp = Internal.baseTime(kv.key());
return decodeHistogramDataPoint(tsdb, timestamp, kv.qualifier(), kv.value());
} | [
"public",
"static",
"HistogramDataPoint",
"decodeHistogramDataPoint",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"KeyValue",
"kv",
")",
"{",
"long",
"timestamp",
"=",
"Internal",
".",
"baseTime",
"(",
"kv",
".",
"key",
"(",
")",
")",
";",
"return",
"decodeH... | Decode the histogram point from the given key value
@param kv the key value that contains a histogram
@return the decoded {@code HistogramDataPoint} | [
"Decode",
"the",
"histogram",
"point",
"from",
"the",
"given",
"key",
"value"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L1060-L1064 |
13,619 | OpenTSDB/opentsdb | src/core/Internal.java | Internal.decodeHistogramDataPoint | public static HistogramDataPoint decodeHistogramDataPoint(final TSDB tsdb,
final long base_time,
final byte[] qualifier,
final byte[] value... | java | public static HistogramDataPoint decodeHistogramDataPoint(final TSDB tsdb,
final long base_time,
final byte[] qualifier,
final byte[] value... | [
"public",
"static",
"HistogramDataPoint",
"decodeHistogramDataPoint",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"long",
"base_time",
",",
"final",
"byte",
"[",
"]",
"qualifier",
",",
"final",
"byte",
"[",
"]",
"value",
")",
"{",
"final",
"HistogramDataPointCod... | Decode the histogram point from the given key and values
@param tsdb The TSDB to use when fetching the decoder manager.
@param base_time the base time of the histogram
@param qualifier the qualifier used to store the histogram
@param value the encoded value of the histogram
@return the decoded {@code HistogramDataPoint... | [
"Decode",
"the",
"histogram",
"point",
"from",
"the",
"given",
"key",
"and",
"values"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L1074-L1083 |
13,620 | OpenTSDB/opentsdb | src/rollup/RollupQuery.java | RollupQuery.isValidQuery | public static boolean isValidQuery(final RollupQuery rollup_query) {
return (rollup_query != null && rollup_query.rollup_interval != null &&
!rollup_query.rollup_interval.isDefaultInterval());
} | java | public static boolean isValidQuery(final RollupQuery rollup_query) {
return (rollup_query != null && rollup_query.rollup_interval != null &&
!rollup_query.rollup_interval.isDefaultInterval());
} | [
"public",
"static",
"boolean",
"isValidQuery",
"(",
"final",
"RollupQuery",
"rollup_query",
")",
"{",
"return",
"(",
"rollup_query",
"!=",
"null",
"&&",
"rollup_query",
".",
"rollup_interval",
"!=",
"null",
"&&",
"!",
"rollup_query",
".",
"rollup_interval",
".",
... | Does it contain a valid rollup interval, mainly says it is not the default
rollup. Default rollup is of same resolution as raw data. So if true,
which means the raw cell column qualifier is encoded with the aggregate
function and the cell is not appended or compacted
@param rollup_query related RollupQuery object, null... | [
"Does",
"it",
"contain",
"a",
"valid",
"rollup",
"interval",
"mainly",
"says",
"it",
"is",
"not",
"the",
"default",
"rollup",
".",
"Default",
"rollup",
"is",
"of",
"same",
"resolution",
"as",
"raw",
"data",
".",
"So",
"if",
"true",
"which",
"means",
"the... | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/rollup/RollupQuery.java#L161-L164 |
13,621 | OpenTSDB/opentsdb | src/meta/TSUIDQuery.java | TSUIDQuery.setQuery | public void setQuery(final String metric, final Map<String, String> tags) {
this.metric = metric;
this.tags = tags;
metric_uid = tsdb.getUID(UniqueIdType.METRIC, metric);
tag_uids = Tags.resolveAll(tsdb, tags);
} | java | public void setQuery(final String metric, final Map<String, String> tags) {
this.metric = metric;
this.tags = tags;
metric_uid = tsdb.getUID(UniqueIdType.METRIC, metric);
tag_uids = Tags.resolveAll(tsdb, tags);
} | [
"public",
"void",
"setQuery",
"(",
"final",
"String",
"metric",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"this",
".",
"metric",
"=",
"metric",
";",
"this",
".",
"tags",
"=",
"tags",
";",
"metric_uid",
"=",
"tsdb",
"."... | Sets the query to perform
@param metric Name of the metric to search for
@param tags A map of tag value pairs or simply an empty map
@throws NoSuchUniqueName if the metric or any of the tag names/values did
not exist
@deprecated Please use one of the constructors instead. Will be removed in 2.3 | [
"Sets",
"the",
"query",
"to",
"perform"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/TSUIDQuery.java#L227-L232 |
13,622 | OpenTSDB/opentsdb | src/meta/TSUIDQuery.java | TSUIDQuery.tsuidFromMetric | public static Deferred<byte[]> tsuidFromMetric(final TSDB tsdb,
final String metric, final Map<String, String> tags) {
if (metric == null || metric.isEmpty()) {
throw new IllegalArgumentException("The metric cannot be empty");
}
if (tags == null || tags.isEmpty()) {
throw new IllegalArgum... | java | public static Deferred<byte[]> tsuidFromMetric(final TSDB tsdb,
final String metric, final Map<String, String> tags) {
if (metric == null || metric.isEmpty()) {
throw new IllegalArgumentException("The metric cannot be empty");
}
if (tags == null || tags.isEmpty()) {
throw new IllegalArgum... | [
"public",
"static",
"Deferred",
"<",
"byte",
"[",
"]",
">",
"tsuidFromMetric",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"String",
"metric",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"if",
"(",
"metric",
"==",
"null",
... | Converts the given metric and tags to a TSUID by resolving the strings to
their UIDs. Note that the resulting TSUID may not exist if the combination
was not written to TSDB
@param tsdb The TSDB to use for storage access
@param metric The metric name to resolve
@param tags The tags to resolve. May not be empty.
@return ... | [
"Converts",
"the",
"given",
"metric",
"and",
"tags",
"to",
"a",
"TSUID",
"by",
"resolving",
"the",
"strings",
"to",
"their",
"UIDs",
".",
"Note",
"that",
"the",
"resulting",
"TSUID",
"may",
"not",
"exist",
"if",
"the",
"combination",
"was",
"not",
"written... | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/TSUIDQuery.java#L475-L523 |
13,623 | OpenTSDB/opentsdb | src/meta/TSUIDQuery.java | TSUIDQuery.resolveNames | private Deferred<IncomingDataPoint> resolveNames(final IncomingDataPoint dp) {
// If the caller gave us a metric and tags, save some time by NOT hitting
// our UID tables or storage.
if (metric != null) {
dp.setMetric(metric);
dp.setTags((HashMap<String, String>)tags);
return Deferred.from... | java | private Deferred<IncomingDataPoint> resolveNames(final IncomingDataPoint dp) {
// If the caller gave us a metric and tags, save some time by NOT hitting
// our UID tables or storage.
if (metric != null) {
dp.setMetric(metric);
dp.setTags((HashMap<String, String>)tags);
return Deferred.from... | [
"private",
"Deferred",
"<",
"IncomingDataPoint",
">",
"resolveNames",
"(",
"final",
"IncomingDataPoint",
"dp",
")",
"{",
"// If the caller gave us a metric and tags, save some time by NOT hitting",
"// our UID tables or storage.",
"if",
"(",
"metric",
"!=",
"null",
")",
"{",
... | Resolve the UIDs to names. If the query was for a metric and tags then we
can just use those.
@param dp The data point to fill in values for
@return A deferred with the data point or an exception if something went
wrong. | [
"Resolve",
"the",
"UIDs",
"to",
"names",
".",
"If",
"the",
"query",
"was",
"for",
"a",
"metric",
"and",
"tags",
"then",
"we",
"can",
"just",
"use",
"those",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/TSUIDQuery.java#L566-L603 |
13,624 | OpenTSDB/opentsdb | src/meta/TSUIDQuery.java | TSUIDQuery.getScanner | private Scanner getScanner() {
final Scanner scanner = tsdb.getClient().newScanner(tsdb.metaTable());
scanner.setStartKey(metric_uid);
// increment the metric UID by one so we can scan all of the rows for the
// given metric
final long stop = UniqueId.uidToLong(metric_uid, TSDB.metrics_width())... | java | private Scanner getScanner() {
final Scanner scanner = tsdb.getClient().newScanner(tsdb.metaTable());
scanner.setStartKey(metric_uid);
// increment the metric UID by one so we can scan all of the rows for the
// given metric
final long stop = UniqueId.uidToLong(metric_uid, TSDB.metrics_width())... | [
"private",
"Scanner",
"getScanner",
"(",
")",
"{",
"final",
"Scanner",
"scanner",
"=",
"tsdb",
".",
"getClient",
"(",
")",
".",
"newScanner",
"(",
"tsdb",
".",
"metaTable",
"(",
")",
")",
";",
"scanner",
".",
"setStartKey",
"(",
"metric_uid",
")",
";",
... | Configures the scanner for a specific metric and optional tags
@return A configured scanner | [
"Configures",
"the",
"scanner",
"for",
"a",
"specific",
"metric",
"and",
"optional",
"tags"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/TSUIDQuery.java#L741-L786 |
13,625 | OpenTSDB/opentsdb | src/rollup/RollupUtils.java | RollupUtils.getRollupBasetime | public static int getRollupBasetime(final long timestamp,
final RollupInterval interval) {
if (timestamp < 0) {
throw new IllegalArgumentException("Not supporting negative "
+ "timestamps at this time: " + timestamp);
}
// avoid instantiating a cal... | java | public static int getRollupBasetime(final long timestamp,
final RollupInterval interval) {
if (timestamp < 0) {
throw new IllegalArgumentException("Not supporting negative "
+ "timestamps at this time: " + timestamp);
}
// avoid instantiating a cal... | [
"public",
"static",
"int",
"getRollupBasetime",
"(",
"final",
"long",
"timestamp",
",",
"final",
"RollupInterval",
"interval",
")",
"{",
"if",
"(",
"timestamp",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Not supporting negative \"",
"+... | Calculates the base time for a rollup interval, the time that can be
stored in the row key.
@param timestamp The data point timestamp to calculate from in seconds
or milliseconds
@param interval The configured interval object to use for calcaulting
the base time with a valid span of 'h', 'd', 'm' or 'y'
@return A base ... | [
"Calculates",
"the",
"base",
"time",
"for",
"a",
"rollup",
"interval",
"the",
"time",
"that",
"can",
"be",
"stored",
"in",
"the",
"row",
"key",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/rollup/RollupUtils.java#L52-L104 |
13,626 | OpenTSDB/opentsdb | src/rollup/RollupUtils.java | RollupUtils.getTimestampFromRollupQualifier | public static long getTimestampFromRollupQualifier(final byte[] qualifier,
final long base_time,
final RollupInterval interval,
final int offset) {
return (base_time * 1000) +
getOffsetFromRollupQualifier(qualifier, offset, interval);
} | java | public static long getTimestampFromRollupQualifier(final byte[] qualifier,
final long base_time,
final RollupInterval interval,
final int offset) {
return (base_time * 1000) +
getOffsetFromRollupQualifier(qualifier, offset, interval);
} | [
"public",
"static",
"long",
"getTimestampFromRollupQualifier",
"(",
"final",
"byte",
"[",
"]",
"qualifier",
",",
"final",
"long",
"base_time",
",",
"final",
"RollupInterval",
"interval",
",",
"final",
"int",
"offset",
")",
"{",
"return",
"(",
"base_time",
"*",
... | Returns the absolute timestamp of a data point qualifier in milliseconds
@param qualifier The qualifier to parse
@param base_time The base time, in seconds, from the row key
@param interval The RollupInterval object with data about the interval
@param offset An offset within the byte array
@return The absolute timestam... | [
"Returns",
"the",
"absolute",
"timestamp",
"of",
"a",
"data",
"point",
"qualifier",
"in",
"milliseconds"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/rollup/RollupUtils.java#L178-L184 |
13,627 | OpenTSDB/opentsdb | src/query/QueryLimitOverride.java | QueryLimitOverride.loadFromFile | private void loadFromFile() {
// load from disk if the caller gave us a file
if (file_location != null && !file_location.isEmpty()) {
final File file = new File(file_location);
if (!file.exists()) {
LOG.warn("Query override file " + file_location + " does not exist");
return;
}... | java | private void loadFromFile() {
// load from disk if the caller gave us a file
if (file_location != null && !file_location.isEmpty()) {
final File file = new File(file_location);
if (!file.exists()) {
LOG.warn("Query override file " + file_location + " does not exist");
return;
}... | [
"private",
"void",
"loadFromFile",
"(",
")",
"{",
"// load from disk if the caller gave us a file",
"if",
"(",
"file_location",
"!=",
"null",
"&&",
"!",
"file_location",
".",
"isEmpty",
"(",
")",
")",
"{",
"final",
"File",
"file",
"=",
"new",
"File",
"(",
"fil... | Attempts to load the file from disk | [
"Attempts",
"to",
"load",
"the",
"file",
"from",
"disk"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/QueryLimitOverride.java#L196-L243 |
13,628 | OpenTSDB/opentsdb | src/query/expression/ExpressionReader.java | ExpressionReader.skipWhitespaces | public void skipWhitespaces() {
for (int i = mark; i < chars.length; i++) {
if (Character.isWhitespace(chars[i])) {
mark++;
} else {
break;
}
}
} | java | public void skipWhitespaces() {
for (int i = mark; i < chars.length; i++) {
if (Character.isWhitespace(chars[i])) {
mark++;
} else {
break;
}
}
} | [
"public",
"void",
"skipWhitespaces",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"mark",
";",
"i",
"<",
"chars",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"Character",
".",
"isWhitespace",
"(",
"chars",
"[",
"i",
"]",
")",
")",
"{",
"... | Increments the mark over white spaces | [
"Increments",
"the",
"mark",
"over",
"white",
"spaces"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/expression/ExpressionReader.java#L116-L124 |
13,629 | OpenTSDB/opentsdb | src/stats/StatsCollector.java | StatsCollector.setGlobalTags | public static final void setGlobalTags(final Config config) {
if (config == null) {
throw new IllegalArgumentException("Configuration cannot be null.");
}
if (config.getBoolean("tsd.core.stats_with_port")) {
global_tags = new HashMap<String, String>(1);
global_tags.put("port", config.... | java | public static final void setGlobalTags(final Config config) {
if (config == null) {
throw new IllegalArgumentException("Configuration cannot be null.");
}
if (config.getBoolean("tsd.core.stats_with_port")) {
global_tags = new HashMap<String, String>(1);
global_tags.put("port", config.... | [
"public",
"static",
"final",
"void",
"setGlobalTags",
"(",
"final",
"Config",
"config",
")",
"{",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Configuration cannot be null.\"",
")",
";",
"}",
"if",
"(",
"conf... | Parses the configuration to determine if any extra tags should be included
with every stat emitted.
@param config The config object to parse
@throws IllegalArgumentException if the config is null. Other exceptions
may be thrown if the config values are unparseable. | [
"Parses",
"the",
"configuration",
"to",
"determine",
"if",
"any",
"extra",
"tags",
"should",
"be",
"included",
"with",
"every",
"stat",
"emitted",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/stats/StatsCollector.java#L261-L270 |
13,630 | OpenTSDB/opentsdb | src/core/TsdbQuery.java | TsdbQuery.setStartTime | @Override
public void setStartTime(final long timestamp) {
if (timestamp < 0 || ((timestamp & Const.SECOND_MASK) != 0 &&
timestamp > 9999999999999L)) {
throw new IllegalArgumentException("Invalid timestamp: " + timestamp);
} else if (end_time != UNSET && timestamp >= getEndTime()) {
throw... | java | @Override
public void setStartTime(final long timestamp) {
if (timestamp < 0 || ((timestamp & Const.SECOND_MASK) != 0 &&
timestamp > 9999999999999L)) {
throw new IllegalArgumentException("Invalid timestamp: " + timestamp);
} else if (end_time != UNSET && timestamp >= getEndTime()) {
throw... | [
"@",
"Override",
"public",
"void",
"setStartTime",
"(",
"final",
"long",
"timestamp",
")",
"{",
"if",
"(",
"timestamp",
"<",
"0",
"||",
"(",
"(",
"timestamp",
"&",
"Const",
".",
"SECOND_MASK",
")",
"!=",
"0",
"&&",
"timestamp",
">",
"9999999999999L",
")"... | Sets the start time for the query
@param timestamp Unix epoch timestamp in seconds or milliseconds
@throws IllegalArgumentException if the timestamp is invalid or greater
than the end time (if set) | [
"Sets",
"the",
"start",
"time",
"for",
"the",
"query"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/TsdbQuery.java#L266-L276 |
13,631 | OpenTSDB/opentsdb | src/core/TsdbQuery.java | TsdbQuery.downsample | @Override
public void downsample(final long interval, final Aggregator downsampler) {
if (downsampler == Aggregators.NONE) {
throw new IllegalArgumentException("cannot use the NONE "
+ "aggregator for downsampling");
}
downsample(interval, downsampler, FillPolicy.NONE);
} | java | @Override
public void downsample(final long interval, final Aggregator downsampler) {
if (downsampler == Aggregators.NONE) {
throw new IllegalArgumentException("cannot use the NONE "
+ "aggregator for downsampling");
}
downsample(interval, downsampler, FillPolicy.NONE);
} | [
"@",
"Override",
"public",
"void",
"downsample",
"(",
"final",
"long",
"interval",
",",
"final",
"Aggregator",
"downsampler",
")",
"{",
"if",
"(",
"downsampler",
"==",
"Aggregators",
".",
"NONE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"ca... | Sets an optional downsampling function with interpolation on this query.
@param interval The interval, in milliseconds to rollup data points
@param downsampler An aggregation function to use when rolling up data points
@throws NullPointerException if the aggregation function is null
@throws IllegalArgumentException if ... | [
"Sets",
"an",
"optional",
"downsampling",
"function",
"with",
"interpolation",
"on",
"this",
"query",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/TsdbQuery.java#L599-L606 |
13,632 | OpenTSDB/opentsdb | src/core/TsdbQuery.java | TsdbQuery.tableToBeScanned | private byte[] tableToBeScanned() {
final byte[] tableName;
if (RollupQuery.isValidQuery(rollup_query)) {
if (pre_aggregate) {
tableName= rollup_query.getRollupInterval().getGroupbyTable();
}
else {
tableName= rollup_query.getRollupInterval().getTemporalTable();
}
... | java | private byte[] tableToBeScanned() {
final byte[] tableName;
if (RollupQuery.isValidQuery(rollup_query)) {
if (pre_aggregate) {
tableName= rollup_query.getRollupInterval().getGroupbyTable();
}
else {
tableName= rollup_query.getRollupInterval().getTemporalTable();
}
... | [
"private",
"byte",
"[",
"]",
"tableToBeScanned",
"(",
")",
"{",
"final",
"byte",
"[",
"]",
"tableName",
";",
"if",
"(",
"RollupQuery",
".",
"isValidQuery",
"(",
"rollup_query",
")",
")",
"{",
"if",
"(",
"pre_aggregate",
")",
"{",
"tableName",
"=",
"rollu... | Identify the table to be scanned based on the roll up and pre-aggregate
query parameters
@return table name as byte array
@since 2.4 | [
"Identify",
"the",
"table",
"to",
"be",
"scanned",
"based",
"on",
"the",
"roll",
"up",
"and",
"pre",
"-",
"aggregate",
"query",
"parameters"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/TsdbQuery.java#L1483-L1502 |
13,633 | OpenTSDB/opentsdb | src/core/TsdbQuery.java | TsdbQuery.getScanStartTimeSeconds | private long getScanStartTimeSeconds() {
// Begin with the raw query start time.
long start = getStartTime();
// Convert to seconds if we have a query in ms.
if ((start & Const.SECOND_MASK) != 0L) {
start /= 1000L;
}
// if we have a rollup query, we have different row key start times... | java | private long getScanStartTimeSeconds() {
// Begin with the raw query start time.
long start = getStartTime();
// Convert to seconds if we have a query in ms.
if ((start & Const.SECOND_MASK) != 0L) {
start /= 1000L;
}
// if we have a rollup query, we have different row key start times... | [
"private",
"long",
"getScanStartTimeSeconds",
"(",
")",
"{",
"// Begin with the raw query start time.",
"long",
"start",
"=",
"getStartTime",
"(",
")",
";",
"// Convert to seconds if we have a query in ms.",
"if",
"(",
"(",
"start",
"&",
"Const",
".",
"SECOND_MASK",
")"... | Returns the UNIX timestamp from which we must start scanning. | [
"Returns",
"the",
"UNIX",
"timestamp",
"from",
"which",
"we",
"must",
"start",
"scanning",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/TsdbQuery.java#L1505-L1544 |
13,634 | OpenTSDB/opentsdb | src/core/TsdbQuery.java | TsdbQuery.getScanEndTimeSeconds | private long getScanEndTimeSeconds() {
// Begin with the raw query end time.
long end = getEndTime();
// Convert to seconds if we have a query in ms.
if ((end & Const.SECOND_MASK) != 0L) {
end /= 1000L;
if (end - (end * 1000) < 1) {
// handle an edge case where a user may request a ... | java | private long getScanEndTimeSeconds() {
// Begin with the raw query end time.
long end = getEndTime();
// Convert to seconds if we have a query in ms.
if ((end & Const.SECOND_MASK) != 0L) {
end /= 1000L;
if (end - (end * 1000) < 1) {
// handle an edge case where a user may request a ... | [
"private",
"long",
"getScanEndTimeSeconds",
"(",
")",
"{",
"// Begin with the raw query end time.",
"long",
"end",
"=",
"getEndTime",
"(",
")",
";",
"// Convert to seconds if we have a query in ms.",
"if",
"(",
"(",
"end",
"&",
"Const",
".",
"SECOND_MASK",
")",
"!=",
... | Returns the UNIX timestamp at which we must stop scanning. | [
"Returns",
"the",
"UNIX",
"timestamp",
"at",
"which",
"we",
"must",
"stop",
"scanning",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/TsdbQuery.java#L1547-L1606 |
13,635 | OpenTSDB/opentsdb | src/core/TsdbQuery.java | TsdbQuery.createAndSetFilter | private void createAndSetFilter(final Scanner scanner) {
QueryUtil.setDataTableScanFilter(scanner, group_bys, row_key_literals,
explicit_tags, enable_fuzzy_filter,
(end_time == UNSET
? -1 // Will scan until the end (0xFFF...).
: (int) getScanEndTimeSeconds()));
} | java | private void createAndSetFilter(final Scanner scanner) {
QueryUtil.setDataTableScanFilter(scanner, group_bys, row_key_literals,
explicit_tags, enable_fuzzy_filter,
(end_time == UNSET
? -1 // Will scan until the end (0xFFF...).
: (int) getScanEndTimeSeconds()));
} | [
"private",
"void",
"createAndSetFilter",
"(",
"final",
"Scanner",
"scanner",
")",
"{",
"QueryUtil",
".",
"setDataTableScanFilter",
"(",
"scanner",
",",
"group_bys",
",",
"row_key_literals",
",",
"explicit_tags",
",",
"enable_fuzzy_filter",
",",
"(",
"end_time",
"=="... | Sets the server-side regexp filter on the scanner.
In order to find the rows with the relevant tags, we use a
server-side filter that matches a regular expression on the row key.
@param scanner The scanner on which to add the filter. | [
"Sets",
"the",
"server",
"-",
"side",
"regexp",
"filter",
"on",
"the",
"scanner",
".",
"In",
"order",
"to",
"find",
"the",
"rows",
"with",
"the",
"relevant",
"tags",
"we",
"use",
"a",
"server",
"-",
"side",
"filter",
"that",
"matches",
"a",
"regular",
... | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/TsdbQuery.java#L1614-L1620 |
13,636 | OpenTSDB/opentsdb | src/core/TsdbQuery.java | TsdbQuery.transformDownSamplerToRollupQuery | public void transformDownSamplerToRollupQuery(final Aggregator group_by,
final String str_interval) {
if (downsampler != null && downsampler.getInterval() > 0) {
if (tsdb.getRollupConfig() != null) {
try {
best_match_rollups = tsdb.getRollupConfig().
getRollupInter... | java | public void transformDownSamplerToRollupQuery(final Aggregator group_by,
final String str_interval) {
if (downsampler != null && downsampler.getInterval() > 0) {
if (tsdb.getRollupConfig() != null) {
try {
best_match_rollups = tsdb.getRollupConfig().
getRollupInter... | [
"public",
"void",
"transformDownSamplerToRollupQuery",
"(",
"final",
"Aggregator",
"group_by",
",",
"final",
"String",
"str_interval",
")",
"{",
"if",
"(",
"downsampler",
"!=",
"null",
"&&",
"downsampler",
".",
"getInterval",
"(",
")",
">",
"0",
")",
"{",
"if"... | Transform downsampler properties to rollup properties, if the rollup
is enabled at configuration level and down sampler is set.
It falls back to raw data and down sampling if there is no
RollupInterval is configured against this down sample interval
@param group_by The group by aggregator.
@param str_interval String re... | [
"Transform",
"downsampler",
"properties",
"to",
"rollup",
"properties",
"if",
"the",
"rollup",
"is",
"enabled",
"at",
"configuration",
"level",
"and",
"down",
"sampler",
"is",
"set",
".",
"It",
"falls",
"back",
"to",
"raw",
"data",
"and",
"down",
"sampling",
... | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/TsdbQuery.java#L1664-L1699 |
13,637 | OpenTSDB/opentsdb | src/core/TsdbQuery.java | TsdbQuery.transformRollupQueryToDownSampler | private void transformRollupQueryToDownSampler() {
if (rollup_query != null) {
// TODO - clean up and handle fill
downsampler = new DownsamplingSpecification(
rollup_query.getRollupInterval().getIntervalSeconds() * 1000,
rollup_query.getRollupAgg(),
(downsampler != n... | java | private void transformRollupQueryToDownSampler() {
if (rollup_query != null) {
// TODO - clean up and handle fill
downsampler = new DownsamplingSpecification(
rollup_query.getRollupInterval().getIntervalSeconds() * 1000,
rollup_query.getRollupAgg(),
(downsampler != n... | [
"private",
"void",
"transformRollupQueryToDownSampler",
"(",
")",
"{",
"if",
"(",
"rollup_query",
"!=",
"null",
")",
"{",
"// TODO - clean up and handle fill",
"downsampler",
"=",
"new",
"DownsamplingSpecification",
"(",
"rollup_query",
".",
"getRollupInterval",
"(",
")... | Transform rollup query to downsampler
It is mainly useful when it scan on raw data on fallback.
@since 2.4 | [
"Transform",
"rollup",
"query",
"to",
"downsampler",
"It",
"is",
"mainly",
"useful",
"when",
"it",
"scan",
"on",
"raw",
"data",
"on",
"fallback",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/TsdbQuery.java#L1706-L1717 |
13,638 | OpenTSDB/opentsdb | src/tree/Tree.java | Tree.copyChanges | public boolean copyChanges(final Tree tree, final boolean overwrite) {
if (tree == null) {
throw new IllegalArgumentException("Cannot copy a null tree");
}
if (tree_id != tree.tree_id) {
throw new IllegalArgumentException("Tree IDs do not match");
}
if (overwrite || tree.changed.get... | java | public boolean copyChanges(final Tree tree, final boolean overwrite) {
if (tree == null) {
throw new IllegalArgumentException("Cannot copy a null tree");
}
if (tree_id != tree.tree_id) {
throw new IllegalArgumentException("Tree IDs do not match");
}
if (overwrite || tree.changed.get... | [
"public",
"boolean",
"copyChanges",
"(",
"final",
"Tree",
"tree",
",",
"final",
"boolean",
"overwrite",
")",
"{",
"if",
"(",
"tree",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot copy a null tree\"",
")",
";",
"}",
"if",
... | Copies changes from the incoming tree into the local tree, overriding if
called to. Only parses user mutable fields, excluding rules.
@param tree The tree to copy from
@param overwrite Whether or not to copy all values from the incoming tree
@return True if there were changes, false if not
@throws IllegalArgumentExcept... | [
"Copies",
"changes",
"from",
"the",
"incoming",
"tree",
"into",
"the",
"local",
"tree",
"overriding",
"if",
"called",
"to",
".",
"Only",
"parses",
"user",
"mutable",
"fields",
"excluding",
"rules",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/Tree.java#L202-L240 |
13,639 | OpenTSDB/opentsdb | src/tree/Tree.java | Tree.addRule | public void addRule(final TreeRule rule) {
if (rule == null) {
throw new IllegalArgumentException("Null rules are not accepted");
}
if (rules == null) {
rules = new TreeMap<Integer, TreeMap<Integer, TreeRule>>();
}
TreeMap<Integer, TreeRule> level = rules.get(rule.getLevel());
i... | java | public void addRule(final TreeRule rule) {
if (rule == null) {
throw new IllegalArgumentException("Null rules are not accepted");
}
if (rules == null) {
rules = new TreeMap<Integer, TreeMap<Integer, TreeRule>>();
}
TreeMap<Integer, TreeRule> level = rules.get(rule.getLevel());
i... | [
"public",
"void",
"addRule",
"(",
"final",
"TreeRule",
"rule",
")",
"{",
"if",
"(",
"rule",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null rules are not accepted\"",
")",
";",
"}",
"if",
"(",
"rules",
"==",
"null",
")",
"{... | Adds the given rule to the tree, replacing anything in the designated spot
@param rule The rule to add
@throws IllegalArgumentException if the incoming rule was invalid | [
"Adds",
"the",
"given",
"rule",
"to",
"the",
"tree",
"replacing",
"anything",
"in",
"the",
"designated",
"spot"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/Tree.java#L247-L265 |
13,640 | OpenTSDB/opentsdb | src/tree/Tree.java | Tree.addCollision | public void addCollision(final String tsuid, final String existing_tsuid) {
if (tsuid == null || tsuid.isEmpty()) {
throw new IllegalArgumentException("Empty or null collisions not allowed");
}
if (collisions == null) {
collisions = new HashMap<String, String>();
}
if (!collisions.contai... | java | public void addCollision(final String tsuid, final String existing_tsuid) {
if (tsuid == null || tsuid.isEmpty()) {
throw new IllegalArgumentException("Empty or null collisions not allowed");
}
if (collisions == null) {
collisions = new HashMap<String, String>();
}
if (!collisions.contai... | [
"public",
"void",
"addCollision",
"(",
"final",
"String",
"tsuid",
",",
"final",
"String",
"existing_tsuid",
")",
"{",
"if",
"(",
"tsuid",
"==",
"null",
"||",
"tsuid",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"... | Adds a TSUID to the collision local list, must then be synced with storage
@param tsuid TSUID to add to the set
@throws IllegalArgumentException if the tsuid was invalid | [
"Adds",
"a",
"TSUID",
"to",
"the",
"collision",
"local",
"list",
"must",
"then",
"be",
"synced",
"with",
"storage"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/Tree.java#L272-L283 |
13,641 | OpenTSDB/opentsdb | src/tree/Tree.java | Tree.addNotMatched | public void addNotMatched(final String tsuid, final String message) {
if (tsuid == null || tsuid.isEmpty()) {
throw new IllegalArgumentException("Empty or null non matches not allowed");
}
if (not_matched == null) {
not_matched = new HashMap<String, String>();
}
if (!not_matched.contains... | java | public void addNotMatched(final String tsuid, final String message) {
if (tsuid == null || tsuid.isEmpty()) {
throw new IllegalArgumentException("Empty or null non matches not allowed");
}
if (not_matched == null) {
not_matched = new HashMap<String, String>();
}
if (!not_matched.contains... | [
"public",
"void",
"addNotMatched",
"(",
"final",
"String",
"tsuid",
",",
"final",
"String",
"message",
")",
"{",
"if",
"(",
"tsuid",
"==",
"null",
"||",
"tsuid",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Empty ... | Adds a TSUID to the not-matched local list when strict_matching is enabled.
Must be synced with storage.
@param tsuid TSUID to add to the set
@throws IllegalArgumentException if the tsuid was invalid | [
"Adds",
"a",
"TSUID",
"to",
"the",
"not",
"-",
"matched",
"local",
"list",
"when",
"strict_matching",
"is",
"enabled",
".",
"Must",
"be",
"synced",
"with",
"storage",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/Tree.java#L291-L302 |
13,642 | OpenTSDB/opentsdb | src/tree/Tree.java | Tree.storeTree | public Deferred<Boolean> storeTree(final TSDB tsdb, final boolean overwrite) {
if (tree_id < 1 || tree_id > 65535) {
throw new IllegalArgumentException("Invalid Tree ID");
}
// if there aren't any changes, save time and bandwidth by not writing to
// storage
boolean has_changes = false;
... | java | public Deferred<Boolean> storeTree(final TSDB tsdb, final boolean overwrite) {
if (tree_id < 1 || tree_id > 65535) {
throw new IllegalArgumentException("Invalid Tree ID");
}
// if there aren't any changes, save time and bandwidth by not writing to
// storage
boolean has_changes = false;
... | [
"public",
"Deferred",
"<",
"Boolean",
">",
"storeTree",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"boolean",
"overwrite",
")",
"{",
"if",
"(",
"tree_id",
"<",
"1",
"||",
"tree_id",
">",
"65535",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
... | Attempts to store the tree definition via a CompareAndSet call.
@param tsdb The TSDB to use for access
@param overwrite Whether or not tree data should be overwritten
@return True if the write was successful, false if an error occurred
@throws IllegalArgumentException if the tree ID is missing or invalid
@throws HBaseE... | [
"Attempts",
"to",
"store",
"the",
"tree",
"definition",
"via",
"a",
"CompareAndSet",
"call",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/Tree.java#L312-L375 |
13,643 | OpenTSDB/opentsdb | src/tree/Tree.java | Tree.getRule | public TreeRule getRule(final int level, final int order) {
if (rules == null || rules.isEmpty()) {
return null;
}
TreeMap<Integer, TreeRule> rule_level = rules.get(level);
if (rule_level == null || rule_level.isEmpty()) {
return null;
}
return rule_level.get(order);
} | java | public TreeRule getRule(final int level, final int order) {
if (rules == null || rules.isEmpty()) {
return null;
}
TreeMap<Integer, TreeRule> rule_level = rules.get(level);
if (rule_level == null || rule_level.isEmpty()) {
return null;
}
return rule_level.get(order);
} | [
"public",
"TreeRule",
"getRule",
"(",
"final",
"int",
"level",
",",
"final",
"int",
"order",
")",
"{",
"if",
"(",
"rules",
"==",
"null",
"||",
"rules",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"TreeMap",
"<",
"Integer",
",",
... | Retrieves a single rule from the rule set given a level and order
@param level The level where the rule resides
@param order The order in the level where the rule resides
@return The rule if found, null if not found | [
"Retrieves",
"a",
"single",
"rule",
"from",
"the",
"rule",
"set",
"given",
"a",
"level",
"and",
"order"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/Tree.java#L383-L394 |
13,644 | OpenTSDB/opentsdb | src/tree/Tree.java | Tree.fetchTree | public static Deferred<Tree> fetchTree(final TSDB tsdb, final int tree_id) {
if (tree_id < 1 || tree_id > 65535) {
throw new IllegalArgumentException("Invalid Tree ID");
}
// fetch the whole row
final GetRequest get = new GetRequest(tsdb.treeTable(), idToBytes(tree_id));
get.family(TREE_FAMIL... | java | public static Deferred<Tree> fetchTree(final TSDB tsdb, final int tree_id) {
if (tree_id < 1 || tree_id > 65535) {
throw new IllegalArgumentException("Invalid Tree ID");
}
// fetch the whole row
final GetRequest get = new GetRequest(tsdb.treeTable(), idToBytes(tree_id));
get.family(TREE_FAMIL... | [
"public",
"static",
"Deferred",
"<",
"Tree",
">",
"fetchTree",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"int",
"tree_id",
")",
"{",
"if",
"(",
"tree_id",
"<",
"1",
"||",
"tree_id",
">",
"65535",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(... | Attempts to fetch the given tree from storage, loading the rule set at
the same time.
@param tsdb The TSDB to use for access
@param tree_id The Tree to fetch
@return A tree object if found, null if the tree did not exist
@throws IllegalArgumentException if the tree ID was invalid
@throws HBaseException if a storage exc... | [
"Attempts",
"to",
"fetch",
"the",
"given",
"tree",
"from",
"storage",
"loading",
"the",
"rule",
"set",
"at",
"the",
"same",
"time",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/Tree.java#L470-L527 |
13,645 | OpenTSDB/opentsdb | src/tree/Tree.java | Tree.fetchAllTrees | public static Deferred<List<Tree>> fetchAllTrees(final TSDB tsdb) {
final Deferred<List<Tree>> result = new Deferred<List<Tree>>();
/**
* Scanner callback that recursively calls itself to load the next set of
* rows from storage. When the scanner returns a null, the callback will
* retu... | java | public static Deferred<List<Tree>> fetchAllTrees(final TSDB tsdb) {
final Deferred<List<Tree>> result = new Deferred<List<Tree>>();
/**
* Scanner callback that recursively calls itself to load the next set of
* rows from storage. When the scanner returns a null, the callback will
* retu... | [
"public",
"static",
"Deferred",
"<",
"List",
"<",
"Tree",
">",
">",
"fetchAllTrees",
"(",
"final",
"TSDB",
"tsdb",
")",
"{",
"final",
"Deferred",
"<",
"List",
"<",
"Tree",
">",
">",
"result",
"=",
"new",
"Deferred",
"<",
"List",
"<",
"Tree",
">",
">"... | Attempts to retrieve all trees from the UID table, including their rules.
If no trees were found, the result will be an empty list
@param tsdb The TSDB to use for storage
@return A list of tree objects. May be empty if none were found | [
"Attempts",
"to",
"retrieve",
"all",
"trees",
"from",
"the",
"UID",
"table",
"including",
"their",
"rules",
".",
"If",
"no",
"trees",
"were",
"found",
"the",
"result",
"will",
"be",
"an",
"empty",
"list"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/Tree.java#L535-L617 |
13,646 | OpenTSDB/opentsdb | src/tree/Tree.java | Tree.toStorageJson | private byte[] toStorageJson() {
// TODO - precalc how much memory to grab
final ByteArrayOutputStream output = new ByteArrayOutputStream();
try {
final JsonGenerator json = JSON.getFactory().createGenerator(output);
json.writeStartObject();
// we only need to write a small a... | java | private byte[] toStorageJson() {
// TODO - precalc how much memory to grab
final ByteArrayOutputStream output = new ByteArrayOutputStream();
try {
final JsonGenerator json = JSON.getFactory().createGenerator(output);
json.writeStartObject();
// we only need to write a small a... | [
"private",
"byte",
"[",
"]",
"toStorageJson",
"(",
")",
"{",
"// TODO - precalc how much memory to grab",
"final",
"ByteArrayOutputStream",
"output",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"try",
"{",
"final",
"JsonGenerator",
"json",
"=",
"JSON",
".",
... | Converts the object to a JSON byte array, necessary for CAS calls and to
keep redundant data down
@return A byte array with the serialized tree | [
"Converts",
"the",
"object",
"to",
"a",
"JSON",
"byte",
"array",
"necessary",
"for",
"CAS",
"calls",
"and",
"to",
"keep",
"redundant",
"data",
"down"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/Tree.java#L1013-L1038 |
13,647 | OpenTSDB/opentsdb | src/tools/UidManager.java | UidManager.printResult | private static boolean printResult(final ArrayList<KeyValue> row,
final byte[] family,
final boolean formard) {
if (null == row || row.isEmpty()) {
return false;
}
final byte[] key = row.get(0).key();
String name = formard ?... | java | private static boolean printResult(final ArrayList<KeyValue> row,
final byte[] family,
final boolean formard) {
if (null == row || row.isEmpty()) {
return false;
}
final byte[] key = row.get(0).key();
String name = formard ?... | [
"private",
"static",
"boolean",
"printResult",
"(",
"final",
"ArrayList",
"<",
"KeyValue",
">",
"row",
",",
"final",
"byte",
"[",
"]",
"family",
",",
"final",
"boolean",
"formard",
")",
"{",
"if",
"(",
"null",
"==",
"row",
"||",
"row",
".",
"isEmpty",
... | Helper to print the cells in a given family for a given row, if any.
@param row The row to print.
@param family Only cells in this family (if any) will be printed.
@param formard If true, this row contains a forward mapping (name to ID).
Otherwise the row is assumed to contain a reverse mapping (ID to name).
@return {@... | [
"Helper",
"to",
"print",
"the",
"cells",
"in",
"a",
"given",
"family",
"for",
"a",
"given",
"row",
"if",
"any",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/UidManager.java#L330-L353 |
13,648 | OpenTSDB/opentsdb | src/tools/UidManager.java | UidManager.findAndPrintRow | private static int findAndPrintRow(final HBaseClient client,
final byte[] table,
final byte[] key,
final byte[] family,
boolean formard) {
final GetRequest get = new Ge... | java | private static int findAndPrintRow(final HBaseClient client,
final byte[] table,
final byte[] key,
final byte[] family,
boolean formard) {
final GetRequest get = new Ge... | [
"private",
"static",
"int",
"findAndPrintRow",
"(",
"final",
"HBaseClient",
"client",
",",
"final",
"byte",
"[",
"]",
"table",
",",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"byte",
"[",
"]",
"family",
",",
"boolean",
"formard",
")",
"{",
"final",
... | Gets a given row in HBase and prints it on standard output.
@param client The HBase client to use.
@param table The name of the HBase table to use.
@param key The row key to attempt to get from HBase.
@param family The family in which we're interested.
@return 0 if at least one cell was found and printed, 1 otherwise. | [
"Gets",
"a",
"given",
"row",
"in",
"HBase",
"and",
"prints",
"it",
"on",
"standard",
"output",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/UidManager.java#L862-L880 |
13,649 | OpenTSDB/opentsdb | src/tools/UidManager.java | UidManager.extactLookupId | private static int extactLookupId(final HBaseClient client,
final byte[] table,
final short idwidth,
final String kind,
final byte[] id) {
final UniqueId uid = new UniqueId... | java | private static int extactLookupId(final HBaseClient client,
final byte[] table,
final short idwidth,
final String kind,
final byte[] id) {
final UniqueId uid = new UniqueId... | [
"private",
"static",
"int",
"extactLookupId",
"(",
"final",
"HBaseClient",
"client",
",",
"final",
"byte",
"[",
"]",
"table",
",",
"final",
"short",
"idwidth",
",",
"final",
"String",
"kind",
",",
"final",
"byte",
"[",
"]",
"id",
")",
"{",
"final",
"Uniq... | Looks up an ID for a given kind, and prints it if found.
@param client The HBase client to use.
@param table The name of the HBase table to use.
@param idwidth Number of bytes on which the UIDs should be.
@param kind The 'kind' of the ID (must not be {@code null}).
@param id The ID to look for.
@return 0 if the ID for ... | [
"Looks",
"up",
"an",
"ID",
"for",
"a",
"given",
"kind",
"and",
"prints",
"it",
"if",
"found",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/UidManager.java#L891-L905 |
13,650 | OpenTSDB/opentsdb | src/tools/UidManager.java | UidManager.idInBytes | private static byte[] idInBytes(final short idwidth, final long lid) {
if (idwidth <= 0) {
throw new AssertionError("negative idwidth: " + idwidth);
}
final byte[] id = Bytes.fromLong(lid);
for (int i = 0; i < id.length - idwidth; i++) {
if (id[i] != 0) {
System.err.println(lid + " i... | java | private static byte[] idInBytes(final short idwidth, final long lid) {
if (idwidth <= 0) {
throw new AssertionError("negative idwidth: " + idwidth);
}
final byte[] id = Bytes.fromLong(lid);
for (int i = 0; i < id.length - idwidth; i++) {
if (id[i] != 0) {
System.err.println(lid + " i... | [
"private",
"static",
"byte",
"[",
"]",
"idInBytes",
"(",
"final",
"short",
"idwidth",
",",
"final",
"long",
"lid",
")",
"{",
"if",
"(",
"idwidth",
"<=",
"0",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"\"negative idwidth: \"",
"+",
"idwidth",
")",
... | Transforms an ID into the corresponding byte array.
@param idwidth Number of bytes on which the UIDs should be.
@param lid The ID to transform.
@return The ID represented in {@code idwidth} bytes, or
{@code null} if {@code lid} couldn't fit in {@code idwidth} bytes. | [
"Transforms",
"an",
"ID",
"into",
"the",
"corresponding",
"byte",
"array",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/UidManager.java#L914-L927 |
13,651 | OpenTSDB/opentsdb | src/tools/UidManager.java | UidManager.extactLookupName | private static int extactLookupName(final HBaseClient client,
final byte[] table,
final short idwidth,
final String kind,
final String name) {
final UniqueId uid = ... | java | private static int extactLookupName(final HBaseClient client,
final byte[] table,
final short idwidth,
final String kind,
final String name) {
final UniqueId uid = ... | [
"private",
"static",
"int",
"extactLookupName",
"(",
"final",
"HBaseClient",
"client",
",",
"final",
"byte",
"[",
"]",
"table",
",",
"final",
"short",
"idwidth",
",",
"final",
"String",
"kind",
",",
"final",
"String",
"name",
")",
"{",
"final",
"UniqueId",
... | Looks up a name for a given kind, and prints it if found.
@param client The HBase client to use.
@param idwidth Number of bytes on which the UIDs should be.
@param kind The 'kind' of the ID (must not be {@code null}).
@param name The name to look for.
@return 0 if the name for this kind was found, 1 otherwise. | [
"Looks",
"up",
"a",
"name",
"for",
"a",
"given",
"kind",
"and",
"prints",
"it",
"if",
"found",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/UidManager.java#L958-L972 |
13,652 | OpenTSDB/opentsdb | src/tools/UidManager.java | UidManager.purgeTree | private static int purgeTree(final TSDB tsdb, final int tree_id,
final boolean delete_definition) throws Exception {
final TreeSync sync = new TreeSync(tsdb, 0, 1, 0);
return sync.purgeTree(tree_id, delete_definition);
} | java | private static int purgeTree(final TSDB tsdb, final int tree_id,
final boolean delete_definition) throws Exception {
final TreeSync sync = new TreeSync(tsdb, 0, 1, 0);
return sync.purgeTree(tree_id, delete_definition);
} | [
"private",
"static",
"int",
"purgeTree",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"int",
"tree_id",
",",
"final",
"boolean",
"delete_definition",
")",
"throws",
"Exception",
"{",
"final",
"TreeSync",
"sync",
"=",
"new",
"TreeSync",
"(",
"tsdb",
",",
"0",
... | Attempts to delete the branches, leaves, collisions and not-matched entries
for a given tree. Optionally removes the tree definition itself
@param tsdb The TSDB to use for access
@param tree_id ID of the tree to delete
@param delete_definition Whether or not to delete the tree definition as
well
@return 0 if completed ... | [
"Attempts",
"to",
"delete",
"the",
"branches",
"leaves",
"collisions",
"and",
"not",
"-",
"matched",
"entries",
"for",
"a",
"given",
"tree",
".",
"Optionally",
"removes",
"the",
"tree",
"definition",
"itself"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/UidManager.java#L1149-L1153 |
13,653 | OpenTSDB/opentsdb | src/core/MultiGetQuery.java | MultiGetQuery.fetch | public Deferred<TreeMap<byte[], Span>> fetch() {
if(tags.isEmpty()) {
return Deferred.fromResult(null);
}
startFetch();
return results;
} | java | public Deferred<TreeMap<byte[], Span>> fetch() {
if(tags.isEmpty()) {
return Deferred.fromResult(null);
}
startFetch();
return results;
} | [
"public",
"Deferred",
"<",
"TreeMap",
"<",
"byte",
"[",
"]",
",",
"Span",
">",
">",
"fetch",
"(",
")",
"{",
"if",
"(",
"tags",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Deferred",
".",
"fromResult",
"(",
"null",
")",
";",
"}",
"startFetch",
... | Initiate the get requests and return the tree map of results.
@return A non-null tree map of results (may be empty) | [
"Initiate",
"the",
"get",
"requests",
"and",
"return",
"the",
"tree",
"map",
"of",
"results",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/MultiGetQuery.java#L611-L617 |
13,654 | OpenTSDB/opentsdb | src/core/MultiGetQuery.java | MultiGetQuery.startFetch | private void startFetch() {
prepareConcurrentMultiGetTasks();
// set the time of starting
fetch_start_time = System.currentTimeMillis();
if (LOG.isDebugEnabled()) {
LOG.debug("Start to fetch data using multiget, there will be " + multi_get_wait_cnt
+ " multigets to call");
}
fo... | java | private void startFetch() {
prepareConcurrentMultiGetTasks();
// set the time of starting
fetch_start_time = System.currentTimeMillis();
if (LOG.isDebugEnabled()) {
LOG.debug("Start to fetch data using multiget, there will be " + multi_get_wait_cnt
+ " multigets to call");
}
fo... | [
"private",
"void",
"startFetch",
"(",
")",
"{",
"prepareConcurrentMultiGetTasks",
"(",
")",
";",
"// set the time of starting",
"fetch_start_time",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{... | Start the work of firing up X concurrent get requests. | [
"Start",
"the",
"work",
"of",
"firing",
"up",
"X",
"concurrent",
"get",
"requests",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/MultiGetQuery.java#L631-L651 |
13,655 | OpenTSDB/opentsdb | src/query/QueryUtil.java | QueryUtil.setDataTableScanFilter | public static void setDataTableScanFilter(
final Scanner scanner,
final List<byte[]> group_bys,
final ByteMap<byte[][]> row_key_literals,
final boolean explicit_tags,
final boolean enable_fuzzy_filter,
final int end_time) {
// no-op
if ((group_bys == null || group_bys.... | java | public static void setDataTableScanFilter(
final Scanner scanner,
final List<byte[]> group_bys,
final ByteMap<byte[][]> row_key_literals,
final boolean explicit_tags,
final boolean enable_fuzzy_filter,
final int end_time) {
// no-op
if ((group_bys == null || group_bys.... | [
"public",
"static",
"void",
"setDataTableScanFilter",
"(",
"final",
"Scanner",
"scanner",
",",
"final",
"List",
"<",
"byte",
"[",
"]",
">",
"group_bys",
",",
"final",
"ByteMap",
"<",
"byte",
"[",
"]",
"[",
"]",
">",
"row_key_literals",
",",
"final",
"boole... | Sets a filter or filter list on the scanner based on whether or not the
query had tags it needed to match.
@param scanner The scanner to modify.
@param group_bys An optional list of tag keys that we want to group on. May
be null.
@param row_key_literals An optional list of key value pairs to filter on.
May be null.
@pa... | [
"Sets",
"a",
"filter",
"or",
"filter",
"list",
"on",
"the",
"scanner",
"based",
"on",
"whether",
"or",
"not",
"the",
"query",
"had",
"tags",
"it",
"needed",
"to",
"match",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/QueryUtil.java#L194-L258 |
13,656 | OpenTSDB/opentsdb | src/query/QueryUtil.java | QueryUtil.getRowKeyTSUIDRegex | public static String getRowKeyTSUIDRegex(final List<String> tsuids) {
Collections.sort(tsuids);
// first, convert the tags to byte arrays and count up the total length
// so we can allocate the string builder
final short metric_width = TSDB.metrics_width();
int tags_length = 0;
final ArrayL... | java | public static String getRowKeyTSUIDRegex(final List<String> tsuids) {
Collections.sort(tsuids);
// first, convert the tags to byte arrays and count up the total length
// so we can allocate the string builder
final short metric_width = TSDB.metrics_width();
int tags_length = 0;
final ArrayL... | [
"public",
"static",
"String",
"getRowKeyTSUIDRegex",
"(",
"final",
"List",
"<",
"String",
">",
"tsuids",
")",
"{",
"Collections",
".",
"sort",
"(",
"tsuids",
")",
";",
"// first, convert the tags to byte arrays and count up the total length",
"// so we can allocate the stri... | Creates a regular expression with a list of or'd TUIDs to compare
against the rows in storage.
@param tsuids The list of TSUIDs to scan for
@return A regular expression string to pass to the storage layer. | [
"Creates",
"a",
"regular",
"expression",
"with",
"a",
"list",
"of",
"or",
"d",
"TUIDs",
"to",
"compare",
"against",
"the",
"rows",
"in",
"storage",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/QueryUtil.java#L266-L308 |
13,657 | OpenTSDB/opentsdb | src/query/QueryUtil.java | QueryUtil.getMetricScanner | public static Scanner getMetricScanner(final TSDB tsdb, final int salt_bucket,
final byte[] metric, final int start, final int stop,
final byte[] table, final byte[] family) {
final short metric_width = TSDB.metrics_width();
final int metric_salt_width = metric_width + Const.SALT_WIDTH();
fina... | java | public static Scanner getMetricScanner(final TSDB tsdb, final int salt_bucket,
final byte[] metric, final int start, final int stop,
final byte[] table, final byte[] family) {
final short metric_width = TSDB.metrics_width();
final int metric_salt_width = metric_width + Const.SALT_WIDTH();
fina... | [
"public",
"static",
"Scanner",
"getMetricScanner",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"int",
"salt_bucket",
",",
"final",
"byte",
"[",
"]",
"metric",
",",
"final",
"int",
"start",
",",
"final",
"int",
"stop",
",",
"final",
"byte",
"[",
"]",
"tab... | Compiles an HBase scanner against the main data table
@param tsdb The TSDB with a configured HBaseClient
@param salt_bucket An optional salt bucket ID for salting the start/stop
keys.
@param metric The metric to scan for
@param start The start time stamp in seconds
@param stop The stop timestamp in seconds
@param table... | [
"Compiles",
"an",
"HBase",
"scanner",
"against",
"the",
"main",
"data",
"table"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/QueryUtil.java#L322-L348 |
13,658 | OpenTSDB/opentsdb | src/query/QueryUtil.java | QueryUtil.addId | public static void addId(final StringBuilder buf, final byte[] id,
final boolean close) {
boolean backslash = false;
for (final byte b : id) {
buf.append((char) (b & 0xFF));
if (b == 'E' && backslash) { // If we saw a `\' and now we have a `E'.
// So we just terminated the quoted sec... | java | public static void addId(final StringBuilder buf, final byte[] id,
final boolean close) {
boolean backslash = false;
for (final byte b : id) {
buf.append((char) (b & 0xFF));
if (b == 'E' && backslash) { // If we saw a `\' and now we have a `E'.
// So we just terminated the quoted sec... | [
"public",
"static",
"void",
"addId",
"(",
"final",
"StringBuilder",
"buf",
",",
"final",
"byte",
"[",
"]",
"id",
",",
"final",
"boolean",
"close",
")",
"{",
"boolean",
"backslash",
"=",
"false",
";",
"for",
"(",
"final",
"byte",
"b",
":",
"id",
")",
... | Appends the given UID to the given regular expression buffer
@param buf The String buffer to modify
@param id The UID to add
@param close Whether or not to append "\\E" to the end | [
"Appends",
"the",
"given",
"UID",
"to",
"the",
"given",
"regular",
"expression",
"buffer"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/QueryUtil.java#L356-L372 |
13,659 | OpenTSDB/opentsdb | src/query/QueryUtil.java | QueryUtil.byteRegexToString | public static String byteRegexToString(final String regexp) {
final StringBuilder buf = new StringBuilder();
for (int i = 0; i < regexp.length(); i++) {
if (i > 0 && regexp.charAt(i - 1) == 'Q') {
if (regexp.charAt(i - 3) == '*') {
// tagk
byte[] tagk = new byte[TSDB.tagk_width... | java | public static String byteRegexToString(final String regexp) {
final StringBuilder buf = new StringBuilder();
for (int i = 0; i < regexp.length(); i++) {
if (i > 0 && regexp.charAt(i - 1) == 'Q') {
if (regexp.charAt(i - 3) == '*') {
// tagk
byte[] tagk = new byte[TSDB.tagk_width... | [
"public",
"static",
"String",
"byteRegexToString",
"(",
"final",
"String",
"regexp",
")",
"{",
"final",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"regexp",
".",
"length",
"(",
"... | Little helper to print out the regular expression by converting the UID
bytes to an array.
@param regexp The regex string to print to the debug log | [
"Little",
"helper",
"to",
"print",
"out",
"the",
"regular",
"expression",
"by",
"converting",
"the",
"UID",
"bytes",
"to",
"an",
"array",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/QueryUtil.java#L379-L405 |
13,660 | OpenTSDB/opentsdb | src/query/expression/UnionIterator.java | UnionIterator.computeUnion | private void computeUnion() {
// key = flattened tags, array of queries.size()
final ByteMap<ExpressionDataPoint[]> ordered_union =
new ByteMap<ExpressionDataPoint[]>();
final Iterator<ITimeSyncedIterator> it = queries.values().iterator();
while (it.hasNext()) {
final ITimeSyncedIterato... | java | private void computeUnion() {
// key = flattened tags, array of queries.size()
final ByteMap<ExpressionDataPoint[]> ordered_union =
new ByteMap<ExpressionDataPoint[]>();
final Iterator<ITimeSyncedIterator> it = queries.values().iterator();
while (it.hasNext()) {
final ITimeSyncedIterato... | [
"private",
"void",
"computeUnion",
"(",
")",
"{",
"// key = flattened tags, array of queries.size()",
"final",
"ByteMap",
"<",
"ExpressionDataPoint",
"[",
"]",
">",
"ordered_union",
"=",
"new",
"ByteMap",
"<",
"ExpressionDataPoint",
"[",
"]",
">",
"(",
")",
";",
"... | Computes the union of all sets, matching on tags and optionally the
aggregated tags across each variable. | [
"Computes",
"the",
"union",
"of",
"all",
"sets",
"matching",
"on",
"tags",
"and",
"optionally",
"the",
"aggregated",
"tags",
"across",
"each",
"variable",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/expression/UnionIterator.java#L171-L201 |
13,661 | OpenTSDB/opentsdb | src/query/expression/UnionIterator.java | UnionIterator.flattenTags | static byte[] flattenTags(final boolean use_query_tags,
final boolean include_agg_tags, final ExpressionDataPoint dp,
final ITimeSyncedIterator sub) {
if (dp.tags() == null || dp.tags().isEmpty()) {
return HBaseClient.EMPTY_ARRAY;
}
final int tagk_width = TSDB.tagk_width();
final int... | java | static byte[] flattenTags(final boolean use_query_tags,
final boolean include_agg_tags, final ExpressionDataPoint dp,
final ITimeSyncedIterator sub) {
if (dp.tags() == null || dp.tags().isEmpty()) {
return HBaseClient.EMPTY_ARRAY;
}
final int tagk_width = TSDB.tagk_width();
final int... | [
"static",
"byte",
"[",
"]",
"flattenTags",
"(",
"final",
"boolean",
"use_query_tags",
",",
"final",
"boolean",
"include_agg_tags",
",",
"final",
"ExpressionDataPoint",
"dp",
",",
"final",
"ITimeSyncedIterator",
"sub",
")",
"{",
"if",
"(",
"dp",
".",
"tags",
"(... | Creates a key based on the concatenation of the tag pairs then the agg
tag keys.
@param use_query_tags Whether or not to include tags returned with the
results or just use those group by'd in the query
@param include_agg_tags Whether or not to include the aggregated tags in
the identifier
@param dp The current expressi... | [
"Creates",
"a",
"key",
"based",
"on",
"the",
"concatenation",
"of",
"the",
"tag",
"pairs",
"then",
"the",
"agg",
"tag",
"keys",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/expression/UnionIterator.java#L259-L309 |
13,662 | OpenTSDB/opentsdb | src/core/MutableDataPoint.java | MutableDataPoint.reset | public void reset(DataPoint dp) {
this.timestamp = dp.timestamp();
this.is_integer = dp.isInteger();
if (is_integer) {
this.value = dp.longValue();
} else {
this.value = Double.doubleToRawLongBits(dp.doubleValue());
}
} | java | public void reset(DataPoint dp) {
this.timestamp = dp.timestamp();
this.is_integer = dp.isInteger();
if (is_integer) {
this.value = dp.longValue();
} else {
this.value = Double.doubleToRawLongBits(dp.doubleValue());
}
} | [
"public",
"void",
"reset",
"(",
"DataPoint",
"dp",
")",
"{",
"this",
".",
"timestamp",
"=",
"dp",
".",
"timestamp",
"(",
")",
";",
"this",
".",
"is_integer",
"=",
"dp",
".",
"isInteger",
"(",
")",
";",
"if",
"(",
"is_integer",
")",
"{",
"this",
"."... | Resets with a new data point.
@param dp A new data point to store. | [
"Resets",
"with",
"a",
"new",
"data",
"point",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/MutableDataPoint.java#L59-L67 |
13,663 | OpenTSDB/opentsdb | src/core/MutableDataPoint.java | MutableDataPoint.ofLongValue | public static MutableDataPoint ofLongValue(final long timestamp,
final long value) {
final MutableDataPoint dp = new MutableDataPoint();
dp.reset(timestamp, value);
return dp;
} | java | public static MutableDataPoint ofLongValue(final long timestamp,
final long value) {
final MutableDataPoint dp = new MutableDataPoint();
dp.reset(timestamp, value);
return dp;
} | [
"public",
"static",
"MutableDataPoint",
"ofLongValue",
"(",
"final",
"long",
"timestamp",
",",
"final",
"long",
"value",
")",
"{",
"final",
"MutableDataPoint",
"dp",
"=",
"new",
"MutableDataPoint",
"(",
")",
";",
"dp",
".",
"reset",
"(",
"timestamp",
",",
"v... | Resets with a new pair of a timestamp and a long value.
@param timestamp A timestamp.
@param value A double value. | [
"Resets",
"with",
"a",
"new",
"pair",
"of",
"a",
"timestamp",
"and",
"a",
"long",
"value",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/MutableDataPoint.java#L88-L93 |
13,664 | OpenTSDB/opentsdb | src/core/BatchedDataPoints.java | BatchedDataPoints.setSeries | @Override
public void setSeries(final String metric, final Map<String, String> tags) {
IncomingDataPoints.checkMetricAndTags(metric, tags);
try {
row_key = IncomingDataPoints.rowKeyTemplate(tsdb, metric, tags);
RowKey.prefixKeyWithSalt(row_key);
reset();
}
catch (RuntimeException e) ... | java | @Override
public void setSeries(final String metric, final Map<String, String> tags) {
IncomingDataPoints.checkMetricAndTags(metric, tags);
try {
row_key = IncomingDataPoints.rowKeyTemplate(tsdb, metric, tags);
RowKey.prefixKeyWithSalt(row_key);
reset();
}
catch (RuntimeException e) ... | [
"@",
"Override",
"public",
"void",
"setSeries",
"(",
"final",
"String",
"metric",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"IncomingDataPoints",
".",
"checkMetricAndTags",
"(",
"metric",
",",
"tags",
")",
";",
"try",
"{",
... | Sets the metric name and tags of this batch. This method only need be
called if there is a desire to reuse the data structure after the data has
been flushed. This will reset all cached information in this data structure.
@throws IllegalArgumentException if the metric name is empty or contains
illegal characters or if ... | [
"Sets",
"the",
"metric",
"name",
"and",
"tags",
"of",
"this",
"batch",
".",
"This",
"method",
"only",
"need",
"be",
"called",
"if",
"there",
"is",
"a",
"desire",
"to",
"reuse",
"the",
"data",
"structure",
"after",
"the",
"data",
"has",
"been",
"flushed",... | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/BatchedDataPoints.java#L101-L115 |
13,665 | OpenTSDB/opentsdb | src/core/BatchedDataPoints.java | BatchedDataPoints.reset | private void reset() {
size = 0;
qualifier_index = 0;
value_index = 0;
base_time = Long.MIN_VALUE;
last_timestamp = Long.MIN_VALUE;
} | java | private void reset() {
size = 0;
qualifier_index = 0;
value_index = 0;
base_time = Long.MIN_VALUE;
last_timestamp = Long.MIN_VALUE;
} | [
"private",
"void",
"reset",
"(",
")",
"{",
"size",
"=",
"0",
";",
"qualifier_index",
"=",
"0",
";",
"value_index",
"=",
"0",
";",
"base_time",
"=",
"Long",
".",
"MIN_VALUE",
";",
"last_timestamp",
"=",
"Long",
".",
"MIN_VALUE",
";",
"}"
] | Resets the indices without overwriting the buffers. So the same amount of
space will remain allocated. | [
"Resets",
"the",
"indices",
"without",
"overwriting",
"the",
"buffers",
".",
"So",
"the",
"same",
"amount",
"of",
"space",
"will",
"remain",
"allocated",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/BatchedDataPoints.java#L121-L127 |
13,666 | OpenTSDB/opentsdb | src/core/BatchedDataPoints.java | BatchedDataPoints.persist | @Override
public Deferred<Object> persist() {
final byte[] q = Arrays.copyOfRange(batched_qualifier, 0, qualifier_index);
final byte[] v = Arrays.copyOfRange(batched_value, 0, value_index);
final byte[] r = Arrays.copyOfRange(row_key, 0, row_key.length);
final long base_time = this.base_time; // shado... | java | @Override
public Deferred<Object> persist() {
final byte[] q = Arrays.copyOfRange(batched_qualifier, 0, qualifier_index);
final byte[] v = Arrays.copyOfRange(batched_value, 0, value_index);
final byte[] r = Arrays.copyOfRange(row_key, 0, row_key.length);
final long base_time = this.base_time; // shado... | [
"@",
"Override",
"public",
"Deferred",
"<",
"Object",
">",
"persist",
"(",
")",
"{",
"final",
"byte",
"[",
"]",
"q",
"=",
"Arrays",
".",
"copyOfRange",
"(",
"batched_qualifier",
",",
"0",
",",
"qualifier_index",
")",
";",
"final",
"byte",
"[",
"]",
"v"... | A copy of the values is created and sent with a put request. A reset is
initialized which makes this data structure ready to be reused for the same
metric and tags but for a different hour of data.
@return {@inheritDoc} | [
"A",
"copy",
"of",
"the",
"values",
"is",
"created",
"and",
"sent",
"with",
"a",
"put",
"request",
".",
"A",
"reset",
"is",
"initialized",
"which",
"makes",
"this",
"data",
"structure",
"ready",
"to",
"be",
"reused",
"for",
"the",
"same",
"metric",
"and"... | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/BatchedDataPoints.java#L135-L144 |
13,667 | OpenTSDB/opentsdb | src/core/BatchedDataPoints.java | BatchedDataPoints.ensureCapacity | private void ensureCapacity(final byte[] next_qualifier,
final byte[] next_value) {
if (qualifier_index + next_qualifier.length >= batched_qualifier.length) {
batched_qualifier = Arrays.copyOf(batched_qualifier,
batched_qualifier.length * 2);
}
if (value_index + next_value.length >= b... | java | private void ensureCapacity(final byte[] next_qualifier,
final byte[] next_value) {
if (qualifier_index + next_qualifier.length >= batched_qualifier.length) {
batched_qualifier = Arrays.copyOf(batched_qualifier,
batched_qualifier.length * 2);
}
if (value_index + next_value.length >= b... | [
"private",
"void",
"ensureCapacity",
"(",
"final",
"byte",
"[",
"]",
"next_qualifier",
",",
"final",
"byte",
"[",
"]",
"next_value",
")",
"{",
"if",
"(",
"qualifier_index",
"+",
"next_qualifier",
".",
"length",
">=",
"batched_qualifier",
".",
"length",
")",
... | Checks the size of the qualifier and value arrays to make sure we have
space. If not then we double the size of the arrays. This way a row
allocates space for a full hour of second data but if the user requires
millisecond storage with more than 3600 points, it will expand.
@param next_qualifier The next qualifier to u... | [
"Checks",
"the",
"size",
"of",
"the",
"qualifier",
"and",
"value",
"arrays",
"to",
"make",
"sure",
"we",
"have",
"space",
".",
"If",
"not",
"then",
"we",
"double",
"the",
"size",
"of",
"the",
"arrays",
".",
"This",
"way",
"a",
"row",
"allocates",
"spac... | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/BatchedDataPoints.java#L262-L271 |
13,668 | OpenTSDB/opentsdb | src/core/BatchedDataPoints.java | BatchedDataPoints.append | private void append(final byte[] next_qualifier, final byte[] next_value) {
ensureCapacity(next_qualifier, next_value);
// Now let's simply concatenate all the values together.
System.arraycopy(next_value, 0, batched_value, value_index, next_value.length);
value_index += next_value.length;
// Now ... | java | private void append(final byte[] next_qualifier, final byte[] next_value) {
ensureCapacity(next_qualifier, next_value);
// Now let's simply concatenate all the values together.
System.arraycopy(next_value, 0, batched_value, value_index, next_value.length);
value_index += next_value.length;
// Now ... | [
"private",
"void",
"append",
"(",
"final",
"byte",
"[",
"]",
"next_qualifier",
",",
"final",
"byte",
"[",
"]",
"next_value",
")",
"{",
"ensureCapacity",
"(",
"next_qualifier",
",",
"next_value",
")",
";",
"// Now let's simply concatenate all the values together.",
"... | Appends the value and qualifier to the appropriate arrays
@param next_qualifier The next qualifier to append
@param next_value The next value to append | [
"Appends",
"the",
"value",
"and",
"qualifier",
"to",
"the",
"appropriate",
"arrays"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/BatchedDataPoints.java#L278-L289 |
13,669 | OpenTSDB/opentsdb | src/core/BatchedDataPoints.java | BatchedDataPoints.qualifierOffset | private int qualifierOffset(final int i) {
int offset = 0;
for (int j = 0; j < i; j++) {
offset += Internal.getQualifierLength(batched_qualifier, offset);
}
return offset;
} | java | private int qualifierOffset(final int i) {
int offset = 0;
for (int j = 0; j < i; j++) {
offset += Internal.getQualifierLength(batched_qualifier, offset);
}
return offset;
} | [
"private",
"int",
"qualifierOffset",
"(",
"final",
"int",
"i",
")",
"{",
"int",
"offset",
"=",
"0",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"i",
";",
"j",
"++",
")",
"{",
"offset",
"+=",
"Internal",
".",
"getQualifierLength",
"(",
"... | Computes the proper offset to reach qualifier
@param i
@return | [
"Computes",
"the",
"proper",
"offset",
"to",
"reach",
"qualifier"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/BatchedDataPoints.java#L403-L409 |
13,670 | OpenTSDB/opentsdb | src/core/BatchedDataPoints.java | BatchedDataPoints.isInteger | private boolean isInteger(final int i, final int q_offset) {
final short flags = Internal.getFlagsFromQualifier(batched_qualifier, q_offset);
return (flags & Const.FLAG_FLOAT) == 0x0;
} | java | private boolean isInteger(final int i, final int q_offset) {
final short flags = Internal.getFlagsFromQualifier(batched_qualifier, q_offset);
return (flags & Const.FLAG_FLOAT) == 0x0;
} | [
"private",
"boolean",
"isInteger",
"(",
"final",
"int",
"i",
",",
"final",
"int",
"q_offset",
")",
"{",
"final",
"short",
"flags",
"=",
"Internal",
".",
"getFlagsFromQualifier",
"(",
"batched_qualifier",
",",
"q_offset",
")",
";",
"return",
"(",
"flags",
"&"... | Tells whether or not the ith value is integer. Uses pre-computed qualifier offset.
@param i
@param q_offset qualifier offset
@return | [
"Tells",
"whether",
"or",
"not",
"the",
"ith",
"value",
"is",
"integer",
".",
"Uses",
"pre",
"-",
"computed",
"qualifier",
"offset",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/BatchedDataPoints.java#L429-L432 |
13,671 | OpenTSDB/opentsdb | src/tsd/QueryRpc.java | QueryRpc.handleExpressionQuery | private void handleExpressionQuery(final TSDB tsdb, final HttpQuery query) {
final net.opentsdb.query.pojo.Query v2_query =
JSON.parseToObject(query.getContent(), net.opentsdb.query.pojo.Query.class);
v2_query.validate();
checkAuthorization(tsdb, query.channel(), v2_query);
final QueryExecuto... | java | private void handleExpressionQuery(final TSDB tsdb, final HttpQuery query) {
final net.opentsdb.query.pojo.Query v2_query =
JSON.parseToObject(query.getContent(), net.opentsdb.query.pojo.Query.class);
v2_query.validate();
checkAuthorization(tsdb, query.channel(), v2_query);
final QueryExecuto... | [
"private",
"void",
"handleExpressionQuery",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"HttpQuery",
"query",
")",
"{",
"final",
"net",
".",
"opentsdb",
".",
"query",
".",
"pojo",
".",
"Query",
"v2_query",
"=",
"JSON",
".",
"parseToObject",
"(",
"query",
"... | Handles an expression query
@param tsdb The TSDB to which we belong
@param query The HTTP query to parse/respond
@since 2.3 | [
"Handles",
"an",
"expression",
"query"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/QueryRpc.java#L330-L339 |
13,672 | OpenTSDB/opentsdb | src/tsd/QueryRpc.java | QueryRpc.parseMTypeSubQuery | private static void parseMTypeSubQuery(final String query_string,
TSQuery data_query) {
if (query_string == null || query_string.isEmpty()) {
throw new BadRequestException("The query string was empty");
}
// m is of the following forms:
// agg:[interval-agg:][rate:]metric[{tag=value,..... | java | private static void parseMTypeSubQuery(final String query_string,
TSQuery data_query) {
if (query_string == null || query_string.isEmpty()) {
throw new BadRequestException("The query string was empty");
}
// m is of the following forms:
// agg:[interval-agg:][rate:]metric[{tag=value,..... | [
"private",
"static",
"void",
"parseMTypeSubQuery",
"(",
"final",
"String",
"query_string",
",",
"TSQuery",
"data_query",
")",
"{",
"if",
"(",
"query_string",
"==",
"null",
"||",
"query_string",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"BadRequestExc... | Parses a query string "m=..." type query and adds it to the TSQuery.
This will generate a TSSubQuery and add it to the TSQuery if successful
@param query_string The value of the m query string parameter, i.e. what
comes after the equals sign
@param data_query The query we're building
@throws BadRequestException if we a... | [
"Parses",
"a",
"query",
"string",
"m",
"=",
"...",
"type",
"query",
"and",
"adds",
"it",
"to",
"the",
"TSQuery",
".",
"This",
"will",
"generate",
"a",
"TSSubQuery",
"and",
"add",
"it",
"to",
"the",
"TSQuery",
"if",
"successful"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/QueryRpc.java#L634-L686 |
13,673 | OpenTSDB/opentsdb | src/tsd/QueryRpc.java | QueryRpc.parseTsuidTypeSubQuery | private static void parseTsuidTypeSubQuery(final String query_string,
TSQuery data_query) {
if (query_string == null || query_string.isEmpty()) {
throw new BadRequestException("The tsuid query string was empty");
}
// tsuid queries are of the following forms:
// agg:[interval-agg:][rat... | java | private static void parseTsuidTypeSubQuery(final String query_string,
TSQuery data_query) {
if (query_string == null || query_string.isEmpty()) {
throw new BadRequestException("The tsuid query string was empty");
}
// tsuid queries are of the following forms:
// agg:[interval-agg:][rat... | [
"private",
"static",
"void",
"parseTsuidTypeSubQuery",
"(",
"final",
"String",
"query_string",
",",
"TSQuery",
"data_query",
")",
"{",
"if",
"(",
"query_string",
"==",
"null",
"||",
"query_string",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"BadReques... | Parses a "tsuid=..." type query and adds it to the TSQuery.
This will generate a TSSubQuery and add it to the TSQuery if successful
@param query_string The value of the m query string parameter, i.e. what
comes after the equals sign
@param data_query The query we're building
@throws BadRequestException if we are unable... | [
"Parses",
"a",
"tsuid",
"=",
"...",
"type",
"query",
"and",
"adds",
"it",
"to",
"the",
"TSQuery",
".",
"This",
"will",
"generate",
"a",
"TSSubQuery",
"and",
"add",
"it",
"to",
"the",
"TSQuery",
"if",
"successful"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/QueryRpc.java#L697-L743 |
13,674 | OpenTSDB/opentsdb | src/tsd/QueryRpc.java | QueryRpc.parseLastPointQuery | private LastPointQuery parseLastPointQuery(final TSDB tsdb,
final HttpQuery http_query) {
final LastPointQuery query = new LastPointQuery();
if (http_query.hasQueryStringParam("resolve")) {
query.setResolveNames(true);
}
if (http_query.hasQueryStringParam("back_scan")) {
try... | java | private LastPointQuery parseLastPointQuery(final TSDB tsdb,
final HttpQuery http_query) {
final LastPointQuery query = new LastPointQuery();
if (http_query.hasQueryStringParam("resolve")) {
query.setResolveNames(true);
}
if (http_query.hasQueryStringParam("back_scan")) {
try... | [
"private",
"LastPointQuery",
"parseLastPointQuery",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"HttpQuery",
"http_query",
")",
"{",
"final",
"LastPointQuery",
"query",
"=",
"new",
"LastPointQuery",
"(",
")",
";",
"if",
"(",
"http_query",
".",
"hasQueryStringParam... | Parses a last point query from the URI string
@param tsdb The TSDB to which we belong
@param http_query The HTTP query to work with
@return A LastPointQuery object to execute against
@throws BadRequestException if parsing failed | [
"Parses",
"a",
"last",
"point",
"query",
"from",
"the",
"URI",
"string"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/QueryRpc.java#L806-L844 |
13,675 | OpenTSDB/opentsdb | src/tsd/AbstractHttpQuery.java | AbstractHttpQuery.getPrintableHeaders | public Map<String, String> getPrintableHeaders() {
final Map<String, String> headers = new HashMap<String, String>(
request.headers().entries().size());
for (final Entry<String, String> header : request.headers().entries()) {
if (header.getKey().toLowerCase().equals("cookie")) {
// null ou... | java | public Map<String, String> getPrintableHeaders() {
final Map<String, String> headers = new HashMap<String, String>(
request.headers().entries().size());
for (final Entry<String, String> header : request.headers().entries()) {
if (header.getKey().toLowerCase().equals("cookie")) {
// null ou... | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getPrintableHeaders",
"(",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
"request",
".",
"headers",
"(",
")",
... | Copies the header list and obfuscates the "cookie" header in case it
contains auth tokens, etc. Note that it flattens duplicate headers keys
as comma separated lists per the RFC
@return The full set of headers for this query with the cookie obfuscated | [
"Copies",
"the",
"header",
"list",
"and",
"obfuscates",
"the",
"cookie",
"header",
"in",
"case",
"it",
"contains",
"auth",
"tokens",
"etc",
".",
"Note",
"that",
"it",
"flattens",
"duplicate",
"headers",
"keys",
"as",
"comma",
"separated",
"lists",
"per",
"th... | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/AbstractHttpQuery.java#L129-L147 |
13,676 | OpenTSDB/opentsdb | src/tsd/AbstractHttpQuery.java | AbstractHttpQuery.getHeaders | public Map<String, String> getHeaders() {
final Map<String, String> headers = new HashMap<String, String>(
request.headers().entries().size());
for (final Entry<String, String> header : request.headers().entries()) {
// http://tools.ietf.org/html/rfc2616#section-4.2
if (headers.containsKey(h... | java | public Map<String, String> getHeaders() {
final Map<String, String> headers = new HashMap<String, String>(
request.headers().entries().size());
for (final Entry<String, String> header : request.headers().entries()) {
// http://tools.ietf.org/html/rfc2616#section-4.2
if (headers.containsKey(h... | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getHeaders",
"(",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
"request",
".",
"headers",
"(",
")",
".",
... | Copies the header list so modifications won't affect the original set.
Note that it flattens duplicate headers keys as comma separated lists
per the RFC
@return The full set of headers for this query | [
"Copies",
"the",
"header",
"list",
"so",
"modifications",
"won",
"t",
"affect",
"the",
"original",
"set",
".",
"Note",
"that",
"it",
"flattens",
"duplicate",
"headers",
"keys",
"as",
"comma",
"separated",
"lists",
"per",
"the",
"RFC"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/AbstractHttpQuery.java#L155-L168 |
13,677 | OpenTSDB/opentsdb | src/tsd/AbstractHttpQuery.java | AbstractHttpQuery.getHeaderValue | public String getHeaderValue(final String headerName) {
if (headerName == null) { return null; }
return request.headers().get(headerName);
} | java | public String getHeaderValue(final String headerName) {
if (headerName == null) { return null; }
return request.headers().get(headerName);
} | [
"public",
"String",
"getHeaderValue",
"(",
"final",
"String",
"headerName",
")",
"{",
"if",
"(",
"headerName",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"request",
".",
"headers",
"(",
")",
".",
"get",
"(",
"headerName",
")",
";",
"... | Return the value of the given HTTP Header
first match wins
@return Header value as string | [
"Return",
"the",
"value",
"of",
"the",
"given",
"HTTP",
"Header",
"first",
"match",
"wins"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/AbstractHttpQuery.java#L175-L178 |
13,678 | OpenTSDB/opentsdb | src/tsd/AbstractHttpQuery.java | AbstractHttpQuery.getQueryString | public Map<String, List<String>> getQueryString() {
if (querystring == null) {
try {
querystring = new QueryStringDecoder(request.getUri()).getParameters();
} catch (IllegalArgumentException e) {
throw new BadRequestException("Bad query string: " + e.getMessage());
}
}
retu... | java | public Map<String, List<String>> getQueryString() {
if (querystring == null) {
try {
querystring = new QueryStringDecoder(request.getUri()).getParameters();
} catch (IllegalArgumentException e) {
throw new BadRequestException("Bad query string: " + e.getMessage());
}
}
retu... | [
"public",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"getQueryString",
"(",
")",
"{",
"if",
"(",
"querystring",
"==",
"null",
")",
"{",
"try",
"{",
"querystring",
"=",
"new",
"QueryStringDecoder",
"(",
"request",
".",
"getUri",
"(",
")... | Returns the query string parameters passed in the URI. | [
"Returns",
"the",
"query",
"string",
"parameters",
"passed",
"in",
"the",
"URI",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/AbstractHttpQuery.java#L200-L209 |
13,679 | OpenTSDB/opentsdb | src/tsd/AbstractHttpQuery.java | AbstractHttpQuery.getCharset | public Charset getCharset() {
// RFC2616 3.7
for (String type : this.request.headers().getAll("Content-Type")) {
int idx = type.toUpperCase().indexOf("CHARSET=");
if (idx > 1) {
String charset = type.substring(idx+8);
return Charset.forName(charset);
}
}
return Charset.... | java | public Charset getCharset() {
// RFC2616 3.7
for (String type : this.request.headers().getAll("Content-Type")) {
int idx = type.toUpperCase().indexOf("CHARSET=");
if (idx > 1) {
String charset = type.substring(idx+8);
return Charset.forName(charset);
}
}
return Charset.... | [
"public",
"Charset",
"getCharset",
"(",
")",
"{",
"// RFC2616 3.7",
"for",
"(",
"String",
"type",
":",
"this",
".",
"request",
".",
"headers",
"(",
")",
".",
"getAll",
"(",
"\"Content-Type\"",
")",
")",
"{",
"int",
"idx",
"=",
"type",
".",
"toUpperCase",... | Attempts to parse the character set from the request header. If not set
defaults to UTF-8
@return A Charset object
@throws UnsupportedCharsetException if the parsed character set is invalid | [
"Attempts",
"to",
"parse",
"the",
"character",
"set",
"from",
"the",
"request",
"header",
".",
"If",
"not",
"set",
"defaults",
"to",
"UTF",
"-",
"8"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/AbstractHttpQuery.java#L324-L334 |
13,680 | OpenTSDB/opentsdb | src/tsd/AbstractHttpQuery.java | AbstractHttpQuery.done | public void done() {
final int processing_time = processingTimeMillis();
final String url = request.getUri();
final String msg = String.format("HTTP %s done in %d ms", url, processing_time);
if (url.startsWith("/api/put") && LOG.isDebugEnabled()) {
// NOTE: Suppresses too many log lines from /api/put.... | java | public void done() {
final int processing_time = processingTimeMillis();
final String url = request.getUri();
final String msg = String.format("HTTP %s done in %d ms", url, processing_time);
if (url.startsWith("/api/put") && LOG.isDebugEnabled()) {
// NOTE: Suppresses too many log lines from /api/put.... | [
"public",
"void",
"done",
"(",
")",
"{",
"final",
"int",
"processing_time",
"=",
"processingTimeMillis",
"(",
")",
";",
"final",
"String",
"url",
"=",
"request",
".",
"getUri",
"(",
")",
";",
"final",
"String",
"msg",
"=",
"String",
".",
"format",
"(",
... | Method to call after writing the HTTP response to the wire. The default
is to simply log the request info. Can be overridden by subclasses. | [
"Method",
"to",
"call",
"after",
"writing",
"the",
"HTTP",
"response",
"to",
"the",
"wire",
".",
"The",
"default",
"is",
"to",
"simply",
"log",
"the",
"request",
"info",
".",
"Can",
"be",
"overridden",
"by",
"subclasses",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/AbstractHttpQuery.java#L356-L367 |
13,681 | OpenTSDB/opentsdb | src/tsd/AbstractHttpQuery.java | AbstractHttpQuery.sendStatusOnly | public void sendStatusOnly(final HttpResponseStatus status) {
if (!chan.isConnected()) {
if(stats != null) {
stats.markSendFailed();
}
done();
return;
}
response.setStatus(status);
final boolean keepalive = HttpHeaders.isKeepAlive(request);
if (keepalive) {
Htt... | java | public void sendStatusOnly(final HttpResponseStatus status) {
if (!chan.isConnected()) {
if(stats != null) {
stats.markSendFailed();
}
done();
return;
}
response.setStatus(status);
final boolean keepalive = HttpHeaders.isKeepAlive(request);
if (keepalive) {
Htt... | [
"public",
"void",
"sendStatusOnly",
"(",
"final",
"HttpResponseStatus",
"status",
")",
"{",
"if",
"(",
"!",
"chan",
".",
"isConnected",
"(",
")",
")",
"{",
"if",
"(",
"stats",
"!=",
"null",
")",
"{",
"stats",
".",
"markSendFailed",
"(",
")",
";",
"}",
... | Send just the status code without a body, used for 204 or 304
@param status The response code to reply with | [
"Send",
"just",
"the",
"status",
"code",
"without",
"a",
"body",
"used",
"for",
"204",
"or",
"304"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/AbstractHttpQuery.java#L405-L427 |
13,682 | OpenTSDB/opentsdb | src/core/CompactionQueue.java | CompactionQueue.flush | public Deferred<ArrayList<Object>> flush() {
final int size = size();
if (size > 0) {
LOG.info("Flushing all old outstanding rows out of " + size + " rows");
}
final long now = System.currentTimeMillis();
return flush(now / 1000 - Const.MAX_TIMESPAN - 1, Integer.MAX_VALUE);
} | java | public Deferred<ArrayList<Object>> flush() {
final int size = size();
if (size > 0) {
LOG.info("Flushing all old outstanding rows out of " + size + " rows");
}
final long now = System.currentTimeMillis();
return flush(now / 1000 - Const.MAX_TIMESPAN - 1, Integer.MAX_VALUE);
} | [
"public",
"Deferred",
"<",
"ArrayList",
"<",
"Object",
">",
">",
"flush",
"(",
")",
"{",
"final",
"int",
"size",
"=",
"size",
"(",
")",
";",
"if",
"(",
"size",
">",
"0",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Flushing all old outstanding rows out of \"",
... | Forces a flush of the all old entries in the compaction queue.
@return A deferred that will be called back once everything has been
flushed (or something failed, in which case the deferred will carry the
exception). In case of success, the kind of object returned is
unspecified. | [
"Forces",
"a",
"flush",
"of",
"the",
"all",
"old",
"entries",
"in",
"the",
"compaction",
"queue",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/CompactionQueue.java#L127-L134 |
13,683 | OpenTSDB/opentsdb | src/core/CompactionQueue.java | CompactionQueue.flush | private Deferred<ArrayList<Object>> flush(final long cut_off, int maxflushes) {
assert maxflushes > 0: "maxflushes must be > 0, but I got " + maxflushes;
// We can't possibly flush more entries than size().
maxflushes = Math.min(maxflushes, size());
if (maxflushes == 0) { // Because size() might be 0.
... | java | private Deferred<ArrayList<Object>> flush(final long cut_off, int maxflushes) {
assert maxflushes > 0: "maxflushes must be > 0, but I got " + maxflushes;
// We can't possibly flush more entries than size().
maxflushes = Math.min(maxflushes, size());
if (maxflushes == 0) { // Because size() might be 0.
... | [
"private",
"Deferred",
"<",
"ArrayList",
"<",
"Object",
">",
">",
"flush",
"(",
"final",
"long",
"cut_off",
",",
"int",
"maxflushes",
")",
"{",
"assert",
"maxflushes",
">",
"0",
":",
"\"maxflushes must be > 0, but I got \"",
"+",
"maxflushes",
";",
"// We can't ... | Flushes all the rows in the compaction queue older than the cutoff time.
@param cut_off A UNIX timestamp in seconds (unsigned 32-bit integer).
@param maxflushes How many rows to flush off the queue at once.
This integer is expected to be strictly positive.
@return A deferred that will be called back once everything has... | [
"Flushes",
"all",
"the",
"rows",
"in",
"the",
"compaction",
"queue",
"older",
"than",
"the",
"cutoff",
"time",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/CompactionQueue.java#L165-L225 |
13,684 | OpenTSDB/opentsdb | src/tsd/AnnotationRpc.java | AnnotationRpc.executeBulk | void executeBulk(final TSDB tsdb, final HttpMethod method, HttpQuery query) {
if (method == HttpMethod.POST || method == HttpMethod.PUT) {
executeBulkUpdate(tsdb, method, query);
} else if (method == HttpMethod.DELETE) {
executeBulkDelete(tsdb, query);
} else {
throw new BadRequestExceptio... | java | void executeBulk(final TSDB tsdb, final HttpMethod method, HttpQuery query) {
if (method == HttpMethod.POST || method == HttpMethod.PUT) {
executeBulkUpdate(tsdb, method, query);
} else if (method == HttpMethod.DELETE) {
executeBulkDelete(tsdb, query);
} else {
throw new BadRequestExceptio... | [
"void",
"executeBulk",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"HttpMethod",
"method",
",",
"HttpQuery",
"query",
")",
"{",
"if",
"(",
"method",
"==",
"HttpMethod",
".",
"POST",
"||",
"method",
"==",
"HttpMethod",
".",
"PUT",
")",
"{",
"executeBulkUpda... | Performs CRUD methods on a list of annotation objects to reduce calls to
the API.
@param tsdb The TSD to which we belong
@param method The request method
@param query The query to parse and respond to | [
"Performs",
"CRUD",
"methods",
"on",
"a",
"list",
"of",
"annotation",
"objects",
"to",
"reduce",
"calls",
"to",
"the",
"API",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/AnnotationRpc.java#L143-L153 |
13,685 | OpenTSDB/opentsdb | src/tsd/AnnotationRpc.java | AnnotationRpc.executeBulkUpdate | void executeBulkUpdate(final TSDB tsdb, final HttpMethod method, HttpQuery query) {
final List<Annotation> notes;
try {
notes = query.serializer().parseAnnotationsV1();
} catch (IllegalArgumentException e){
throw new BadRequestException(e);
} catch (JSONException e){
throw new BadReque... | java | void executeBulkUpdate(final TSDB tsdb, final HttpMethod method, HttpQuery query) {
final List<Annotation> notes;
try {
notes = query.serializer().parseAnnotationsV1();
} catch (IllegalArgumentException e){
throw new BadRequestException(e);
} catch (JSONException e){
throw new BadReque... | [
"void",
"executeBulkUpdate",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"HttpMethod",
"method",
",",
"HttpQuery",
"query",
")",
"{",
"final",
"List",
"<",
"Annotation",
">",
"notes",
";",
"try",
"{",
"notes",
"=",
"query",
".",
"serializer",
"(",
")",
"... | Performs CRU methods on a list of annotation objects to reduce calls to
the API. Only supports body content and adding or updating annotation
objects. Deletions are separate.
@param tsdb The TSD to which we belong
@param method The request method
@param query The query to parse and respond to | [
"Performs",
"CRU",
"methods",
"on",
"a",
"list",
"of",
"annotation",
"objects",
"to",
"reduce",
"calls",
"to",
"the",
"API",
".",
"Only",
"supports",
"body",
"content",
"and",
"adding",
"or",
"updating",
"annotation",
"objects",
".",
"Deletions",
"are",
"sep... | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/AnnotationRpc.java#L163-L242 |
13,686 | OpenTSDB/opentsdb | src/tsd/AnnotationRpc.java | AnnotationRpc.parseBulkDeleteQS | private AnnotationBulkDelete parseBulkDeleteQS(final HttpQuery query) {
final AnnotationBulkDelete settings = new AnnotationBulkDelete();
settings.start_time = query.getRequiredQueryStringParam("start_time");
settings.end_time = query.getQueryStringParam("end_time");
if (query.hasQueryStringParam("... | java | private AnnotationBulkDelete parseBulkDeleteQS(final HttpQuery query) {
final AnnotationBulkDelete settings = new AnnotationBulkDelete();
settings.start_time = query.getRequiredQueryStringParam("start_time");
settings.end_time = query.getQueryStringParam("end_time");
if (query.hasQueryStringParam("... | [
"private",
"AnnotationBulkDelete",
"parseBulkDeleteQS",
"(",
"final",
"HttpQuery",
"query",
")",
"{",
"final",
"AnnotationBulkDelete",
"settings",
"=",
"new",
"AnnotationBulkDelete",
"(",
")",
";",
"settings",
".",
"start_time",
"=",
"query",
".",
"getRequiredQueryStr... | Parses a query string for a bulk delet request
@param query The query to parse
@return A bulk delete query | [
"Parses",
"a",
"query",
"string",
"for",
"a",
"bulk",
"delet",
"request"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/AnnotationRpc.java#L377-L394 |
13,687 | OpenTSDB/opentsdb | src/search/SearchQuery.java | SearchQuery.parseSearchType | public static SearchType parseSearchType(final String type) {
if (type == null || type.isEmpty()) {
throw new IllegalArgumentException("Type provided was null or empty");
}
if (type.toLowerCase().equals("tsmeta")) {
return SearchType.TSMETA;
} else if (type.toLowerCase().equals("tsmeta_... | java | public static SearchType parseSearchType(final String type) {
if (type == null || type.isEmpty()) {
throw new IllegalArgumentException("Type provided was null or empty");
}
if (type.toLowerCase().equals("tsmeta")) {
return SearchType.TSMETA;
} else if (type.toLowerCase().equals("tsmeta_... | [
"public",
"static",
"SearchType",
"parseSearchType",
"(",
"final",
"String",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
"||",
"type",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Type provided was null or empty\... | Converts the human readable string to the proper enum
@param type The string to parse
@return The parsed enum
@throws IllegalArgumentException if the type is missing or wsa not
recognized | [
"Converts",
"the",
"human",
"readable",
"string",
"to",
"the",
"proper",
"enum"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/search/SearchQuery.java#L156-L176 |
13,688 | OpenTSDB/opentsdb | src/core/RateSpan.java | RateSpan.populateNextRate | private void populateNextRate() {
final MutableDataPoint prev_data = new MutableDataPoint();
if (source.hasNext()) {
prev_data.reset(next_data);
next_data.reset(source.next());
final long t0 = prev_data.timestamp();
final long t1 = next_data.timestamp();
if (t1 <= t0) {
... | java | private void populateNextRate() {
final MutableDataPoint prev_data = new MutableDataPoint();
if (source.hasNext()) {
prev_data.reset(next_data);
next_data.reset(source.next());
final long t0 = prev_data.timestamp();
final long t1 = next_data.timestamp();
if (t1 <= t0) {
... | [
"private",
"void",
"populateNextRate",
"(",
")",
"{",
"final",
"MutableDataPoint",
"prev_data",
"=",
"new",
"MutableDataPoint",
"(",
")",
";",
"if",
"(",
"source",
".",
"hasNext",
"(",
")",
")",
"{",
"prev_data",
".",
"reset",
"(",
"next_data",
")",
";",
... | Populate the next rate. | [
"Populate",
"the",
"next",
"rate",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/RateSpan.java#L121-L180 |
13,689 | OpenTSDB/opentsdb | src/uid/UniqueId.java | UniqueId.cacheSize | public long cacheSize() {
if (use_lru) {
return (int) (lru_name_cache.size() + lru_id_cache.size());
}
return name_cache.size() + id_cache.size();
} | java | public long cacheSize() {
if (use_lru) {
return (int) (lru_name_cache.size() + lru_id_cache.size());
}
return name_cache.size() + id_cache.size();
} | [
"public",
"long",
"cacheSize",
"(",
")",
"{",
"if",
"(",
"use_lru",
")",
"{",
"return",
"(",
"int",
")",
"(",
"lru_name_cache",
".",
"size",
"(",
")",
"+",
"lru_id_cache",
".",
"size",
"(",
")",
")",
";",
"}",
"return",
"name_cache",
".",
"size",
"... | Returns the number of elements stored in the internal cache. | [
"Returns",
"the",
"number",
"of",
"elements",
"stored",
"in",
"the",
"internal",
"cache",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L249-L254 |
13,690 | OpenTSDB/opentsdb | src/uid/UniqueId.java | UniqueId.dropCaches | public void dropCaches() {
if (use_lru) {
lru_name_cache.invalidateAll();
lru_id_cache.invalidateAll();
} else {
name_cache.clear();
id_cache.clear();
}
} | java | public void dropCaches() {
if (use_lru) {
lru_name_cache.invalidateAll();
lru_id_cache.invalidateAll();
} else {
name_cache.clear();
id_cache.clear();
}
} | [
"public",
"void",
"dropCaches",
"(",
")",
"{",
"if",
"(",
"use_lru",
")",
"{",
"lru_name_cache",
".",
"invalidateAll",
"(",
")",
";",
"lru_id_cache",
".",
"invalidateAll",
"(",
")",
";",
"}",
"else",
"{",
"name_cache",
".",
"clear",
"(",
")",
";",
"id_... | Causes this instance to discard all its in-memory caches.
@since 1.1 | [
"Causes",
"this",
"instance",
"to",
"discard",
"all",
"its",
"in",
"-",
"memory",
"caches",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L317-L325 |
13,691 | OpenTSDB/opentsdb | src/uid/UniqueId.java | UniqueId.getNameAsync | public Deferred<String> getNameAsync(final byte[] id) {
if (id.length != id_width) {
throw new IllegalArgumentException("Wrong id.length = " + id.length
+ " which is != " + id_width
+ " required for '" + kind() + '\'');
}
... | java | public Deferred<String> getNameAsync(final byte[] id) {
if (id.length != id_width) {
throw new IllegalArgumentException("Wrong id.length = " + id.length
+ " which is != " + id_width
+ " required for '" + kind() + '\'');
}
... | [
"public",
"Deferred",
"<",
"String",
">",
"getNameAsync",
"(",
"final",
"byte",
"[",
"]",
"id",
")",
"{",
"if",
"(",
"id",
".",
"length",
"!=",
"id_width",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Wrong id.length = \"",
"+",
"id",
".",... | Finds the name associated with a given ID.
@param id The ID associated with that name.
@see #getId(String)
@see #getOrCreateIdAsync(String)
@throws NoSuchUniqueId if the given ID is not assigned.
@throws HBaseException if there is a problem communicating with HBase.
@throws IllegalArgumentException if the ID given in ... | [
"Finds",
"the",
"name",
"associated",
"with",
"a",
"given",
"ID",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L362-L398 |
13,692 | OpenTSDB/opentsdb | src/uid/UniqueId.java | UniqueId.cacheMapping | private void cacheMapping(final String name, final byte[] id) {
addIdToCache(name, id);
addNameToCache(id, name);
} | java | private void cacheMapping(final String name, final byte[] id) {
addIdToCache(name, id);
addNameToCache(id, name);
} | [
"private",
"void",
"cacheMapping",
"(",
"final",
"String",
"name",
",",
"final",
"byte",
"[",
"]",
"id",
")",
"{",
"addIdToCache",
"(",
"name",
",",
"id",
")",
";",
"addNameToCache",
"(",
"id",
",",
"name",
")",
";",
"}"
] | Adds the bidirectional mapping in the cache. | [
"Adds",
"the",
"bidirectional",
"mapping",
"in",
"the",
"cache",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L764-L767 |
13,693 | OpenTSDB/opentsdb | src/uid/UniqueId.java | UniqueId.getSuggestScanner | private static Scanner getSuggestScanner(final HBaseClient client,
final byte[] tsd_uid_table, final String search,
final byte[] kind_or_null, final int max_results) {
final byte[] start_row;
final byte[] end_row;
if (search.isEmpty()) {
start_row = START_ROW;
end_row = END_ROW;
... | java | private static Scanner getSuggestScanner(final HBaseClient client,
final byte[] tsd_uid_table, final String search,
final byte[] kind_or_null, final int max_results) {
final byte[] start_row;
final byte[] end_row;
if (search.isEmpty()) {
start_row = START_ROW;
end_row = END_ROW;
... | [
"private",
"static",
"Scanner",
"getSuggestScanner",
"(",
"final",
"HBaseClient",
"client",
",",
"final",
"byte",
"[",
"]",
"tsd_uid_table",
",",
"final",
"String",
"search",
",",
"final",
"byte",
"[",
"]",
"kind_or_null",
",",
"final",
"int",
"max_results",
"... | Creates a scanner that scans the right range of rows for suggestions.
@param client The HBase client to use.
@param tsd_uid_table Table where IDs are stored.
@param search The string to start searching at
@param kind_or_null The kind of UID to search or null for any kinds.
@param max_results The max number of results t... | [
"Creates",
"a",
"scanner",
"that",
"scans",
"the",
"right",
"range",
"of",
"rows",
"for",
"suggestions",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L1313-L1335 |
13,694 | OpenTSDB/opentsdb | src/uid/UniqueId.java | UniqueId.hbasePutWithRetry | private void hbasePutWithRetry(final PutRequest put, short attempts, short wait)
throws HBaseException {
put.setBufferable(false); // TODO(tsuna): Remove once this code is async.
while (attempts-- > 0) {
try {
client.put(put).joinUninterruptibly();
return;
} catch (HBaseExceptio... | java | private void hbasePutWithRetry(final PutRequest put, short attempts, short wait)
throws HBaseException {
put.setBufferable(false); // TODO(tsuna): Remove once this code is async.
while (attempts-- > 0) {
try {
client.put(put).joinUninterruptibly();
return;
} catch (HBaseExceptio... | [
"private",
"void",
"hbasePutWithRetry",
"(",
"final",
"PutRequest",
"put",
",",
"short",
"attempts",
",",
"short",
"wait",
")",
"throws",
"HBaseException",
"{",
"put",
".",
"setBufferable",
"(",
"false",
")",
";",
"// TODO(tsuna): Remove once this code is async.",
"... | Attempts to run the PutRequest given in argument, retrying if needed.
Puts are synchronized.
@param put The PutRequest to execute.
@param attempts The maximum number of attempts.
@param wait The initial amount of time in ms to sleep for after a
failure. This amount is doubled after each failed attempt.
@throws HBase... | [
"Attempts",
"to",
"run",
"the",
"PutRequest",
"given",
"in",
"argument",
"retrying",
"if",
"needed",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L1364-L1389 |
13,695 | OpenTSDB/opentsdb | src/uid/UniqueId.java | UniqueId.uidToLong | public static long uidToLong(final byte[] uid, final short uid_length) {
if (uid.length != uid_length) {
throw new IllegalArgumentException("UID was " + uid.length
+ " bytes long but expected to be " + uid_length);
}
final byte[] uid_raw = new byte[8];
System.arraycopy(uid, 0, uid_... | java | public static long uidToLong(final byte[] uid, final short uid_length) {
if (uid.length != uid_length) {
throw new IllegalArgumentException("UID was " + uid.length
+ " bytes long but expected to be " + uid_length);
}
final byte[] uid_raw = new byte[8];
System.arraycopy(uid, 0, uid_... | [
"public",
"static",
"long",
"uidToLong",
"(",
"final",
"byte",
"[",
"]",
"uid",
",",
"final",
"short",
"uid_length",
")",
"{",
"if",
"(",
"uid",
".",
"length",
"!=",
"uid_length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"UID was \"",
"... | Converts a UID to an integer value. The array must be the same length as
uid_length or an exception will be thrown.
@param uid The byte array to convert
@param uid_length Length the array SHOULD be according to the UID config
@return The UID converted to an integer
@throws IllegalArgumentException if the length of the ... | [
"Converts",
"a",
"UID",
"to",
"an",
"integer",
"value",
".",
"The",
"array",
"must",
"be",
"the",
"same",
"length",
"as",
"uid_length",
"or",
"an",
"exception",
"will",
"be",
"thrown",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L1457-L1466 |
13,696 | OpenTSDB/opentsdb | src/uid/UniqueId.java | UniqueId.longToUID | public static byte[] longToUID(final long uid, final short width) {
// Verify that we're going to drop bytes that are 0.
final byte[] padded = Bytes.fromLong(uid);
for (int i = 0; i < padded.length - width; i++) {
if (padded[i] != 0) {
final String message = "UID " + Long.toString(uid) +
... | java | public static byte[] longToUID(final long uid, final short width) {
// Verify that we're going to drop bytes that are 0.
final byte[] padded = Bytes.fromLong(uid);
for (int i = 0; i < padded.length - width; i++) {
if (padded[i] != 0) {
final String message = "UID " + Long.toString(uid) +
... | [
"public",
"static",
"byte",
"[",
"]",
"longToUID",
"(",
"final",
"long",
"uid",
",",
"final",
"short",
"width",
")",
"{",
"// Verify that we're going to drop bytes that are 0.",
"final",
"byte",
"[",
"]",
"padded",
"=",
"Bytes",
".",
"fromLong",
"(",
"uid",
")... | Converts a Long to a byte array with the proper UID width
@param uid The UID to convert
@param width The width of the UID in bytes
@return The UID as a byte array
@throws IllegalStateException if the UID is larger than the width would
allow
@since 2.1 | [
"Converts",
"a",
"Long",
"to",
"a",
"byte",
"array",
"with",
"the",
"proper",
"UID",
"width"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L1477-L1490 |
13,697 | OpenTSDB/opentsdb | src/uid/UniqueId.java | UniqueId.addIdToRegexp | public static void addIdToRegexp(final StringBuilder buf, final byte[] id) {
boolean backslash = false;
for (final byte b : id) {
buf.append((char) (b & 0xFF));
if (b == 'E' && backslash) { // If we saw a `\' and now we have a `E'.
// So we just terminated the quoted section because we just... | java | public static void addIdToRegexp(final StringBuilder buf, final byte[] id) {
boolean backslash = false;
for (final byte b : id) {
buf.append((char) (b & 0xFF));
if (b == 'E' && backslash) { // If we saw a `\' and now we have a `E'.
// So we just terminated the quoted section because we just... | [
"public",
"static",
"void",
"addIdToRegexp",
"(",
"final",
"StringBuilder",
"buf",
",",
"final",
"byte",
"[",
"]",
"id",
")",
"{",
"boolean",
"backslash",
"=",
"false",
";",
"for",
"(",
"final",
"byte",
"b",
":",
"id",
")",
"{",
"buf",
".",
"append",
... | Appends the given UID to the given string buffer, followed by "\\E".
@param buf The buffer to append
@param id The UID to add as a binary regex pattern
@since 2.1 | [
"Appends",
"the",
"given",
"UID",
"to",
"the",
"given",
"string",
"buffer",
"followed",
"by",
"\\\\",
"E",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L1498-L1511 |
13,698 | OpenTSDB/opentsdb | src/uid/UniqueId.java | UniqueId.stringToUniqueIdType | public static UniqueIdType stringToUniqueIdType(final String type) {
if (type.toLowerCase().equals("metric") ||
type.toLowerCase().equals("metrics")) {
return UniqueIdType.METRIC;
} else if (type.toLowerCase().equals("tagk")) {
return UniqueIdType.TAGK;
} else if (type.toLowerCase().equ... | java | public static UniqueIdType stringToUniqueIdType(final String type) {
if (type.toLowerCase().equals("metric") ||
type.toLowerCase().equals("metrics")) {
return UniqueIdType.METRIC;
} else if (type.toLowerCase().equals("tagk")) {
return UniqueIdType.TAGK;
} else if (type.toLowerCase().equ... | [
"public",
"static",
"UniqueIdType",
"stringToUniqueIdType",
"(",
"final",
"String",
"type",
")",
"{",
"if",
"(",
"type",
".",
"toLowerCase",
"(",
")",
".",
"equals",
"(",
"\"metric\"",
")",
"||",
"type",
".",
"toLowerCase",
"(",
")",
".",
"equals",
"(",
... | Attempts to convert the given string to a type enumerator
@param type The string to convert
@return a valid UniqueIdType if matched
@throws IllegalArgumentException if the string did not match a type
@since 2.0 | [
"Attempts",
"to",
"convert",
"the",
"given",
"string",
"to",
"a",
"type",
"enumerator"
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L1520-L1531 |
13,699 | OpenTSDB/opentsdb | src/uid/UniqueId.java | UniqueId.getTSUIDFromKey | public static byte[] getTSUIDFromKey(final byte[] row_key,
final short metric_width, final short timestamp_width) {
int idx = 0;
// validation
final int tag_pair_width = TSDB.tagk_width() + TSDB.tagv_width();
final int tags_length = row_key.length -
(Const.SALT_WIDTH() + metric_width + t... | java | public static byte[] getTSUIDFromKey(final byte[] row_key,
final short metric_width, final short timestamp_width) {
int idx = 0;
// validation
final int tag_pair_width = TSDB.tagk_width() + TSDB.tagv_width();
final int tags_length = row_key.length -
(Const.SALT_WIDTH() + metric_width + t... | [
"public",
"static",
"byte",
"[",
"]",
"getTSUIDFromKey",
"(",
"final",
"byte",
"[",
"]",
"row_key",
",",
"final",
"short",
"metric_width",
",",
"final",
"short",
"timestamp_width",
")",
"{",
"int",
"idx",
"=",
"0",
";",
"// validation",
"final",
"int",
"ta... | Extracts the TSUID from a storage row key that includes the timestamp.
@param row_key The row key to process
@param metric_width The width of the metric
@param timestamp_width The width of the timestamp
@return The TSUID as a byte array
@throws IllegalArgumentException if the row key is missing tags or it is
corrupt su... | [
"Extracts",
"the",
"TSUID",
"from",
"a",
"storage",
"row",
"key",
"that",
"includes",
"the",
"timestamp",
"."
] | 3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3 | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L1575-L1596 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.