@Override public void put(TimelineDomain domain) throws IOException { summaryStore.put(domain); } }
/** * Deserializes an Object from a byte array created with * {@link #write(Object)}. * * @param b A byte array * @return An Object * @throws IOException if there is a read error */ public static Object read(byte[] b) throws IOException { return read(b, 0); }
/** * Converts a long to a 8-byte array so that lexicographic ordering of the * produced byte arrays sort the longs in descending order. * * @param l A long * @return A byte array */ public static byte[] writeReverseOrderedLong(long l) { byte[] b = new byte[8]; return writeReverseOrderedLong(l, b, 0); }
@Override public TimelineEntities getEntities(String entityType, Long limit, Long windowStart, Long windowEnd, String fromId, Long fromTs, NameValuePair primaryFilter, Collection<NameValuePair> secondaryFilters, EnumSet<Field> fieldsToRetrieve, CheckAcl checkAcl) throws IOException { LOG.debug("getEntities type={} primary={}", entityType, primaryFilter); Object arg = (primaryFilter == null) ? null : primaryFilter.getValue(); TimelineStore store = getTimelineStoreForRead(entityType, arg); return store.getEntities(entityType, limit, windowStart, windowEnd, fromId, fromTs, primaryFilter, secondaryFilters, fieldsToRetrieve, checkAcl); }
@Before public void setup() throws Exception { store = new MemoryTimelineStore(); store.init(new YarnConfiguration()); store.start(); loadTestEntityData(); loadVerificationEntityData(); loadTestDomainData(); }
private void restartTimelineStore() throws IOException { // need to close so leveldb releases database lock if (store != null) { store.close(); } store = new RollingLevelDBTimelineStore(); store.init(config); store.start(); }
private void restartTimelineStore() throws IOException { // need to close so leveldb releases database lock if (store != null) { store.close(); } store = new LeveldbTimelineStore(); store.init(config); store.start(); }
/** * 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 Iterator<V> valueSetIterator(V minV) { return getIterator( new EntityIdentifier(minV.getEntityId(), minV.getEntityType()), minV.getStartTime()); }
static TimelineDataManager getTdmWithMemStore(Configuration config) { TimelineStore store = new MemoryTimelineStore("MemoryStore.test"); TimelineDataManager tdm = getTdmWithStore(config, store); return tdm; }
public static void main(String[] args) throws Exception { TestRollingLevelDBTimelineStore store = new TestRollingLevelDBTimelineStore(); store.setup(); store.testStorePerformance(); store.tearDown(); } }
@Test public void testGetSingleEntity() throws IOException { super.testGetSingleEntity(); ((RollingLevelDBTimelineStore)store).clearStartTimeCache(); super.testGetSingleEntity(); loadTestEntityData(); }
@Test public void testGetSingleEntity() throws IOException { super.testGetSingleEntity(); ((LeveldbTimelineStore)store).clearStartTimeCache(); super.testGetSingleEntity(); loadTestEntityData(); }
public MemoryTimelineStore(String name) { super(name); entities = new HashMapStoreAdapter<>(); entityInsertTimes = new HashMapStoreAdapter<>(); domainById = new HashMapStoreAdapter<>(); domainsByOwner = new HashMapStoreAdapter<>(); }
/** * @return the version number of timeline server for the current test (using * timeline server v1.0 by default) */ public float getTimelineVersion() { if(version == null) { return DEFAULT_TIMELINE_VERSION; } return version.value(); } }
/** * Deserializes an Object from a byte array created with * {@link #write(Object)}. * * @param b A byte array * @return An Object * @throws IOException if there is a read error */ public static Object read(byte[] b) throws IOException { return read(b, 0); }
/** * Converts a long to a 8-byte array so that lexicographic ordering of the * produced byte arrays sort the longs in descending order. * * @param l A long * @return A byte array */ public static byte[] writeReverseOrderedLong(long l) { byte[] b = new byte[8]; return writeReverseOrderedLong(l, b, 0); }
@Override public void put(TimelineDomain domain) throws IOException { summaryStore.put(domain); } }
/** * Deserializes an Object from a byte array created with * {@link #write(Object)}. * * @param b A byte array * @return An Object * @throws IOException if there is a read error */ public static Object read(byte[] b) throws IOException { return read(b, 0); }
/** * Converts a long to a 8-byte array so that lexicographic ordering of the * produced byte arrays sort the longs in descending order. * * @param l A long * @return A byte array */ public static byte[] writeReverseOrderedLong(long l) { byte[] b = new byte[8]; return writeReverseOrderedLong(l, b, 0); }