Examples of ChunkMeta


Examples of org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkMeta

      } else {
        BlockList<ChunkKey> keys = new BlockList<ChunkKey>();
        for (ChunkKey key : allVisits.keySet()) {
          keys.add(key);

          ChunkMeta meta = allMeta.remove(key);
          if (meta != null) {
            for (int i = 1; i < meta.getFragmentCount(); i++)
              keys.add(ChunkKey.fromString(meta.getFragment(i)));
          }
        }
        order = keys;
      }
    }
View Full Code Here

Examples of org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkMeta

  private static byte[] encode(PackChunk.Members members) {
    // Its too slow to encode ByteBuffer through the standard code.
    // Since the message is only 3 fields, do it by hand.
    ByteBuffer data = members.getChunkDataAsByteBuffer();
    ByteBuffer index = members.getChunkIndexAsByteBuffer();
    ChunkMeta meta = members.getMeta();

    int sz = 0;
    if (data != null)
      sz += computeByteBufferSize(1, data);
    if (index != null)
View Full Code Here

Examples of org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkMeta

    }

    public void onPartialResult(Map<CacheKey, byte[]> result) {
      for (Map.Entry<CacheKey, byte[]> ent : result.entrySet()) {
        ChunkKey key = ChunkKey.fromBytes(ent.getKey().getBytes());
        ChunkMeta meta;
        try {
          meta = ChunkMeta.parseFrom(ent.getValue());
        } catch (InvalidProtocolBufferException e) {
          // Invalid meta message, remove the cell from cache.
          client.modify(singleton(Change.remove(ent.getKey())),
View Full Code Here

Examples of org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkMeta

      // Verify each long OFS_DELTA chunk appears at the right offset.
      // This is a cheap validation that the cached pack hasn't been
      // incorrectly created and would confuse the client.
      //
      long position = out.length();
      ChunkMeta meta = chunk.getMeta();
      if (meta != null && meta.getBaseChunkCount() != 0) {
        for (ChunkMeta.BaseChunk base : meta.getBaseChunkList()) {
          Long act = startsAt.get(base.getChunkKey());
          long exp = position - base.getRelativeStart();

          if (act == null) {
            throw new DhtException(MessageFormat.format(DhtText
View Full Code Here

Examples of org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkMeta

    ChunkKey firstChunkKey = fragmentList.get(0);

    ChunkMeta.Builder metaBuilder = ChunkMeta.newBuilder();
    for (ChunkKey k : fragmentList)
      metaBuilder.addFragment(k.asString());
    ChunkMeta meta = metaBuilder.build();

    for (ChunkKey key : fragmentList) {
      PackChunk.Members builder = new PackChunk.Members();
      builder.setChunkKey(key);
      builder.setMeta(meta);
View Full Code Here

Examples of org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkMeta

      DhtReader reader) throws DataFormatException, DhtException {
    byte[] dstbuf = newResult(sz);
    int dstoff = 0;

    final Inflater inf = reader.inflater();
    final ChunkMeta meta = pc.meta;
    int nextChunk = 1;

    int bs = pc.dataLen - pos - TRAILER_SIZE;
    inf.setInput(pc.dataBuf, pc.dataPtr + pos, bs);

    while (dstoff < dstbuf.length) {
      int n = inf.inflate(dstbuf, dstoff, dstbuf.length - dstoff);
      if (n == 0) {
        if (inf.needsInput()) {
          if (meta.getFragmentCount() <= nextChunk)
            break;
          pc = reader.getChunk(ChunkKey.fromString(
              meta.getFragment(nextChunk++)));
          if (meta.getFragmentCount() == nextChunk)
            bs = pc.dataLen; // Include trailer on last chunk.
          else
            bs = pc.dataLen - TRAILER_SIZE;
          inf.setInput(pc.dataBuf, pc.dataPtr, bs);
          continue;
        }
        break;
      }
      dstoff += n;
    }

    if (dstoff != sz) {
      throw new DataFormatException(MessageFormat.format(
          DhtText.get().shortCompressedObject,
          ChunkKey.fromString(meta.getFragment(0)),
          Integer.valueOf(pos)));
    }
    return dstbuf;
  }
View Full Code Here

Examples of org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkMeta

              - b.getRelativeStart());
        }
      });
      ChunkMeta.Builder b = ChunkMeta.newBuilder();
      b.addAllBaseChunk(list);
      ChunkMeta meta = b.build();
      builder.setMeta(meta);
      info.setMetaSize(meta.getSerializedSize());
    }

    if (objectList != null && !objectList.isEmpty()) {
      byte[] index = ChunkIndex.create(objectList);
      builder.setChunkIndex(index);
View Full Code Here

Examples of org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkMeta

    byte[] index = ChunkIndex.create(objectList);
    info.setIndexSize(index.length);
    builder.setChunkIndex(index);

    ChunkMeta meta = dirtyMeta.remove(key);
    if (meta == null)
      meta = chunkMeta.get(key);

    switch (type) {
    case OBJ_COMMIT: {
      Edges edges = chunkEdges.get(key);
      List<ChunkKey> e = edges != null ? edges.commitEdges : null;
      List<ChunkKey> s = sequentialHint(key, OBJ_COMMIT);
      if (e == null)
        e = Collections.emptyList();
      if (s == null)
        s = Collections.emptyList();
      if (!e.isEmpty() || !s.isEmpty()) {
        ChunkMeta.Builder m = edit(meta);
        ChunkMeta.PrefetchHint.Builder h = m.getCommitPrefetchBuilder();
        for (ChunkKey k : e)
          h.addEdge(k.asString());
        for (ChunkKey k : s)
          h.addSequential(k.asString());
        meta = m.build();
      }
      break;
    }
    case OBJ_TREE: {
      List<ChunkKey> s = sequentialHint(key, OBJ_TREE);
      if (s == null)
        s = Collections.emptyList();
      if (!s.isEmpty()) {
        ChunkMeta.Builder m = edit(meta);
        ChunkMeta.PrefetchHint.Builder h = m.getTreePrefetchBuilder();
        for (ChunkKey k : s)
          h.addSequential(k.asString());
        meta = m.build();
      }
      break;
    }
    }

    if (meta != null) {
      info.setMetaSize(meta.getSerializedSize());
      builder.setMeta(meta);
    }

    ChunkInfo newInfo = new ChunkInfo(key, info.build());
    infoByKey.put(key, newInfo);
View Full Code Here

Examples of org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkMeta

      currFragments.add(lastKey);

    ChunkMeta.Builder protoBuilder = ChunkMeta.newBuilder();
    for (ChunkKey key : currFragments)
      protoBuilder.addFragment(key.asString());
    ChunkMeta protoMeta = protoBuilder.build();

    for (ChunkKey key : currFragments) {
      ChunkMeta oldMeta = chunkMeta.get(key);
      if (oldMeta != null) {
        ChunkMeta.Builder newMeta = ChunkMeta.newBuilder(oldMeta);
        newMeta.clearFragment();
        newMeta.mergeFrom(protoMeta);
        ChunkMeta meta = newMeta.build();
        dirtyMeta.put(key, meta);
        chunkMeta.put(key, meta);
      } else {
        dirtyMeta.put(key, protoMeta);
        chunkMeta.put(key, protoMeta);
View Full Code Here

Examples of org.eclipse.jgit.generated.storage.dht.proto.GitStore.ChunkMeta

    // ChunkMeta for fragments is delayed writing, so it isn't available
    // on the chunk if the chunk was read-back from the database. Use
    // our copy of ChunkMeta instead of the PackChunk's copy.

    ChunkMeta meta = chunkMeta.get(dbChunk.getChunkKey());
    if (meta == null)
      return 0;

    ChunkKey next = ChunkMetaUtil.getNextFragment(meta, dbChunk.getChunkKey());
    if (next == null)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.