void loadFullCommits() { if (commitsMap.isEmpty()) { return; } QueryParams params = QueryParamsBuilder .withLimit(Integer.MAX_VALUE) .commitIds(commitsMap.keySet().stream().map(it -> it.getId()).collect(toSet())) .build(); List<CdoSnapshot> fullCommitsSnapshots = repository.getSnapshots(params); query.stats().logQueryInCommitDeepScope(fullCommitsSnapshots); appendSnapshots(fullCommitsSnapshots); }
CommitTable(List<CdoSnapshot> coreSnapshots, int maxGapsToFill, JqlQuery query) { this.maxGapsToFill = maxGapsToFill; this.query = query; this.commitsMap = new TreeMap<>(javersCoreConfiguration.getCommitIdGenerator().getComparator()); appendSnapshots(coreSnapshots); }
Pair<List<Shadow>, List<CdoSnapshot>> queryForShadows(JqlQuery query, List<CdoSnapshot> gapsFilledInPreviousQuery) { List<CdoSnapshot> coreSnapshots = queryForCoreSnapshots(query); CommitTable commitTable = new CommitTable( coreSnapshots, query.getMaxGapsToFill(), query); commitTable.appendSnapshots(gapsFilledInPreviousQuery); if (query.getShadowScope().isCommitDeep()) { commitTable.loadFullCommits(); } List<Shadow> shadows = commitTable.rootsForQuery(query).stream() .map(r -> shadowFactory.createShadow(r.root, r.context, (cm, targetId) -> commitTable.referenceResolver(cm, targetId))) .collect(toList()); query.stats().stop(); logger.debug("queryForShadows executed: {}", query); return new Pair(shadows, commitTable.getFilledGapsSnapshots()); }
CdoSnapshot referenceResolver(CommitMetadata rootContext, GlobalId targetId) { SnapshotReference reference = new SnapshotReference(rootContext, targetId); if (!commitsMap.containsKey(rootContext)) { return null; } CdoSnapshot latest = findLatestToInCommitTable(reference); if (latest == null) { appendSnapshots(fillGapFromRepository(reference, 15)); } latest = findLatestToInCommitTable(reference); if (latest == null){ query.stats().logMaxGapsToFillExceededInfo(targetId); } return latest; }