Ejemplo n.º 1
0
 private static int tableSize(final WindowCacheConfig cfg) {
   final int wsz = cfg.getPackedGitWindowSize();
   final long limit = cfg.getPackedGitLimit();
   if (wsz <= 0) throw new IllegalArgumentException("Invalid window size");
   if (limit < wsz) throw new IllegalArgumentException("Window size must be < limit");
   return (int) Math.min(5 * (limit / wsz) / 2, 2000000000);
 }
Ejemplo n.º 2
0
  private WindowCache(final WindowCacheConfig cfg) {
    super(tableSize(cfg), lockCount(cfg));
    maxFiles = cfg.getPackedGitOpenFiles();
    maxBytes = cfg.getPackedGitLimit();
    mmap = cfg.isPackedGitMMAP();
    windowSizeShift = bits(cfg.getPackedGitWindowSize());
    windowSize = 1 << windowSizeShift;

    openFiles = new AtomicInteger();
    openBytes = new AtomicLong();

    if (maxFiles < 1) throw new IllegalArgumentException("Open files must be >= 1");
    if (maxBytes < windowSize) throw new IllegalArgumentException("Window size must be < limit");
  }