@Override public void delete() { Long gen = delegate.getGeneration(); Long reserve = reserves.get(gen); if (reserve != null && System.currentTimeMillis() < reserve) return; if (savedCommits.containsKey(gen)) return; delegate.delete(); }
private String getId(IndexCommit commit) { StringBuilder sb = new StringBuilder(); Directory dir = commit.getDirectory(); // For anything persistent, make something that will // be the same, regardless of the Directory instance. if (dir instanceof FSDirectory) { FSDirectory fsd = (FSDirectory) dir; File fdir = fsd.getDirectory(); sb.append(fdir.getPath()); } else { sb.append(dir); } sb.append('/'); sb.append(commit.getGeneration()); sb.append('_'); sb.append(commit.getVersion()); return sb.toString(); }
static String str(IndexCommit commit) { StringBuilder sb = new StringBuilder(); try { sb.append("commit{"); Directory dir = commit.getDirectory(); if (dir instanceof FSDirectory) { FSDirectory fsd = (FSDirectory) dir; sb.append("dir=").append(fsd.getDirectory()); } else { sb.append("dir=").append(dir); } sb.append(",segFN=").append(commit.getSegmentsFileName()); sb.append(",version=").append(commit.getVersion()); sb.append(",generation=").append(commit.getGeneration()); sb.append(",filenames=").append(commit.getFileNames()); } catch (Exception e) { sb.append(e); } return sb.toString(); }
@Override public long getGeneration() { return delegate.getGeneration(); }