code: public int delete() {
          close();
         int count = segments.trunc(Integer.MAX_VALUE).size();
         Utils.deleteDirectory(dir);
         return count;
      }
docs: delete all log segments in this topic-partition
  <p>
  The log directory will be removed also.
  @return segment counts deleted