@Override public LogProcessorBuilder setStartTime(long sinceEpoch, TimeUnit unit) { this.startTime = new Timestamp(sinceEpoch,unit); return this; }
@Override public int compareTo(Timestamp o) { return Durations.compare(sinceEpoch, unit, o.sinceEpoch(o.getNativeUnit()), o.getNativeUnit()); }
@Override public boolean equals(Object oth) { if (this==oth) return true; else if (oth==null || !getClass().isInstance(oth)) return false; StandardTransactionId id = (StandardTransactionId)oth; return instanceId.equals(id.instanceId) && transactionId==id.transactionId && transactionTime.equals(id.transactionTime); }
if (features.hasTimestamps()) { Timestamp t = prop.getProperty("$timestamp"); assertEquals(100,t.sinceEpoch(unit)); assertEquals(TimeUnit.MICROSECONDS.convert(100,TimeUnit.SECONDS)+1,t.sinceEpoch(TimeUnit.MICROSECONDS)); assertEquals(1,v1.query().has("$timestamp",new Timestamp(100,unit)).propertyCount()); assertEquals(1,v1.query().has("$timestamp", Cmp.GREATER_THAN,new Timestamp(10, unit)).propertyCount()); v1.removeProperty(name); v1.setProperty(address, "xyz");
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Timestamp other = (Timestamp) obj; return other.sinceEpoch(unit) == sinceEpoch; }
assertEquals(instanceid,txId.getInstanceId()); assertTrue(txId.getTransactionId()>0 && txId.getTransactionId()<100); //Just some reasonable upper bound final long txTime = txId.getTransactionTime().sinceEpoch(TimeUnit.MILLISECONDS); assertTrue(String.format("tx timestamp %s not between start %s and end time %s", txTime,startTime,endTime), PropertyKey weight = tx.getPropertyKey("weight"); long txTimeMicro = txId.getTransactionTime().sinceEpoch(TimeUnit.MICROSECONDS);
readMarker = ReadMarker.fromNow(); } else if (readMarkerName==null) { readMarker = ReadMarker.fromTime(startTime.sinceEpoch(startTime.getNativeUnit()),startTime.getNativeUnit()); } else if (startTime==null) { readMarker = ReadMarker.fromIdentifierOrNow(readMarkerName); } else { readMarker = ReadMarker.fromIdentifierOrTime(readMarkerName, startTime.sinceEpoch(startTime.getNativeUnit()), startTime.getNativeUnit());
/** * Returns a {@link TransactionRecovery} process for recovering partially failed transactions. The recovery process * will start processing the write-ahead transaction log at the specified transaction time. * * @param graph * @param sinceEpoch * @param unit * @return */ public static TransactionRecovery startTransactionRecovery(TitanGraph graph, long sinceEpoch, TimeUnit unit) { return new StandardTransactionLogProcessor((StandardTitanGraph)graph, new Timestamp(sinceEpoch,unit)); }
.build(); ReadMarker start = ReadMarker.fromTime(startTime.sinceEpoch(startTime.getNativeUnit()),startTime.getNativeUnit()); this.txLog.registerReader(start,new TxLogMessageReader());
@Override public void read(Message message) { ReadBuffer content = message.getContent().asReadBuffer(); String senderId = message.getSenderId(); TransactionLogHeader.Entry txentry = TransactionLogHeader.parse(content,serializer,times); TransactionLogHeader txheader = txentry.getHeader(); StandardTransactionId transactionId = new StandardTransactionId(senderId,txheader.getId(), new Timestamp(txheader.getTimestamp(times.getUnit()),times.getUnit())); TxEntry entry; try { entry = txCache.get(transactionId,entryFactory); } catch (ExecutionException e) { throw new AssertionError("Unexpected exception",e); } entry.update(txentry); }
} else { transactionId = new StandardTransactionId(senderId,txentry.getHeader().getId(), new Timestamp(txentry.getHeader().getTimestamp(times.getUnit()),times.getUnit()));
if (time==null) return null; //there is no timestamp TimeUnit unit = r.tx().getConfiguration().getTimestampProvider().getUnit(); return (O) new Timestamp(time, unit);