Package org.eclipse.jgit.internal.storage.file

Examples of org.eclipse.jgit.internal.storage.file.PackIndex


    pw.setReuseDeltaCommits(true);
    try {
      RevWalk pool = new RevWalk(ctx);
      pm.beginTask("Finding garbage", objectsBefore());
      for (DfsPackFile oldPack : packsBefore) {
        PackIndex oldIdx = oldPack.getPackIndex(ctx);
        for (PackIndex.MutableEntry ent : oldIdx) {
          pm.update(1);
          ObjectId id = ent.toObjectId();
          if (pool.lookupOrNull(id) != null || anyPackHas(id))
            continue;
View Full Code Here


  }

  private List<DfsObjectToPack> findAllFromPack(DfsPackFile pack,
      Iterable<ObjectToPack> objects) throws IOException {
    List<DfsObjectToPack> tmp = new BlockList<DfsObjectToPack>();
    PackIndex idx = pack.getPackIndex(this);
    for (ObjectToPack otp : objects) {
      long p = idx.findOffset(otp);
      if (0 < p) {
        otp.setOffset(p);
        tmp.add((DfsObjectToPack) otp);
      }
    }
View Full Code Here

    packOut.close();
    packOut = null;

    sortObjectsById();

    PackIndex index = writePackIndex(packDsc, packHash, objectList);
    db.commitPack(Collections.singletonList(packDsc), null);
    rollback = false;

    DfsPackFile p = cache.getOrCreate(packDsc, packKey);
    if (index != null)
View Full Code Here

    // If there are less than 58,000 objects, the entire index fits in under
    // 2 MiB. Callers will probably need the index immediately, so buffer
    // the index in process and load from the buffer.
    TemporaryBuffer.Heap buf = null;
    PackIndex packIndex = null;
    if (list.size() <= 58000) {
      buf = new TemporaryBuffer.Heap(2 << 20);
      index(buf, packHash, list);
      packIndex = PackIndex.read(buf.openInputStream());
    }
View Full Code Here

   * @return {@code this}.
   * @throws IOException
   *             pack index cannot be loaded.
   */
  public DfsPackCompactor exclude(DfsPackFile pack) throws IOException {
    final PackIndex idx;
    DfsReader ctx = (DfsReader) repo.newObjectReader();
    try {
      idx = pack.getPackIndex(ctx);
    } finally {
      ctx.release();
    }
    return exclude(new PackWriter.ObjectIdSet() {
      public boolean contains(AnyObjectId id) {
        return idx.hasObject(id);
      }
    });
  }
View Full Code Here

    pm.endTask();
  }

  private List<ObjectIdWithOffset> toInclude(DfsPackFile src, DfsReader ctx)
      throws IOException {
    PackIndex srcIdx = src.getPackIndex(ctx);
    List<ObjectIdWithOffset> want = new BlockList<ObjectIdWithOffset>(
        (int) srcIdx.getObjectCount());
    SCAN: for (PackIndex.MutableEntry ent : srcIdx) {
      ObjectId id = ent.toObjectId();
      RevObject obj = rw.lookupOrNull(id);
      if (obj != null && (obj.has(added) || obj.has(isBase)))
        continue;
View Full Code Here

  }

  private PackIndex idx(DfsReader ctx) throws IOException {
    DfsBlockCache.Ref<PackIndex> idxref = index;
    if (idxref != null) {
      PackIndex idx = idxref.get();
      if (idx != null)
        return idx;
    }

    if (invalid)
      throw new PackInvalidException(getPackName());

    Repository.getGlobalListenerList()
        .dispatch(new BeforeDfsPackIndexLoadedEvent(this));

    synchronized (initLock) {
      idxref = index;
      if (idxref != null) {
        PackIndex idx = idxref.get();
        if (idx != null)
          return idx;
      }

      PackIndex idx;
      try {
        ReadableChannel rc = ctx.db.openFile(packDesc, INDEX);
        try {
          InputStream in = Channels.newInputStream(rc);
          int wantSize = 8192;
View Full Code Here

        PackReverseIndex revidx = revref.get();
        if (revidx != null)
          return revidx;
      }

      PackIndex idx = idx(ctx);
      PackReverseIndex revidx = new PackReverseIndex(idx);
      int sz = (int) Math.min(
          idx.getObjectCount() * 8, Integer.MAX_VALUE);
      reverseIndex = cache.put(key, POS_REVERSE_INDEX, sz, revidx);
      return revidx;
    }
  }
View Full Code Here

  }

  private List<DfsObjectToPack> findAllFromPack(DfsPackFile pack,
      Iterable<ObjectToPack> objects) throws IOException {
    List<DfsObjectToPack> tmp = new BlockList<DfsObjectToPack>();
    PackIndex idx = pack.getPackIndex(this);
    for (ObjectToPack otp : objects) {
      long p = idx.findOffset(otp);
      if (0 < p) {
        otp.setOffset(p);
        tmp.add((DfsObjectToPack) otp);
      }
    }
View Full Code Here

  }

  private PackIndex idx(DfsReader ctx) throws IOException {
    DfsBlockCache.Ref<PackIndex> idxref = index;
    if (idxref != null) {
      PackIndex idx = idxref.get();
      if (idx != null)
        return idx;
    }

    if (invalid)
      throw new PackInvalidException(getPackName());

    Repository.getGlobalListenerList()
        .dispatch(new BeforeDfsPackIndexLoadedEvent(this));

    synchronized (initLock) {
      idxref = index;
      if (idxref != null) {
        PackIndex idx = idxref.get();
        if (idx != null)
          return idx;
      }

      PackIndex idx;
      try {
        ReadableChannel rc = ctx.db.openFile(packDesc, INDEX);
        try {
          InputStream in = Channels.newInputStream(rc);
          int wantSize = 8192;
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.internal.storage.file.PackIndex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.