/** * Scan and list all available reftable files in the repository. * * @return list of available reftables. The returned array is shared with * the implementation and must not be modified by the caller. * @throws java.io.IOException * the pack list cannot be initialized. */ public DfsReftable[] getReftables() throws IOException { return getPackList().reftables; }
/** * Scan and list all available pack files in the repository. * * @return list of available packs. The returned array is shared with the * implementation and must not be modified by the caller. * @throws java.io.IOException * the pack list cannot be initialized. */ public DfsPackFile[] getPacks() throws IOException { return getPackList().packs; }
private <T extends ObjectId> Iterable<FoundObject<T>> findAll( Iterable<T> objectIds) throws IOException { Collection<T> pending = new LinkedList<>(); for (T id : objectIds) { pending.add(id); } PackList packList = db.getPackList(); List<FoundObject<T>> r = new ArrayList<>(); findAllImpl(packList, pending, r); if (!pending.isEmpty() && packList.dirty()) { stats.scanPacks++; findAllImpl(db.scanPacks(packList), pending, r); } for (T t : pending) { r.add(new FoundObject<>(t)); } Collections.sort(r, FOUND_OBJECT_SORT); return r; }
/** {@inheritDoc} */ @Override public Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException { if (id.isComplete()) return Collections.singleton(id.toObjectId()); HashSet<ObjectId> matches = new HashSet<>(4); PackList packList = db.getPackList(); resolveImpl(packList, id, matches); if (matches.size() < MAX_RESOLVE_MATCHES && packList.dirty()) { stats.scanPacks++; resolveImpl(db.scanPacks(packList), id, matches); } return matches; }
/** {@inheritDoc} */ @Override public boolean has(AnyObjectId objectId) throws IOException { if (last != null && !skipGarbagePack(last) && last.hasObject(this, objectId)) return true; PackList packList = db.getPackList(); if (hasImpl(packList, objectId)) { return true; } else if (packList.dirty()) { stats.scanPacks++; return hasImpl(db.scanPacks(packList), objectId); } return false; }
/** * Scan and list all available pack files in the repository. * * @return list of available packs. The returned array is shared with the * implementation and must not be modified by the caller. * @throws IOException * the pack list cannot be initialized. */ public DfsPackFile[] getPacks() throws IOException { return getPackList().packs; }
/** * Scan and list all available reftable files in the repository. * * @return list of available reftables. The returned array is shared with * the implementation and must not be modified by the caller. * @throws java.io.IOException * the pack list cannot be initialized. */ public DfsReftable[] getReftables() throws IOException { return getPackList().reftables; }
/** * Scan and list all available pack files in the repository. * * @return list of available packs. The returned array is shared with the * implementation and must not be modified by the caller. * @throws java.io.IOException * the pack list cannot be initialized. */ public DfsPackFile[] getPacks() throws IOException { return getPackList().packs; }
/** {@inheritDoc} */ @Override public long getObjectSize(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException { if (last != null && !skipGarbagePack(last)) { long sz = last.getObjectSize(this, objectId); if (0 <= sz) { return sz; } } PackList packList = db.getPackList(); long sz = getObjectSizeImpl(packList, objectId); if (0 <= sz) { return sz; } if (packList.dirty()) { sz = getObjectSizeImpl(packList, objectId); if (0 <= sz) { return sz; } } if (typeHint == OBJ_ANY) { throw new MissingObjectException(objectId.copy(), JGitText.get().unknownObjectType2); } throw new MissingObjectException(objectId.copy(), typeHint); }
/** {@inheritDoc} */ @Override public ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException { ObjectLoader ldr; if (last != null && !skipGarbagePack(last)) { ldr = last.get(this, objectId); if (ldr != null) { return checkType(ldr, objectId, typeHint); } } PackList packList = db.getPackList(); ldr = openImpl(packList, objectId); if (ldr != null) { return checkType(ldr, objectId, typeHint); } if (packList.dirty()) { stats.scanPacks++; ldr = openImpl(db.scanPacks(packList), objectId); if (ldr != null) { return checkType(ldr, objectId, typeHint); } } if (typeHint == OBJ_ANY) throw new MissingObjectException(objectId.copy(), JGitText.get().unknownObjectType2); throw new MissingObjectException(objectId.copy(), typeHint); }
private <T extends ObjectId> Iterable<FoundObject<T>> findAll( Iterable<T> objectIds) throws IOException { Collection<T> pending = new LinkedList<>(); for (T id : objectIds) { pending.add(id); } PackList packList = db.getPackList(); List<FoundObject<T>> r = new ArrayList<>(); findAllImpl(packList, pending, r); if (!pending.isEmpty() && packList.dirty()) { findAllImpl(db.scanPacks(packList), pending, r); } for (T t : pending) { r.add(new FoundObject<T>(t)); } Collections.sort(r, FOUND_OBJECT_SORT); return r; }
private <T extends ObjectId> Iterable<FoundObject<T>> findAll( Iterable<T> objectIds) throws IOException { Collection<T> pending = new LinkedList<>(); for (T id : objectIds) { pending.add(id); } PackList packList = db.getPackList(); List<FoundObject<T>> r = new ArrayList<>(); findAllImpl(packList, pending, r); if (!pending.isEmpty() && packList.dirty()) { stats.scanPacks++; findAllImpl(db.scanPacks(packList), pending, r); } for (T t : pending) { r.add(new FoundObject<>(t)); } Collections.sort(r, FOUND_OBJECT_SORT); return r; }
@Override public Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException { if (id.isComplete()) return Collections.singleton(id.toObjectId()); boolean noGarbage = avoidUnreachable; HashSet<ObjectId> matches = new HashSet<ObjectId>(4); PackList packList = db.getPackList(); resolveImpl(packList, id, noGarbage, matches); if (matches.size() < MAX_RESOLVE_MATCHES && packList.dirty()) { resolveImpl(db.scanPacks(packList), id, noGarbage, matches); } return matches; }
/** {@inheritDoc} */ @Override public Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException { if (id.isComplete()) return Collections.singleton(id.toObjectId()); HashSet<ObjectId> matches = new HashSet<>(4); PackList packList = db.getPackList(); resolveImpl(packList, id, matches); if (matches.size() < MAX_RESOLVE_MATCHES && packList.dirty()) { stats.scanPacks++; resolveImpl(db.scanPacks(packList), id, matches); } return matches; }
@Override public boolean has(AnyObjectId objectId) throws IOException { if (last != null && last.hasObject(this, objectId)) return true; boolean noGarbage = avoidUnreachable; PackList packList = db.getPackList(); if (hasImpl(packList, objectId, noGarbage)) { return true; } else if (packList.dirty()) { return hasImpl(db.scanPacks(packList), objectId, noGarbage); } return false; }
/** {@inheritDoc} */ @Override public boolean has(AnyObjectId objectId) throws IOException { if (last != null && !skipGarbagePack(last) && last.hasObject(this, objectId)) return true; PackList packList = db.getPackList(); if (hasImpl(packList, objectId)) { return true; } else if (packList.dirty()) { stats.scanPacks++; return hasImpl(db.scanPacks(packList), objectId); } return false; }
/** {@inheritDoc} */ @Override public long getObjectSize(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException { if (last != null && !skipGarbagePack(last)) { long sz = last.getObjectSize(this, objectId); if (0 <= sz) { return sz; } } PackList packList = db.getPackList(); long sz = getObjectSizeImpl(packList, objectId); if (0 <= sz) { return sz; } if (packList.dirty()) { sz = getObjectSizeImpl(packList, objectId); if (0 <= sz) { return sz; } } if (typeHint == OBJ_ANY) { throw new MissingObjectException(objectId.copy(), JGitText.get().unknownObjectType2); } throw new MissingObjectException(objectId.copy(), typeHint); }
@Override public long getObjectSize(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException { if (last != null) { long sz = last.getObjectSize(this, objectId); if (0 <= sz) { return sz; } } PackList packList = db.getPackList(); long sz = getObjectSizeImpl(packList, objectId); if (0 <= sz) { return sz; } if (packList.dirty()) { sz = getObjectSizeImpl(packList, objectId); if (0 <= sz) { return sz; } } if (typeHint == OBJ_ANY) { throw new MissingObjectException(objectId.copy(), JGitText.get().unknownObjectType2); } throw new MissingObjectException(objectId.copy(), typeHint); }
@Override public ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException { ObjectLoader ldr; if (last != null) { ldr = last.get(this, objectId); if (ldr != null) { return checkType(ldr, objectId, typeHint); } } PackList packList = db.getPackList(); boolean noGarbage = avoidUnreachable; ldr = openImpl(packList, objectId, noGarbage); if (ldr != null) { return checkType(ldr, objectId, typeHint); } if (packList.dirty()) { ldr = openImpl(db.scanPacks(packList), objectId, noGarbage); if (ldr != null) { return checkType(ldr, objectId, typeHint); } } if (typeHint == OBJ_ANY) throw new MissingObjectException(objectId.copy(), JGitText.get().unknownObjectType2); throw new MissingObjectException(objectId.copy(), typeHint); }
/** {@inheritDoc} */ @Override public ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException { ObjectLoader ldr; if (last != null && !skipGarbagePack(last)) { ldr = last.get(this, objectId); if (ldr != null) { return checkType(ldr, objectId, typeHint); } } PackList packList = db.getPackList(); ldr = openImpl(packList, objectId); if (ldr != null) { return checkType(ldr, objectId, typeHint); } if (packList.dirty()) { stats.scanPacks++; ldr = openImpl(db.scanPacks(packList), objectId); if (ldr != null) { return checkType(ldr, objectId, typeHint); } } if (typeHint == OBJ_ANY) throw new MissingObjectException(objectId.copy(), JGitText.get().unknownObjectType2); throw new MissingObjectException(objectId.copy(), typeHint); }