@Override protected Duration parse(String argument) throws NumberFormatException, CmdLineException { return Duration.seconds(Integer.valueOf(argument)); }
@Override protected Duration parse(String input) throws Exception { if (input.matches("^[\\d]+$")) { return Duration.seconds(Integer.valueOf(input)); } return Duration.parse(input); }
@Override protected Duration parse(String input) throws Exception { if (input.matches("^[\\d]+$")) { return Duration.seconds(Integer.valueOf(input)); } return Duration.parse(input); }
public static ContextConfigurations getContextConfigurations( final String resourceShardStr, final String readConsistencyStr, final String writeConsistencyStr) { Duration resourceShard = Duration.seconds(Long.parseLong(resourceShardStr)); ConsistencyLevel readConsistency = ConsistencyLevel.valueOf(readConsistencyStr); ConsistencyLevel writeConsistency = ConsistencyLevel.valueOf(writeConsistencyStr); ContextConfigurations contexts = new ContextConfigurations(); contexts.addContextConfig(Context.DEFAULT_CONTEXT, resourceShard, readConsistency, writeConsistency); return contexts; } }
public static ContextConfigurations getContextConfigurations( final String resourceShardStr, final String readConsistencyStr, final String writeConsistencyStr) { Duration resourceShard = Duration.seconds(Long.parseLong(resourceShardStr)); ConsistencyLevel readConsistency = ConsistencyLevel.valueOf(readConsistencyStr); ConsistencyLevel writeConsistency = ConsistencyLevel.valueOf(writeConsistencyStr); ContextConfigurations contexts = new ContextConfigurations(); contexts.addContextConfig(Context.DEFAULT_CONTEXT, resourceShard, readConsistency, writeConsistency); return contexts; } }
break; case "s": r = Duration.seconds(value); break; case "ms":
@Override public Results<Sample> select(Context context, Resource resource, Optional<Timestamp> start, Optional<Timestamp> end) { Timer.Context timer = m_sampleSelectTimer.time(); validateSelect(start, end); Timestamp upper = end.isPresent() ? end.get() : Timestamp.now(); Timestamp lower = start.isPresent() ? start.get() : upper.minus(Duration.seconds(86400)); LOG.debug("Querying database for resource {}, from {} to {}", resource, lower, upper); Results<Sample> samples = new Results<>(); DriverAdapter driverAdapter = new DriverAdapter(cassandraSelect(context, resource, lower, upper)); for (Row<Sample> row : driverAdapter) { samples.addRow(row); } LOG.debug("{} results returned from database", driverAdapter.getResultCount()); m_samplesSelected.mark(driverAdapter.getResultCount()); try { return samples; } finally { timer.stop(); } }
Timestamp lower = start.isPresent() ? start.get() : upper.minus(Duration.seconds(86400)); Duration step; if (resolution.isPresent()) {