code: private void afterIndexFsync(Result<Boolean> result,
                                 FsyncType fsyncType,
                                 ArrayList<SegmentFsyncCallback> fsyncListeners)
    {
      try {
        // completePendingEntries(_position);
        if (fsyncType.isClose()) {
          _isClosed = true;
          _segment.finishWriting();
  
          if (_pendingFlushEntries.size() > 0 || _pendingFsyncEntries.size() > 0) {
            System.out.println("BROKEN_PEND: flush="
                               + _pendingFlushEntries.size()
                               + " fsync=" + _pendingFsyncEntries.size()
                               + " " + _pendingFlushEntries);
          }
  
          _readWrite.afterSequenceClose(_segment.getSequence());
        }
  
        for (SegmentFsyncCallback listener : _fsyncListeners) {
          listener.onFsync();
        }
  
        result.ok(true);
      } catch (Throwable exn) {
        result.fail(exn);
      }
    }
docs: Callback after the index has been flushed.