Codota Logo
DeltaBaseCache
Code IndexAdd Codota to your IDE (free)

How to use
DeltaBaseCache
in
org.eclipse.jgit.storage.dht

Best Java code snippets using org.eclipse.jgit.storage.dht.DeltaBaseCache (Showing top 16 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: com.madgag/org.eclipse.jgit.storage.dht

private void removeFromTable(Slot e) {
  int tableIdx = hash(e.chunkKey, e.offset);
  Slot p = table[tableIdx];
  if (p == e) {
    table[tableIdx] = e.tableNext;
    return;
  }
  for (; p != null; p = p.tableNext) {
    if (p.tableNext == e) {
      p.tableNext = e.tableNext;
      return;
    }
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

private void releaseMemory() {
  while (curByteCount > maxByteCount && lruTail != null) {
    Slot currOldest = lruTail;
    Slot nextOldest = currOldest.lruPrev;
    curByteCount -= currOldest.size;
    unlink(currOldest);
    removeFromTable(currOldest);
    if (nextOldest == null)
      lruHead = null;
    else
      nextOldest.lruNext = null;
    lruTail = nextOldest;
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

void put(ChunkKey key, int offset, int objectType, byte[] data) {
  if (data.length > maxByteCount)
    return; // Too large to cache.
  curByteCount += data.length;
  releaseMemory();
  int tableIdx = hash(key, offset);
  Slot e = new Slot(key, offset, data.length);
  e.data = new SoftReference<Entry>(new Entry(data, objectType));
  e.tableNext = table[tableIdx];
  table[tableIdx] = e;
  moveToHead(e);
}
origin: com.madgag/org.eclipse.jgit.storage.dht

Entry get(ChunkKey key, int position) {
  Slot e = table[hash(key, position)];
  for (; e != null; e = e.tableNext) {
    if (e.offset == position && key.equals(e.chunkKey)) {
      Entry buf = e.data.get();
      if (buf != null) {
        moveToHead(e);
        stats.deltaBaseCache_Hits++;
        return buf;
      }
    }
  }
  stats.deltaBaseCache_Miss++;
  return null;
}
origin: com.madgag/org.eclipse.jgit.storage.dht

private void moveToHead(final Slot e) {
  unlink(e);
  e.lruPrev = null;
  e.lruNext = lruHead;
  if (lruHead != null)
    lruHead.lruPrev = e;
  else
    lruTail = e;
  lruHead = e;
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

  void putBase(DhtReader ctx, int type, byte[] data) {
    ctx.getDeltaBaseCache().put(baseChunk, basePos, type, data);
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

DhtReader(DhtObjDatabase objdb) {
  this.repository = objdb.getRepository();
  this.repo = objdb.getRepository().getRepositoryKey();
  this.db = objdb.getDatabase();
  this.readerOptions = objdb.getReaderOptions();
  this.inserterOptions = objdb.getInserterOptions();
  this.stats = new Statistics();
  this.recentInfo = new RecentInfoCache(getOptions());
  this.recentChunks = new RecentChunks(this);
  this.deltaBaseCache = new DeltaBaseCache(this);
}
origin: com.madgag/org.eclipse.jgit.storage.dht

DeltaBaseCache.Entry getBase(DhtReader ctx) {
  return ctx.getDeltaBaseCache().get(baseChunk, basePos);
}
origin: com.madgag/org.eclipse.jgit.storage.dht

void put(ChunkKey key, int offset, int objectType, byte[] data) {
  if (data.length > maxByteCount)
    return; // Too large to cache.
  curByteCount += data.length;
  releaseMemory();
  int tableIdx = hash(key, offset);
  Slot e = new Slot(key, offset, data.length);
  e.data = new SoftReference<Entry>(new Entry(data, objectType));
  e.tableNext = table[tableIdx];
  table[tableIdx] = e;
  moveToHead(e);
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

Entry get(ChunkKey key, int position) {
  Slot e = table[hash(key, position)];
  for (; e != null; e = e.tableNext) {
    if (e.offset == position && key.equals(e.chunkKey)) {
      Entry buf = e.data.get();
      if (buf != null) {
        moveToHead(e);
        stats.deltaBaseCache_Hits++;
        return buf;
      }
    }
  }
  stats.deltaBaseCache_Miss++;
  return null;
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

private void moveToHead(final Slot e) {
  unlink(e);
  e.lruPrev = null;
  e.lruNext = lruHead;
  if (lruHead != null)
    lruHead.lruPrev = e;
  else
    lruTail = e;
  lruHead = e;
}
origin: com.madgag/org.eclipse.jgit.storage.dht

  void putBase(DhtReader ctx, int type, byte[] data) {
    ctx.getDeltaBaseCache().put(baseChunk, basePos, type, data);
  }
}
origin: com.madgag/org.eclipse.jgit.storage.dht

DhtReader(DhtObjDatabase objdb) {
  this.repository = objdb.getRepository();
  this.repo = objdb.getRepository().getRepositoryKey();
  this.db = objdb.getDatabase();
  this.readerOptions = objdb.getReaderOptions();
  this.inserterOptions = objdb.getInserterOptions();
  this.stats = new Statistics();
  this.recentInfo = new RecentInfoCache(getOptions());
  this.recentChunks = new RecentChunks(this);
  this.deltaBaseCache = new DeltaBaseCache(this);
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

DeltaBaseCache.Entry getBase(DhtReader ctx) {
  return ctx.getDeltaBaseCache().get(baseChunk, basePos);
}
origin: com.madgag/org.eclipse.jgit.storage.dht

private void releaseMemory() {
  while (curByteCount > maxByteCount && lruTail != null) {
    Slot currOldest = lruTail;
    Slot nextOldest = currOldest.lruPrev;
    curByteCount -= currOldest.size;
    unlink(currOldest);
    removeFromTable(currOldest);
    if (nextOldest == null)
      lruHead = null;
    else
      nextOldest.lruNext = null;
    lruTail = nextOldest;
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

private void removeFromTable(Slot e) {
  int tableIdx = hash(e.chunkKey, e.offset);
  Slot p = table[tableIdx];
  if (p == e) {
    table[tableIdx] = e.tableNext;
    return;
  }
  for (; p != null; p = p.tableNext) {
    if (p.tableNext == e) {
      p.tableNext = e.tableNext;
      return;
    }
  }
}
org.eclipse.jgit.storage.dhtDeltaBaseCache

Javadoc

Caches recently used objects for DhtReader.

This cache is not thread-safe. Each reader should have its own cache.

Most used methods

  • <init>
  • get
  • hash
  • moveToHead
  • put
  • releaseMemory
  • removeFromTable
  • unlink

Popular in Java

  • Start an intent from android
  • putExtra (Intent)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • requestLocationUpdates (LocationManager)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Notification (javax.management)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
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