_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q31200 | Config.getBoolean | train | public final boolean getBoolean(final String property) {
final String val = properties.get(property).trim().toUpperCase();
if (val.equals("1"))
return true;
if (val.equals("TRUE"))
return true;
if (val.equals("YES"))
return true;
return false;
} | java | {
"resource": ""
} |
q31201 | Config.getDirectoryName | train | public final String getDirectoryName(final String property) {
String directory = properties.get(property);
if (directory == null || directory.isEmpty()){
return null;
}
if (IS_WINDOWS) {
// Windows swings both ways. If a forward slash was already used, we'll
// add one at the end if mi... | java | {
"resource": ""
} |
q31202 | Config.hasProperty | train | public final boolean hasProperty(final String property) {
final String val = properties.get(property);
if (val == null)
return false;
if (val.isEmpty())
return false;
return true;
} | java | {
"resource": ""
} |
q31203 | Config.dumpConfiguration | train | public final String dumpConfiguration() {
if (properties.isEmpty())
return "No configuration settings stored";
StringBuilder response = new StringBuilder("TSD Configuration:\n");
response.append("File [" + config_location + "]\n");
int line = 0;
for (Map.Entry<String, String> entry : properti... | java | {
"resource": ""
} |
q31204 | Config.loadConfig | train | protected void loadConfig() throws IOException {
if (config_location != null && !config_location.isEmpty()) {
loadConfig(config_location);
return;
}
final ArrayList<String> file_locations = new ArrayList<String>();
// search locally first
file_locations.add("opentsdb.conf");
// ad... | java | {
"resource": ""
} |
q31205 | Config.loadConfig | train | protected void loadConfig(final String file) throws FileNotFoundException,
IOException {
final FileInputStream file_stream = new FileInputStream(file);
try {
final Properties props = new Properties();
props.load(file_stream);
// load the hash map
loadHashMap(props);
// no e... | java | {
"resource": ""
} |
q31206 | Config.loadStaticVariables | train | public void loadStaticVariables() {
auto_metric = this.getBoolean("tsd.core.auto_create_metrics");
auto_tagk = this.getBoolean("tsd.core.auto_create_tagks");
auto_tagv = this.getBoolean("tsd.core.auto_create_tagvs");
enable_compactions = this.getBoolean("tsd.storage.enable_compaction");
enable_appen... | java | {
"resource": ""
} |
q31207 | QueryString.add | train | public void add(final String name, final String value) {
ArrayList<String> values = super.get(name);
if (values == null) {
values = new ArrayList<String>(1); // Often there's only 1 value.
super.put(name, values);
}
values.add(value);
} | java | {
"resource": ""
} |
q31208 | HttpSerializer.formatPutV1 | train | public ChannelBuffer formatPutV1(final Map<String, Object> results) {
throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED,
"The requested API endpoint has not been implemented",
this.getClass().getCanonicalName() +
" has not implemented formatPutV1");
} | java | {
"resource": ""
} |
q31209 | HttpSerializer.formatSuggestV1 | train | public ChannelBuffer formatSuggestV1(final List<String> suggestions) {
throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED,
"The requested API endpoint has not been implemented",
this.getClass().getCanonicalName() +
" has not implemented formatSuggestV1");
} | java | {
"resource": ""
} |
q31210 | HttpSerializer.formatAggregatorsV1 | train | public ChannelBuffer formatAggregatorsV1(final Set<String> aggregators) {
throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED,
"The requested API endpoint has not been implemented",
this.getClass().getCanonicalName() +
" has not implemented formatAggregatorsV1");
} | java | {
"resource": ""
} |
q31211 | HttpSerializer.formatVersionV1 | train | public ChannelBuffer formatVersionV1(final Map<String, String> version) {
throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED,
"The requested API endpoint has not been implemented",
this.getClass().getCanonicalName() +
" has not implemented formatVersionV1");
} | java | {
"resource": ""
} |
q31212 | HttpSerializer.formatDropCachesV1 | train | public ChannelBuffer formatDropCachesV1(final Map<String, String> response) {
throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED,
"The requested API endpoint has not been implemented",
this.getClass().getCanonicalName() +
" has not implemented formatDropCachesV1");
} | java | {
"resource": ""
} |
q31213 | HttpSerializer.formatLastPointQueryV1 | train | public ChannelBuffer formatLastPointQueryV1(
final List<IncomingDataPoint> data_points) {
throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED,
"The requested API endpoint has not been implemented",
this.getClass().getCanonicalName() +
" has not implemented formatLastPoi... | java | {
"resource": ""
} |
q31214 | HttpSerializer.formatTSMetaListV1 | train | public ChannelBuffer formatTSMetaListV1(final List<TSMeta> metas) {
throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED,
"The requested API endpoint has not been implemented",
this.getClass().getCanonicalName() +
" has not implemented formatTSMetaV1");
} | java | {
"resource": ""
} |
q31215 | HttpSerializer.formatTreesV1 | train | public ChannelBuffer formatTreesV1(final List<Tree> trees) {
throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED,
"The requested API endpoint has not been implemented",
this.getClass().getCanonicalName() +
" has not implemented formatTreesV1");
} | java | {
"resource": ""
} |
q31216 | HttpSerializer.formatTreeCollisionNotMatchedV1 | train | public ChannelBuffer formatTreeCollisionNotMatchedV1(
final Map<String, String> results, final boolean is_collisions) {
throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED,
"The requested API endpoint has not been implemented",
this.getClass().getCanonicalName() +
" has... | java | {
"resource": ""
} |
q31217 | HttpSerializer.formatAnnotationsV1 | train | public ChannelBuffer formatAnnotationsV1(final List<Annotation> notes) {
throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED,
"The requested API endpoint has not been implemented",
this.getClass().getCanonicalName() +
" has not implemented formatAnnotationsV1");
} | java | {
"resource": ""
} |
q31218 | HttpSerializer.formatStatsV1 | train | public ChannelBuffer formatStatsV1(final List<IncomingDataPoint> stats) {
throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED,
"The requested API endpoint has not been implemented",
this.getClass().getCanonicalName() +
" has not implemented formatStatsV1");
} | java | {
"resource": ""
} |
q31219 | HttpSerializer.formatThreadStatsV1 | train | public ChannelBuffer formatThreadStatsV1(final List<Map<String, Object>> stats) {
throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED,
"The requested API endpoint has not been implemented",
this.getClass().getCanonicalName() +
" has not implemented formatThreadStatsV1");
} | java | {
"resource": ""
} |
q31220 | HttpSerializer.formatQueryStatsV1 | train | public ChannelBuffer formatQueryStatsV1(final Map<String, Object> query_stats) {
throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED,
"The requested API endpoint has not been implemented",
this.getClass().getCanonicalName() +
" has not implemented formatQueryStatsV1");
} | java | {
"resource": ""
} |
q31221 | DateTime.getDurationUnits | train | public static final String getDurationUnits(final String duration) {
if (duration == null || duration.isEmpty()) {
throw new IllegalArgumentException("Duration cannot be null or empty");
}
int unit = 0;
while (unit < duration.length() &&
Character.isDigit(duration.charAt(unit))) {
u... | java | {
"resource": ""
} |
q31222 | DateTime.getDurationInterval | train | public static final int getDurationInterval(final String duration) {
if (duration == null || duration.isEmpty()) {
throw new IllegalArgumentException("Duration cannot be null or empty");
}
if (duration.contains(".")) {
throw new IllegalArgumentException("Floating point intervals are not supporte... | java | {
"resource": ""
} |
q31223 | DateTime.setTimeZone | train | public static void setTimeZone(final SimpleDateFormat fmt,
final String tzname) {
if (tzname == null) {
return; // Use the default timezone.
}
final TimeZone tz = DateTime.timezones.get(tzname);
if (tz != null) {
fmt.setTimeZone(tz);
} else {
thro... | java | {
"resource": ""
} |
q31224 | DateTime.msFromNanoDiff | train | public static double msFromNanoDiff(final long end, final long start) {
if (end < start) {
throw new IllegalArgumentException("End (" + end + ") cannot be less "
+ "than start (" + start + ")");
}
return ((double) end - (double) start) / 1000000;
} | java | {
"resource": ""
} |
q31225 | DateTime.unitsToCalendarType | train | public static int unitsToCalendarType(final String units) {
if (units == null || units.isEmpty()) {
throw new IllegalArgumentException("Units cannot be null or empty");
}
final String lc = units.toLowerCase();
if (lc.equals("ms")) {
return Calendar.MILLISECOND;
} else if (lc.equals(... | java | {
"resource": ""
} |
q31226 | Output.validate | train | @Override public void validate() {
if (id == null || id.isEmpty()) {
throw new IllegalArgumentException("missing or empty id");
}
Query.validateId(id);
} | java | {
"resource": ""
} |
q31227 | Aggregators.get | train | public static Aggregator get(final String name) {
final Aggregator agg = aggregators.get(name);
if (agg != null) {
return agg;
}
throw new NoSuchElementException("No such aggregator: " + name);
} | java | {
"resource": ""
} |
q31228 | Annotation.delete | train | public Deferred<Object> delete(final TSDB tsdb) {
if (start_time < 1) {
throw new IllegalArgumentException("The start timestamp has not been set");
}
final byte[] tsuid_byte = tsuid != null && !tsuid.isEmpty() ?
UniqueId.stringToUid(tsuid) : null;
final DeleteRequest delete = new Del... | java | {
"resource": ""
} |
q31229 | Annotation.getAnnotation | train | public static Deferred<Annotation> getAnnotation(final TSDB tsdb,
final long start_time) {
return getAnnotation(tsdb, (byte[])null, start_time);
} | java | {
"resource": ""
} |
q31230 | Annotation.getGlobalAnnotations | train | public static Deferred<List<Annotation>> getGlobalAnnotations(final TSDB tsdb,
final long start_time, final long end_time) {
if (end_time < 1) {
throw new IllegalArgumentException("The end timestamp has not been set");
}
if (end_time < start_time) {
throw new IllegalArgumentException(
... | java | {
"resource": ""
} |
q31231 | Annotation.timeFromQualifier | train | private static long timeFromQualifier(final byte[] qualifier,
final long base_time) {
final long offset;
if (qualifier.length == 3) {
offset = Bytes.getUnsignedShort(qualifier, 1);
return (base_time + offset) * 1000;
} else {
offset = Bytes.getUnsignedInt(qualifier, 1);
return... | java | {
"resource": ""
} |
q31232 | IncomingDataPoints.checkMetricAndTags | train | static void checkMetricAndTags(final String metric,
final Map<String, String> tags) {
if (tags.size() <= 0) {
throw new IllegalArgumentException("Need at least one tag (metric="
+ metric + ", tags=" + tags + ')');
} else if (tags.size() > Const.MAX_NUM_TAGS()) {
throw new IllegalArgu... | java | {
"resource": ""
} |
q31233 | IncomingDataPoints.copyInRowKey | train | private static void copyInRowKey(final byte[] row, final short offset,
final byte[] bytes) {
System.arraycopy(bytes, 0, row, offset, bytes.length);
} | java | {
"resource": ""
} |
q31234 | IncomingDataPoints.updateBaseTime | train | private long updateBaseTime(final long timestamp) {
// We force the starting timestamp to be on a MAX_TIMESPAN boundary
// so that all TSDs create rows with the same base time. Otherwise
// we'd need to coordinate TSDs to avoid creating rows that cover
// overlapping time periods.
final long base_ti... | java | {
"resource": ""
} |
q31235 | ExpressionFactory.addTSDBFunctions | train | public static void addTSDBFunctions(final TSDB tsdb) {
available_functions.put("divideSeries", new DivideSeries(tsdb));
available_functions.put("divide", new DivideSeries(tsdb));
available_functions.put("sumSeries", new SumSeries(tsdb));
available_functions.put("sum", new SumSeries(tsdb));
available... | java | {
"resource": ""
} |
q31236 | ExpressionFactory.getByName | train | public static Expression getByName(final String function) {
final Expression expression = available_functions.get(function);
if (expression == null) {
throw new UnsupportedOperationException("Function " + function
+ " has not been implemented");
}
return expression;
} | java | {
"resource": ""
} |
q31237 | RollupSeq.setRow | train | public void setRow(final KeyValue column) {
//This api will be called only with the KeyValues from rollup table, as per
//the scan logic
if (key != null) {
throw new IllegalStateException("setRow was already called on " + this);
}
key = column.key();
//Check whether the cell is g... | java | {
"resource": ""
} |
q31238 | Search.main | train | public static void main(String[] args) throws Exception {
ArgP argp = new ArgP();
CliOptions.addCommon(argp);
argp.addOption("--use-data-table",
"Scan against the raw data table instead of the meta data table.");
args = CliOptions.parse(argp, args);
if (args == null) {
usage(argp, "Inv... | java | {
"resource": ""
} |
q31239 | Search.runCommand | train | private static int runCommand(final TSDB tsdb,
final boolean use_data_table,
final String[] args) throws Exception {
final int nargs = args.length;
if (args[0].equals("lookup")) {
if (nargs < 2) { // need a query
usage(null, "Not enou... | java | {
"resource": ""
} |
q31240 | PutDataPointRpc.importDataPoint | train | protected Deferred<Object> importDataPoint(final TSDB tsdb,
final String[] words) {
words[0] = null; // Ditch the "put".
if (words.length < 5) { // Need at least: metric timestamp value tag
// ^ 5 and not 4 because words[0] is "put".
throw... | java | {
"resource": ""
} |
q31241 | PutDataPointRpc.getHttpDetails | train | final private HashMap<String, Object> getHttpDetails(final String message,
final IncomingDataPoint dp) {
final HashMap<String, Object> map = new HashMap<String, Object>();
map.put("error", message);
map.put("datapoint", dp);
return map;
} | java | {
"resource": ""
} |
q31242 | PutDataPointRpc.handleStorageException | train | void handleStorageException(final TSDB tsdb, final IncomingDataPoint dp,
final Exception e) {
final StorageExceptionHandler handler = tsdb.getStorageExceptionHandler();
if (handler != null) {
handler.handleError(dp, e);
}
} | java | {
"resource": ""
} |
q31243 | ArgP.addOption | train | public void addOption(final String name,
final String meta,
final String help) {
if (name.isEmpty()) {
throw new IllegalArgumentException("empty name");
} else if (name.charAt(0) != '-') {
throw new IllegalArgumentException("name must start with a `-':... | java | {
"resource": ""
} |
q31244 | ArgP.parse | train | public String[] parse(final String[] args) {
parsed = new HashMap<String, String>(options.size());
ArrayList<String> unparsed = null;
for (int i = 0; i < args.length; i++) {
final String arg = args[i];
String[] opt = options.get(arg);
if (opt != null) { // Perfect match: got --foo
... | java | {
"resource": ""
} |
q31245 | ArgP.get | train | public String get(final String name, final String defaultv) {
final String value = get(name);
return value == null ? defaultv : value;
} | java | {
"resource": ""
} |
q31246 | ArgP.has | train | public boolean has(final String name) {
if (!options.containsKey(name)) {
throw new IllegalArgumentException("Unknown option " + name);
} else if (parsed == null) {
throw new IllegalStateException("parse() wasn't called");
}
return parsed.containsKey(name);
} | java | {
"resource": ""
} |
q31247 | ArgP.addUsageTo | train | public void addUsageTo(final StringBuilder buf) {
final ArrayList<String> names = new ArrayList<String>(options.keySet());
Collections.sort(names);
int max_length = 0;
for (final String name : names) {
final String[] opt = options.get(name);
final int length = name.length()
+ (opt[0]... | java | {
"resource": ""
} |
q31248 | ArgP.usage | train | public String usage() {
final StringBuilder buf = new StringBuilder(16 * options.size());
addUsageTo(buf);
return buf.toString();
} | java | {
"resource": ""
} |
q31249 | TextImporter.open | train | private static BufferedReader open(final String path) throws IOException {
if (path.equals("-")) {
return new BufferedReader(new InputStreamReader(System.in));
}
InputStream is = new FileInputStream(path);
if (path.endsWith(".gz")) {
is = new GZIPInputStream(is);
}
// I <3 Java's IO... | java | {
"resource": ""
} |
q31250 | Expression.validate | train | public void validate() {
if (id == null || id.isEmpty()) {
throw new IllegalArgumentException("missing or empty id");
}
Query.validateId(id);
if (expr == null || expr.isEmpty()) {
throw new IllegalArgumentException("missing or empty expr");
}
// parse it just to make sure w... | java | {
"resource": ""
} |
q31251 | CliOptions.parse | train | static String[] parse(final ArgP argp, String[] args) {
try {
args = argp.parse(args);
} catch (IllegalArgumentException e) {
System.err.println("Invalid usage. " + e.getMessage());
System.exit(2);
}
honorVerboseFlag(argp);
return args;
} | java | {
"resource": ""
} |
q31252 | CliOptions.getConfig | train | static final Config getConfig(final ArgP argp) throws IOException {
// load configuration
final Config config;
final String config_file = argp.get("--config", "");
if (!config_file.isEmpty())
config = new Config(config_file);
else
config = new Config(true);
// load CLI overloads
... | java | {
"resource": ""
} |
q31253 | ConfigArgP.loadConfigSource | train | protected static void loadConfigSource(ConfigArgP config, String source) {
Properties p = loadConfig(source);
Config c = config.getConfig();
for(String key: p.stringPropertyNames()) {
String value = p.getProperty(key);
ConfigurationItem ci = config.getConfigurationItem(key);
if(ci!=n... | java | {
"resource": ""
} |
q31254 | ConfigArgP.loadConfig | train | protected static Properties loadConfig(String name) {
try {
URL url = new URL(name);
return loadConfig(url);
} catch (Exception ex) {
return loadConfig(new File(name));
}
} | java | {
"resource": ""
} |
q31255 | ConfigArgP.loadConfig | train | protected static Properties loadConfig(String source, InputStream is) {
try {
Properties p = new Properties();
p.load(is);
// trim the value as it may have trailing white-space
Set<String> keys = p.stringPropertyNames();
for(String key: keys) {
p.setProperty(key, p.getProperty(... | java | {
"resource": ""
} |
q31256 | ConfigArgP.loadConfig | train | protected static Properties loadConfig(File file) {
InputStream is = null;
try {
is = new FileInputStream(file);
return loadConfig(file.getAbsolutePath(), is);
} catch (Exception ex) {
throw new IllegalArgumentException("Failed to load configuration from [" + file.getAbsolutePath() + ... | java | {
"resource": ""
} |
q31257 | ConfigArgP.applyArgs | train | public String[] applyArgs(String[] clargs) {
LOG.debug("Applying Command Line Args {}", Arrays.toString(clargs));
final List<String> nonFlagArgs = new ArrayList<String>(Arrays.asList(clargs));
extractAndApplyFlags(nonFlagArgs);
String[] args = nonFlagArgs.toArray(new String[0]);
String[] nonArg... | java | {
"resource": ""
} |
q31258 | ConfigArgP.getDefaultUsage | train | public String getDefaultUsage(String...msgs) {
StringBuilder b = new StringBuilder("\n");
for(String msg: msgs) {
b.append(msg).append("\n");
}
b.append(dargp.usage());
return b.toString();
} | java | {
"resource": ""
} |
q31259 | ConfigArgP.getExtendedUsage | train | public String getExtendedUsage(String...msgs) {
StringBuilder b = new StringBuilder("\n");
for(String msg: msgs) {
b.append(msg).append("\n");
}
b.append(argp.usage());
return b.toString();
} | java | {
"resource": ""
} |
q31260 | ConfigArgP.log | train | public static void log(String format, Object...args) {
System.out.println(String.format(format, args));
} | java | {
"resource": ""
} |
q31261 | ConfigArgP.processConfigValue | train | public static String processConfigValue(CharSequence text) {
final String pv = evaluate(tokenReplaceSysProps(text));
return (pv==null || pv.trim().isEmpty()) ? null : pv;
} | java | {
"resource": ""
} |
q31262 | ConfigArgP.tokenReplaceSysProps | train | public static String tokenReplaceSysProps(CharSequence text) {
if(text==null) return null;
Matcher m = SYS_PROP_PATTERN.matcher(text);
StringBuffer ret = new StringBuffer();
while(m.find()) {
String replacement = decodeToken(m.group(1), m.group(2)==null ? "<null>" : m.group(2));
if(replaceme... | java | {
"resource": ""
} |
q31263 | ConfigArgP.evaluate | train | public static String evaluate(CharSequence text) {
if(text==null) return null;
Matcher m = JS_PATTERN.matcher(text);
StringBuffer ret = new StringBuffer();
final boolean isNas = scriptEngine.getFactory().getEngineName().toLowerCase().contains("nashorn");
while(m.find()) {
String source = (isNa... | java | {
"resource": ""
} |
q31264 | ConfigArgP.hasNonOption | train | public boolean hasNonOption(String nonOptionKey) {
if(nonOptionArgs==null || nonOptionArgs.length==0 || nonOptionKey==null || nonOptionKey.trim().isEmpty()) return false;
return Arrays.binarySearch(nonOptionArgs, nonOptionKey) >= 0;
} | java | {
"resource": ""
} |
q31265 | SearchRpc.parseQueryString | train | private final SearchQuery parseQueryString(final HttpQuery query,
final SearchType type) {
final SearchQuery search_query = new SearchQuery();
if (type == SearchType.LOOKUP) {
final String query_string = query.getRequiredQueryStringParam("m");
search_query.setTags(new ArrayList<Pair<Stri... | java | {
"resource": ""
} |
q31266 | HttpQuery.internalError | train | @Override
public void internalError(final Exception cause) {
logError("Internal Server Error on " + request().getUri(), cause);
if (this.api_version > 0) {
// always default to the latest version of the error formatter since we
// need to return something
switch (this.api_version) {
... | java | {
"resource": ""
} |
q31267 | HttpQuery.badRequest | train | @Override
public void badRequest(final BadRequestException exception) {
logWarn("Bad Request on " + request().getUri() + ": " + exception.getMessage());
if (this.api_version > 0) {
// always default to the latest version of the error formatter since we
// need to return something
switch (thi... | java | {
"resource": ""
} |
q31268 | HttpQuery.notFound | train | @Override
public void notFound() {
logWarn("Not Found: " + request().getUri());
if (this.api_version > 0) {
// always default to the latest version of the error formatter since we
// need to return something
switch (this.api_version) {
case 1:
default:
sendReply(Htt... | java | {
"resource": ""
} |
q31269 | HttpQuery.redirect | train | public void redirect(final String location) {
// set the header AND a meta refresh just in case
response().headers().set("Location", location);
sendReply(HttpResponseStatus.OK,
new StringBuilder(
"<html></head><meta http-equiv=\"refresh\" content=\"0; url="
+ location + "\"></head... | java | {
"resource": ""
} |
q31270 | HttpQuery.escapeJson | train | static void escapeJson(final String s, final StringBuilder buf) {
final int length = s.length();
int extra = 0;
// First count how many extra chars we'll need, if any.
for (int i = 0; i < length; i++) {
final char c = s.charAt(i);
switch (c) {
case '"':
case '\\':
cas... | java | {
"resource": ""
} |
q31271 | HttpQuery.done | train | @Override
public void done() {
final int processing_time = processingTimeMillis();
httplatency.add(processing_time);
logInfo("HTTP " + request().getUri() + " done in " + processing_time + "ms");
deferred.callback(null);
} | java | {
"resource": ""
} |
q31272 | HttpQuery.guessMimeType | train | private String guessMimeType(final ChannelBuffer buf) {
final String mimetype = guessMimeTypeFromUri(request().getUri());
return mimetype == null ? guessMimeTypeFromContents(buf) : mimetype;
} | java | {
"resource": ""
} |
q31273 | HttpQuery.guessMimeTypeFromUri | train | private static String guessMimeTypeFromUri(final String uri) {
final int questionmark = uri.indexOf('?', 1); // 1 => skip the initial /
final int end = (questionmark > 0 ? questionmark : uri.length()) - 1;
if (end < 5) { // Need at least: "/a.js"
return null;
}
final char a = uri.charAt(end ... | java | {
"resource": ""
} |
q31274 | HttpQuery.guessMimeTypeFromContents | train | private String guessMimeTypeFromContents(final ChannelBuffer buf) {
if (!buf.readable()) {
logWarn("Sending an empty result?! buf=" + buf);
return "text/plain";
}
final int firstbyte = buf.getUnsignedByte(buf.readerIndex());
switch (firstbyte) {
case '<': // <html or <!DOCTYPE
... | java | {
"resource": ""
} |
q31275 | HttpQuery.makePage | train | public static StringBuilder makePage(final String htmlheader,
final String title,
final String subtitle,
final String body) {
final StringBuilder buf = new StringBuilder(
BOILERPLATE_LENGTH + (... | java | {
"resource": ""
} |
q31276 | FsckOptions.addDataOptions | train | public static void addDataOptions(final ArgP argp) {
argp.addOption("--full-scan", "Scan the entire data table.");
argp.addOption("--fix", "Fix errors as they're found. Use in combination with"
+ " other flags.");
argp.addOption("--fix-all", "Set all flags and fix errors as they're found.");
arg... | java | {
"resource": ""
} |
q31277 | Absolute.abs | train | private DataPoints abs(final DataPoints points) {
// TODO(cl) - Using an array as the size function may not return the exact
// results and we should figure a way to avoid copying data anyway.
final List<DataPoint> dps = new ArrayList<DataPoint>();
final SeekableView view = points.iterator();
while... | java | {
"resource": ""
} |
q31278 | TreeBuilder.processParsedValue | train | private void processParsedValue(final String parsed_value) {
if (rule.getCompiledRegex() == null &&
(rule.getSeparator() == null || rule.getSeparator().isEmpty())) {
// we don't have a regex and we don't need to separate, so just use the
// name of the timseries
setCurrentName(parsed_valu... | java | {
"resource": ""
} |
q31279 | TreeBuilder.processRegexRule | train | private void processRegexRule(final String parsed_value) {
if (rule.getCompiledRegex() == null) {
throw new IllegalArgumentException("Regex was null for rule: " +
rule);
}
final Matcher matcher = rule.getCompiledRegex().matcher(parsed_value);
if (matcher.find()) {
// The first gr... | java | {
"resource": ""
} |
q31280 | TreeBuilder.resetState | train | private void resetState() {
meta = null;
splits = null;
rule_idx = 0;
split_idx = 0;
current_branch = null;
rule = null;
not_matched = null;
if (root != null) {
if (root.getBranches() != null) {
root.getBranches().clear();
}
if (root.getLeaves() != null) {
... | java | {
"resource": ""
} |
q31281 | RTPublisher.sinkDataPoint | train | public final Deferred<Object> sinkDataPoint(final String metric,
final long timestamp, final byte[] value, final Map<String, String> tags,
final byte[] tsuid, final short flags) {
if ((flags & Const.FLAG_FLOAT) != 0x0) {
return publishDataPoint(metric, timestamp,
Internal.extractFloat... | java | {
"resource": ""
} |
q31282 | RTPublisher.publishHistogramPoint | train | public Deferred<Object> publishHistogramPoint(final String metric,
final long timestamp, final byte[] value,
final Map<String, String> tags,
final byte[] tsuid) {
... | java | {
"resource": ""
} |
q31283 | RollupInterval.validateAndCompile | train | void validateAndCompile() {
if (temporal_table_name == null || temporal_table_name.isEmpty()) {
throw new IllegalArgumentException("The rollup table cannot be null or empty");
}
temporal_table = temporal_table_name.getBytes(Const.ASCII_CHARSET);
if (groupby_table_name == null || groupby_table... | java | {
"resource": ""
} |
q31284 | AppendDataPoints.getBytes | train | public byte[] getBytes() {
final byte[] bytes = new byte[qualifier.length + value.length];
System.arraycopy(this.qualifier, 0, bytes, 0, qualifier.length);
System.arraycopy(value, 0, bytes, qualifier.length, value.length);
return bytes;
} | java | {
"resource": ""
} |
q31285 | CliUtils.getMaxMetricID | train | static long getMaxMetricID(final TSDB tsdb) {
// first up, we need the max metric ID so we can split up the data table
// amongst threads.
final GetRequest get = new GetRequest(tsdb.uidTable(), new byte[] { 0 });
get.family("id".getBytes(CHARSET));
get.qualifier("metrics".getBytes(CHARSET));
Arr... | java | {
"resource": ""
} |
q31286 | CliUtils.getDataTableScanner | train | static final Scanner getDataTableScanner(final TSDB tsdb, final long start_id,
final long end_id) throws HBaseException {
final short metric_width = TSDB.metrics_width();
final byte[] start_row =
Arrays.copyOfRange(Bytes.fromLong(start_id), 8 - metric_width, 8);
final byte[] end_row =
A... | java | {
"resource": ""
} |
q31287 | MetricForm.getFilters | train | private List<Filter> getFilters(final boolean group_by) {
final int ntags = getNumTags();
final List<Filter> filters = new ArrayList<Filter>(ntags);
for (int tag = 0; tag < ntags; tag++) {
final Filter filter = new Filter();
filter.tagk = getTagName(tag);
filter.tagv = getTagValue(tag);
... | java | {
"resource": ""
} |
q31288 | MetricForm.setSelectedItem | train | private void setSelectedItem(final ListBox list, final String item) {
final int nitems = list.getItemCount();
for (int i = 0; i < nitems; i++) {
if (item.equals(list.getValue(i))) {
list.setSelectedIndex(i);
return;
}
}
} | java | {
"resource": ""
} |
q31289 | Threads.newTimer | train | public static HashedWheelTimer newTimer(final int ticks,
final int ticks_per_wheel, final String name) {
class TimerThreadNamer implements ThreadNameDeterminer {
@Override
public String determineThreadName(String currentThreadName,
String proposedThreadName) throws Exception {
r... | java | {
"resource": ""
} |
q31290 | Downsampler.validate | train | public void validate() {
if (interval == null || interval.isEmpty()) {
throw new IllegalArgumentException("Missing or empty interval");
}
DateTime.parseDuration(interval);
if (aggregator == null || aggregator.isEmpty()) {
throw new IllegalArgumentException("Missing or empty aggregator")... | java | {
"resource": ""
} |
q31291 | NumericFillPolicy.validate | train | public void validate() {
if (policy == null) {
if (value == 0) {
policy = FillPolicy.ZERO;
} else if (Double.isNaN(value)) {
policy = FillPolicy.NOT_A_NUMBER;
} else {
policy = FillPolicy.SCALAR;
}
} else {
switch (policy) {
case NONE:
case NOT_A... | java | {
"resource": ""
} |
q31292 | HistogramCodecManager.getCodec | train | public HistogramDataPointCodec getCodec(final int id) {
final HistogramDataPointCodec codec = codecs.get(id);
if (codec == null) {
throw new IllegalArgumentException("No codec found mapped to ID " + id);
}
return codec;
} | java | {
"resource": ""
} |
q31293 | HistogramCodecManager.getCodec | train | public int getCodec(final Class<?> clazz) {
if (clazz == null) {
throw new IllegalArgumentException("Clazz cannot be null.");
}
final Integer id = codecs_ids.get(clazz);
if (id == null) {
throw new IllegalArgumentException("No codec ID assigned to class "
+ clazz);
}
retur... | java | {
"resource": ""
} |
q31294 | HistogramCodecManager.encode | train | public byte[] encode(final int id,
final Histogram data_point,
final boolean include_id) {
final HistogramDataPointCodec codec = getCodec(id);
return codec.encode(data_point, include_id);
} | java | {
"resource": ""
} |
q31295 | HistogramCodecManager.decode | train | public Histogram decode(final int id,
final byte[] raw_data,
final boolean includes_id) {
final HistogramDataPointCodec codec = getCodec(id);
return codec.decode(raw_data, includes_id);
} | java | {
"resource": ""
} |
q31296 | StatsRpc.execute | train | public Deferred<Object> execute(final TSDB tsdb, final Channel chan,
final String[] cmd) {
final boolean canonical = tsdb.getConfig().getBoolean("tsd.stats.canonical");
final StringBuilder buf = new StringBuilder(1024);
final ASCIICollector collector = new ASCIICollector("tsd", buf, null);
doColle... | java | {
"resource": ""
} |
q31297 | StatsRpc.execute | train | public void execute(final TSDB tsdb, final HttpQuery query) {
// only accept GET/POST
if (query.method() != HttpMethod.GET && query.method() != HttpMethod.POST) {
throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED,
"Method not allowed", "The HTTP method [" + query.method().getN... | java | {
"resource": ""
} |
q31298 | StatsRpc.doCollectStats | train | private void doCollectStats(final TSDB tsdb, final StatsCollector collector,
final boolean canonical) {
collector.addHostTag(canonical);
ConnectionManager.collectStats(collector);
RpcHandler.collectStats(collector);
RpcManager.collectStats(collector);
collectThreadStats(collector);
tsdb.c... | java | {
"resource": ""
} |
q31299 | StatsRpc.printRegionClientStats | train | private void printRegionClientStats(final TSDB tsdb, final HttpQuery query) {
final List<RegionClientStats> region_stats = tsdb.getClient().regionStats();
final List<Map<String, Object>> stats =
new ArrayList<Map<String, Object>>(region_stats.size());
for (final RegionClientStats rcs : region_stats... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.