use of com.palantir.atlasdb.cleaner.PuncherStore in project atlasdb by palantir.
the class TestTimestampCommand method punch.
private void punch(TestAtlasDbServices services, TimestampService tss, Clock clock) {
// this is a really hacky way of forcing a punch to test the datetime output
Uninterruptibles.sleepUninterruptibly(2, TimeUnit.MILLISECONDS);
long punchTs = tss.getFreshTimestamps(1000).getUpperBound();
PuncherStore puncherStore = KeyValueServicePuncherStore.create(services.getKeyValueService());
Puncher puncher = SimplePuncher.create(puncherStore, clock, Suppliers.ofInstance(AtlasDbConstants.DEFAULT_TRANSACTION_READ_TIMEOUT));
puncher.punch(punchTs);
Uninterruptibles.sleepUninterruptibly(2, TimeUnit.MILLISECONDS);
}
use of com.palantir.atlasdb.cleaner.PuncherStore in project atlasdb by palantir.
the class ReadPunchTableCommand method execute.
@Override
public int execute(AtlasDbServices services) {
if (epochTime == null) {
throw new IllegalArgumentException("Required option '-e' is missing");
}
if (epochTime < 0) {
throw new IllegalArgumentException("Option '-e' should be a positive long, as epoch time" + " is never negative.");
}
Instant epochTimeInstant = Instant.ofEpochSecond(epochTime);
ZonedDateTime date = ZonedDateTime.ofInstant(epochTimeInstant, ZoneId.systemDefault());
printer.info("Input {} in epoch millis is {}", SafeArg.of("epochMillis", epochTime), SafeArg.of("date", date.toString()));
KeyValueService keyValueService = services.getKeyValueService();
PuncherStore puncherStore = KeyValueServicePuncherStore.create(keyValueService, false);
Long value = puncherStore.get(epochTime);
printer.info("The first timestamp before {} is {}", SafeArg.of("date", date.toString()), SafeArg.of("timestamp", value));
return 0;
}
Aggregations