public Long mostRecentVersion(long maxVersion) throws IOException { List<Long> all = getAllVersions(); for (Long v : all) { if (v <= maxVersion) { return v; } } return null; }
public Long mostRecentVersion() throws IOException { List<Long> all = getAllVersions(); if (all.size() == 0) { return null; } return all.get(0); }
public String createVersion(long version) throws IOException { String ret = versionPath(version); if (getAllVersions().contains(version)) { throw new RuntimeException("Version already exists or data already exists"); } else { return ret; } }
public void cleanup(int versionsToKeep) throws IOException { List<Long> versions = getAllVersions(); if (versionsToKeep >= 0) { versions = versions.subList(0, Math.min(versions.size(), versionsToKeep)); } HashSet<Long> keepers = new HashSet<Long>(versions); for (String p : listDir(_root)) { Long v = parseVersion(p); if (v != null && !keepers.contains(v)) { deleteVersion(v); } } }
public Long mostRecentVersion(long maxVersion) throws IOException { List<Long> all = getAllVersions(); for(Long v: all) { if(v <= maxVersion) return v; } return null; }
public Long mostRecentVersion() throws IOException { List<Long> all = getAllVersions(); if(all.size()==0) return null; return all.get(0); }
public String createVersion(long version) throws IOException { String ret = versionPath(version); if(getAllVersions().contains(version)) throw new RuntimeException("Version already exists or data already exists"); else return ret; }
public void cleanup(int versionsToKeep) throws IOException { List<Long> versions = getAllVersions(); if(versionsToKeep >= 0) { versions = versions.subList(0, Math.min(versions.size(), versionsToKeep)); } HashSet<Long> keepers = new HashSet<Long>(versions); for(String p: listDir(_root)) { Long v = parseVersion(p); if(v!=null && !keepers.contains(v)) { deleteVersion(v); } } }