/** * Get the unique start time for a given entity as a byte array that sorts * the timestamps in reverse order (see {@link * GenericObjectMapper#writeReverseOrderedLong(long)}). * * @param entityId The id of the entity * @param entityType The type of the entity * @return A byte array, null if not found * @throws IOException */ private byte[] getStartTime(String entityId, String entityType) throws IOException { Long l = getStartTimeLong(entityId, entityType); return l == null ? null : writeReverseOrderedLong(l); }
/** * Get the unique start time for a given entity as a byte array that sorts * the timestamps in reverse order (see {@link * GenericObjectMapper#writeReverseOrderedLong(long)}). * * @param entityId The id of the entity * @param entityType The type of the entity * @return A byte array, null if not found * @throws IOException */ private byte[] getStartTime(String entityId, String entityType) throws IOException { Long l = getStartTimeLong(entityId, entityType); return l == null ? null : writeReverseOrderedLong(l); }
/** * Get the unique start time for a given entity as a byte array that sorts * the timestamps in reverse order (see {@link * GenericObjectMapper#writeReverseOrderedLong(long)}). * * @param entityId The id of the entity * @param entityType The type of the entity * @return A byte array, null if not found * @throws IOException */ private byte[] getStartTime(String entityId, String entityType) throws IOException { Long l = getStartTimeLong(entityId, entityType); return l == null ? null : writeReverseOrderedLong(l); }
@Override public TimelineEntity getEntity(String entityId, String entityType, EnumSet<Field> fields) throws IOException { Long revStartTime = getStartTimeLong(entityId, entityType); if (revStartTime == null) { return null; } byte[] prefix = KeyBuilder.newInstance().add(ENTITY_ENTRY_PREFIX) .add(entityType).add(writeReverseOrderedLong(revStartTime)) .add(entityId).getBytesForLookup(); LeveldbIterator iterator = null; try { iterator = new LeveldbIterator(db); iterator.seek(prefix); if (fields == null) { fields = EnumSet.allOf(Field.class); } return getEntity(entityId, entityType, revStartTime, fields, iterator, prefix, prefix.length); } catch(DBException e) { throw new IOException(e); } finally { IOUtils.cleanupWithLogger(LOG, iterator); } }
@Override public TimelineEntity getEntity(String entityId, String entityType, EnumSet<Field> fields) throws IOException { Long revStartTime = getStartTimeLong(entityId, entityType); if (revStartTime == null) { return null; } byte[] prefix = KeyBuilder.newInstance().add(ENTITY_ENTRY_PREFIX) .add(entityType).add(writeReverseOrderedLong(revStartTime)) .add(entityId).getBytesForLookup(); LeveldbIterator iterator = null; try { iterator = new LeveldbIterator(db); iterator.seek(prefix); return getEntity(entityId, entityType, revStartTime, fields, iterator, prefix, prefix.length); } catch(DBException e) { throw new IOException(e); } finally { IOUtils.cleanup(LOG, iterator); } }
@Override public TimelineEntity getEntity(String entityId, String entityType, EnumSet<Field> fields) throws IOException { Long revStartTime = getStartTimeLong(entityId, entityType); if (revStartTime == null) { return null; } byte[] prefix = KeyBuilder.newInstance().add(ENTITY_ENTRY_PREFIX) .add(entityType).add(writeReverseOrderedLong(revStartTime)) .add(entityId).getBytesForLookup(); LeveldbIterator iterator = null; try { iterator = new LeveldbIterator(db); iterator.seek(prefix); return getEntity(entityId, entityType, revStartTime, fields, iterator, prefix, prefix.length); } catch(DBException e) { throw new IOException(e); } finally { IOUtils.cleanup(LOG, iterator); } }
Long fromIdStartTime = getStartTimeLong(fromId, entityType); if (fromIdStartTime == null) {
Long fromIdStartTime = getStartTimeLong(fromId, entityType); if (fromIdStartTime == null) {
Long fromIdStartTime = getStartTimeLong(fromId, entityType); if (fromIdStartTime == null) {