protected double getDatasetPriority(String datasetName) { double priority = LOW_PRIORITY; if (DatasetFilterUtils.stringInPatterns(datasetName, this.highPriority)) { priority = HIGH_PRIORITY; } else if (DatasetFilterUtils.stringInPatterns(datasetName, this.normalPriority)) { priority = NORMAL_PRIORITY; } return priority; }
/** * A topic survives if (1) it doesn't match the blacklist, and * (2) either whitelist is empty, or it matches the whitelist. * Whitelist and blacklist use regex patterns (NOT glob patterns). */ public static boolean survived(String topic, List<Pattern> blacklist, List<Pattern> whitelist) { if (stringInPatterns(topic, blacklist)) { return false; } return (whitelist.isEmpty() || stringInPatterns(topic, whitelist)); }
public static double getRatioThresholdByDatasetName (String datasetName, Map<String, Double> datasetRegexAndRecompactThreshold) { for (Map.Entry<String, Double> topicRegexEntry : datasetRegexAndRecompactThreshold.entrySet()) { if (DatasetFilterUtils.stringInPatterns(datasetName, DatasetFilterUtils.getPatternsFromStrings(Splitter.on(DATASETS_WITH_SAME_RECOMPACT_THRESHOLDS_SEPARATOR) .trimResults().omitEmptyStrings().splitToList(topicRegexEntry.getKey())))) { return topicRegexEntry.getValue(); } } return MRCompactor.DEFAULT_COMPACTION_LATEDATA_THRESHOLD_FOR_RECOMPACT_PER_DATASET; }
/** * Check if a log line should be copied. * * <p> * A line should be copied if and only if all of the following conditions satisfy: * * <ul> * <li> * It doesn't match any of the excluding regex patterns. If there's no excluding regex patterns, * this condition is considered satisfied. * </li> * <li> * It matches at least one of the including regex patterns. If there's no including regex patterns, * this condition is considered satisfied. * </li> * </ul> * </p> */ private boolean shouldCopyLine(String line) { boolean including = !LogCopier.this.includingRegexPatterns.isPresent() || DatasetFilterUtils.stringInPatterns(line, LogCopier.this.includingRegexPatterns.get()); boolean excluding = LogCopier.this.excludingRegexPatterns.isPresent() && DatasetFilterUtils.stringInPatterns(line, LogCopier.this.excludingRegexPatterns.get()); return !excluding && including; } }