static TimelineDataManager getTdmWithMemStore(Configuration config) { TimelineStore store = new MemoryTimelineStore("MemoryStore.test"); TimelineDataManager tdm = getTdmWithStore(config, store); return tdm; }
public void put(TimelineDomain domain) throws IOException { TimelineDomain domainToReplace = domainsById.get(domain.getId()); Long currentTimestamp = System.currentTimeMillis(); TimelineDomain domainToStore = createTimelineDomain( domain.getId(), domain.getDescription(), domain.getOwner(), domain.getReaders(), domain.getWriters(), (domainToReplace == null ? currentTimestamp : domainToReplace.getCreatedTime()), currentTimestamp); domainsById.put(domainToStore.getId(), domainToStore); Set<TimelineDomain> domainsByOneOwner = domainsByOwner.get(domainToStore.getOwner()); if (domainsByOneOwner == null) { domainsByOneOwner = new HashSet<TimelineDomain>(); domainsByOwner.put(domainToStore.getOwner(), domainsByOneOwner); } if (domainToReplace != null) { domainsByOneOwner.remove(domainToReplace); } domainsByOneOwner.add(domainToStore); }
@Override public synchronized TimelineEntity getEntity(String entityId, String entityType, EnumSet<Field> fieldsToRetrieve) { if (fieldsToRetrieve == null) { fieldsToRetrieve = EnumSet.allOf(Field.class); } TimelineEntity entity = entities.get(new EntityIdentifier(entityId, entityType)); if (entity == null) { return null; } else { return maskFields(entity, fieldsToRetrieve); } }
!matchPrimaryFilter(entity.getPrimaryFilters(), primaryFilter)) { continue; boolean flag = true; for (NameValuePair secondaryFilter : secondaryFilters) { if (secondaryFilter != null && !matchPrimaryFilter( entity.getPrimaryFilters(), secondaryFilter) && !matchFilter(entity.getOtherInfo(), secondaryFilter)) { flag = false; break; entitiesToReturn.add(maskFields(entitySelected, fields));
entity.getPrimaryFilters().entrySet()) { for (Object pfo : pf.getValue()) { existingEntity.addPrimaryFilter(pf.getKey(), maybeConvert(pfo)); maybeConvert(info.getValue()));
!matchPrimaryFilter(entity.getPrimaryFilters(), primaryFilter)) { continue; boolean flag = true; for (NameValuePair secondaryFilter : secondaryFilters) { if (secondaryFilter != null && !matchPrimaryFilter( entity.getPrimaryFilters(), secondaryFilter) && !matchFilter(entity.getOtherInfo(), secondaryFilter)) { flag = false; break; entitiesToReturn.add(maskFields(entitySelected, fields));
entity.getPrimaryFilters().entrySet()) { for (Object pfo : pf.getValue()) { existingEntity.addPrimaryFilter(pf.getKey(), maybeConvert(pfo)); maybeConvert(info.getValue()));
public static TimelineStore createStore(int scale) throws Exception { TimelineStore store = new MemoryTimelineStore(); prepareTimelineStore(store, scale); return store; }
public void put(TimelineDomain domain) throws IOException { TimelineDomain domainToReplace = domainsById.get(domain.getId()); Long currentTimestamp = System.currentTimeMillis(); TimelineDomain domainToStore = createTimelineDomain( domain.getId(), domain.getDescription(), domain.getOwner(), domain.getReaders(), domain.getWriters(), (domainToReplace == null ? currentTimestamp : domainToReplace.getCreatedTime()), currentTimestamp); domainsById.put(domainToStore.getId(), domainToStore); Set<TimelineDomain> domainsByOneOwner = domainsByOwner.get(domainToStore.getOwner()); if (domainsByOneOwner == null) { domainsByOneOwner = new HashSet<TimelineDomain>(); domainsByOwner.put(domainToStore.getOwner(), domainsByOneOwner); } if (domainToReplace != null) { domainsByOneOwner.remove(domainToReplace); } domainsByOneOwner.add(domainToStore); }
@Override public synchronized TimelineEntity getEntity(String entityId, String entityType, EnumSet<Field> fieldsToRetrieve) { if (fieldsToRetrieve == null) { fieldsToRetrieve = EnumSet.allOf(Field.class); } TimelineEntity entity = entities.get(new EntityIdentifier(entityId, entityType)); if (entity == null) { return null; } else { return maskFields(entity, fieldsToRetrieve); } }
public synchronized TimelineStore refreshCache() throws IOException { //TODO: make a config for cache freshness if (!cacheCompleted && Time.monotonicNow() - cacheRefreshTime > 10000) { if (!isDone()) { parseSummaryLogs(); } else if (detailLogs.isEmpty()) { scanForLogs(); } if (!detailLogs.isEmpty()) { if (cacheStore == null) { cacheStore = new MemoryTimelineStore(); cacheStore.init(getConfig()); cacheStore.start(); } TimelineDataManager tdm = new TimelineDataManager(cacheStore, aclManager); tdm.init(getConfig()); tdm.start(); for (LogInfo log : detailLogs) { log.parseForCache(tdm, dirPath, isDone()); } tdm.close(); } cacheRefreshTime = Time.monotonicNow(); cacheCompleted = isDone(); } return cacheStore; }
TimelineDomain domainToReturn = createTimelineDomain( domain.getId(), domain.getDescription(),
@Before public void setup() throws Exception { store = new MemoryTimelineStore(); store.init(new YarnConfiguration()); store.start(); loadTestEntityData(); loadVerificationEntityData(); loadTestDomainData(); }
@Override public TimelineDomain getDomain(String domainId) throws IOException { TimelineDomain domain = domainsById.get(domainId); if (domain == null) { return null; } else { return createTimelineDomain( domain.getId(), domain.getDescription(), domain.getOwner(), domain.getReaders(), domain.getWriters(), domain.getCreatedTime(), domain.getModifiedTime()); } }
@Override public TimelineDomain getDomain(String domainId) throws IOException { TimelineDomain domain = domainsById.get(domainId); if (domain == null) { return null; } else { return createTimelineDomain( domain.getId(), domain.getDescription(), domain.getOwner(), domain.getReaders(), domain.getWriters(), domain.getCreatedTime(), domain.getModifiedTime()); } }
TimelineDomain domainToReturn = createTimelineDomain( domain.getId(), domain.getDescription(),