Codota Logo
RecentChunks.get
Code IndexAdd Codota to your IDE (free)

How to use
get
method
in
org.eclipse.jgit.storage.dht.RecentChunks

Best Java code snippets using org.eclipse.jgit.storage.dht.RecentChunks.get (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

PackChunk getChunk(ChunkKey key) throws DhtException {
  PackChunk chunk = recentChunks.get(key);
  if (chunk != null)
    return chunk;
  chunk = load(key);
  if (chunk != null)
    return chunk;
  throw new DhtMissingChunkException(key);
}
origin: com.madgag/org.eclipse.jgit.storage.dht

PackChunk getChunk(ChunkKey key) throws DhtException {
  PackChunk chunk = recentChunks.get(key);
  if (chunk != null)
    return chunk;
  chunk = load(key);
  if (chunk != null)
    return chunk;
  throw new DhtMissingChunkException(key);
}
origin: com.madgag/org.eclipse.jgit.storage.dht

ChunkAndOffset find(RepositoryKey repo, AnyObjectId objId) {
  if (objId instanceof IdWithChunk) {
    PackChunk chunk = get(((IdWithChunk) objId).getChunkKey());
    if (chunk != null) {
      int pos = chunk.findOffset(repo, objId);
      if (0 <= pos)
        return new ChunkAndOffset(chunk, pos);
    }
    // IdWithChunk is only a hint, and can be wrong. Locally
    // searching is faster than looking in the Database.
  }
  for (Node n = lruHead; n != null; n = n.next) {
    int pos = n.chunk.findOffset(repo, objId);
    if (0 <= pos) {
      hit(n);
      stats.recentChunks_Hits++;
      return new ChunkAndOffset(n.chunk, pos);
    }
  }
  return null;
}
origin: com.madgag/org.eclipse.jgit.storage.dht

ObjectLoader open(RepositoryKey repo, AnyObjectId objId, int typeHint)
    throws IOException {
  if (objId instanceof IdWithChunk) {
    PackChunk chunk = get(((IdWithChunk) objId).getChunkKey());
    if (chunk != null) {
      int pos = chunk.findOffset(repo, objId);
      if (0 <= pos)
        return PackChunk.read(chunk, pos, reader, typeHint);
    }
    // IdWithChunk is only a hint, and can be wrong. Locally
    // searching is faster than looking in the Database.
  }
  for (Node n = lruHead; n != null; n = n.next) {
    int pos = n.chunk.findOffset(repo, objId);
    if (0 <= pos) {
      hit(n);
      stats.recentChunks_Hits++;
      return PackChunk.read(n.chunk, pos, reader, typeHint);
    }
  }
  return null;
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

ChunkAndOffset find(RepositoryKey repo, AnyObjectId objId) {
  if (objId instanceof IdWithChunk) {
    PackChunk chunk = get(((IdWithChunk) objId).getChunkKey());
    if (chunk != null) {
      int pos = chunk.findOffset(repo, objId);
      if (0 <= pos)
        return new ChunkAndOffset(chunk, pos);
    }
    // IdWithChunk is only a hint, and can be wrong. Locally
    // searching is faster than looking in the Database.
  }
  for (Node n = lruHead; n != null; n = n.next) {
    int pos = n.chunk.findOffset(repo, objId);
    if (0 <= pos) {
      hit(n);
      stats.recentChunks_Hits++;
      return new ChunkAndOffset(n.chunk, pos);
    }
  }
  return null;
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

ObjectLoader open(RepositoryKey repo, AnyObjectId objId, int typeHint)
    throws IOException {
  if (objId instanceof IdWithChunk) {
    PackChunk chunk = get(((IdWithChunk) objId).getChunkKey());
    if (chunk != null) {
      int pos = chunk.findOffset(repo, objId);
      if (0 <= pos)
        return PackChunk.read(chunk, pos, reader, typeHint);
    }
    // IdWithChunk is only a hint, and can be wrong. Locally
    // searching is faster than looking in the Database.
  }
  for (Node n = lruHead; n != null; n = n.next) {
    int pos = n.chunk.findOffset(repo, objId);
    if (0 <= pos) {
      hit(n);
      stats.recentChunks_Hits++;
      return PackChunk.read(n.chunk, pos, reader, typeHint);
    }
  }
  return null;
}
origin: com.madgag/org.eclipse.jgit.storage.dht

public void copyObjectAsIs(PackOutputStream out, ObjectToPack otp,
    boolean validate) throws IOException,
    StoredObjectRepresentationNotAvailableException {
  DhtObjectToPack obj = (DhtObjectToPack) otp;
  try {
    PackChunk chunk = recentChunks.get(obj.chunk);
    if (chunk == null) {
      chunk = prefetcher.get(obj.chunk);
      if (chunk == null) {
        // This should never happen during packing, it implies
        // the fetch plan was incorrect. Unfortunately that can
        // occur if objects need to be recompressed on the fly.
        //
        stats.access(obj.chunk).cntCopyObjectAsIs_PrefetchMiss++;
        chunk = getChunk(obj.chunk);
      }
      if (!chunk.isFragment())
        recentChunk(chunk);
    }
    chunk.copyObjectAsIs(out, obj, validate, this);
  } catch (DhtMissingChunkException missingChunk) {
    stats.access(missingChunk.getChunkKey()).cntCopyObjectAsIs_InvalidChunk++;
    throw new StoredObjectRepresentationNotAvailableException(otp);
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

public void copyObjectAsIs(PackOutputStream out, ObjectToPack otp,
    boolean validate) throws IOException,
    StoredObjectRepresentationNotAvailableException {
  DhtObjectToPack obj = (DhtObjectToPack) otp;
  try {
    PackChunk chunk = recentChunks.get(obj.chunk);
    if (chunk == null) {
      chunk = prefetcher.get(obj.chunk);
      if (chunk == null) {
        // This should never happen during packing, it implies
        // the fetch plan was incorrect. Unfortunately that can
        // occur if objects need to be recompressed on the fly.
        //
        stats.access(obj.chunk).cntCopyObjectAsIs_PrefetchMiss++;
        chunk = getChunk(obj.chunk);
      }
      if (!chunk.isFragment())
        recentChunk(chunk);
    }
    chunk.copyObjectAsIs(out, obj, validate, this);
  } catch (DhtMissingChunkException missingChunk) {
    stats.access(missingChunk.getChunkKey()).cntCopyObjectAsIs_InvalidChunk++;
    throw new StoredObjectRepresentationNotAvailableException(otp);
  }
}
org.eclipse.jgit.storage.dhtRecentChunksget

Popular methods of RecentChunks

  • <init>
  • clear
  • find
  • first
  • has
  • hit
  • open
  • prune
  • put
  • remove
  • setMaxBytes
  • setMaxBytes

Popular in Java

  • Making http post requests using okhttp
  • setRequestProperty (URLConnection)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • putExtra (Intent)
  • Kernel (java.awt.image)
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • JComboBox (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now