public void trim()

in src/main/java/com/googlesource/gerrit/plugins/events/fsstore/FsStore.java [142:159]


  public void trim(long trim) throws IOException {
    if (cachedHead.isLessThanOrEqualTo(trim, MAX_GET_SPINS)) {
      long head = getHead();
      if (trim >= head) {
        trim = head - 1;
      }
    }
    if (trim > 0) {
      for (long i = getTail(); i <= trim; i++) {
        long delete = stores.tail.spinIncrement(MAX_INCREMENT_SPINS) - 1;
        Path event = paths.events.path(delete);
        Fs.tryRecursiveDelete(event);
        if (paths.events.isLastDirEntry(delete)) {
          Fs.unsafeRecursiveRmdir(event.getParent().toFile());
        }
      }
    }
  }