use of org.neo4j.kernel.impl.transaction.log.pruning.ThresholdConfigParser.ThresholdConfigValue in project neo4j by neo4j.
the class ThresholdConfigParserTest method parseTrue.
@Test
public void parseTrue() throws Exception {
ThresholdConfigValue configValue = parse("true");
assertEquals(NO_PRUNING, configValue);
}
use of org.neo4j.kernel.impl.transaction.log.pruning.ThresholdConfigParser.ThresholdConfigValue in project neo4j by neo4j.
the class LogPruneStrategyFactoryTest method testLogPruneThresholdsByType.
@Test
public void testLogPruneThresholdsByType() throws Exception {
FileSystemAbstraction fsa = Mockito.mock(FileSystemAbstraction.class);
assertThat(getThresholdByType(fsa, new ThresholdConfigValue("files", 25), ""), instanceOf(FileCountThreshold.class));
assertThat(getThresholdByType(fsa, new ThresholdConfigValue("size", 16000), ""), instanceOf(FileSizeThreshold.class));
assertThat(getThresholdByType(fsa, new ThresholdConfigValue("txs", 4000), ""), instanceOf(EntryCountThreshold.class));
assertThat(getThresholdByType(fsa, new ThresholdConfigValue("entries", 4000), ""), instanceOf(EntryCountThreshold.class));
assertThat(getThresholdByType(fsa, new ThresholdConfigValue("hours", 100), ""), instanceOf(EntryTimespanThreshold.class));
assertThat(getThresholdByType(fsa, new ThresholdConfigValue("days", 100_000), ""), instanceOf(EntryTimespanThreshold.class));
}
use of org.neo4j.kernel.impl.transaction.log.pruning.ThresholdConfigParser.ThresholdConfigValue in project neo4j by neo4j.
the class ThresholdConfigParserTest method parseFalse.
@Test
public void parseFalse() throws Exception {
ThresholdConfigValue configValue = parse("false");
assertEquals(KEEP_LAST_FILE, configValue);
}
use of org.neo4j.kernel.impl.transaction.log.pruning.ThresholdConfigParser.ThresholdConfigValue in project neo4j by neo4j.
the class LogPruneStrategyFactory method fromConfigValue.
/**
* Parses a configuration value for log specifying log pruning. It has one of these forms:
* <ul>
* <li>all</li>
* <li>[number][unit] [type]</li>
* </ul>
* For example:
* <ul>
* <li>100M size - For keeping last 100 megabytes of log data</li>
* <li>20 pcs - For keeping last 20 non-empty log files</li>
* <li>7 days - For keeping last 7 days worth of log data</li>
* <li>1k hours - For keeping last 1000 hours worth of log data</li>
* </ul>
*/
public static LogPruneStrategy fromConfigValue(FileSystemAbstraction fileSystem, LogFileInformation logFileInformation, PhysicalLogFiles files, String configValue) {
ThresholdConfigValue value = parse(configValue);
if (value == ThresholdConfigValue.NO_PRUNING) {
return NO_PRUNING;
}
Threshold thresholdToUse = getThresholdByType(fileSystem, value, configValue);
return new ThresholdBasedPruneStrategy(fileSystem, logFileInformation, files, thresholdToUse);
}
Aggregations