/** * Write {@link #snapshotCounter}, {@link #numSnapshots}, * and all snapshots to the DataOutput. */ public void write(DataOutput out) throws IOException { out.writeInt(snapshotCounter); out.writeInt(numSnapshots.get()); // write all snapshots. for(INodeDirectory snapshottableDir : snapshottables.values()) { for (Snapshot s : snapshottableDir.getDirectorySnapshottableFeature() .getSnapshotList()) { s.write(out); } } }
@Override // SnapshotStatsMXBean public SnapshotInfo.Bean[] getSnapshots() { List<SnapshotInfo.Bean> beans = new ArrayList<SnapshotInfo.Bean>(); for (INodeDirectory d : getSnapshottableDirs()) { for (Snapshot s : d.getDirectorySnapshottableFeature().getSnapshotList()) { beans.add(toBean(s)); } } return beans.toArray(new SnapshotInfo.Bean[beans.size()]); }
/** * Save snapshots and snapshot quota for a snapshottable directory. * @param current The directory that the snapshots belongs to. * @param out The {@link DataOutput} to write. * @throws IOException */ public static void saveSnapshots(INodeDirectory current, DataOutput out) throws IOException { DirectorySnapshottableFeature sf = current.getDirectorySnapshottableFeature(); Preconditions.checkArgument(sf != null); // list of snapshots in snapshotsByNames ReadOnlyList<Snapshot> snapshots = sf.getSnapshotList(); out.writeInt(snapshots.size()); for (Snapshot s : snapshots) { // write the snapshot id out.writeInt(s.getId()); } // snapshot quota out.writeInt(sf.getSnapshotQuota()); }
for (DirectorySnapshottableFeature sf : lsf) { final ReadOnlyList<Snapshot> lsnap = sf.getSnapshotList(); for (Snapshot s : lsnap) {
"Directory is not a snapshottable directory: " + dirPath); final ReadOnlyList<Snapshot> snapshots = sf.getSnapshotList(); int skipSize = ReadOnlyList.Util.binarySearch(snapshots, startAfter); skipSize = skipSize < 0 ? -skipSize - 1 : skipSize + 1;
/** * Write {@link #snapshotCounter}, {@link #numSnapshots}, * and all snapshots to the DataOutput. */ public void write(DataOutput out) throws IOException { out.writeInt(snapshotCounter); out.writeInt(numSnapshots.get()); // write all snapshots. for(INodeDirectory snapshottableDir : snapshottables.values()) { for (Snapshot s : snapshottableDir.getDirectorySnapshottableFeature() .getSnapshotList()) { s.write(out); } } }
@Override // SnapshotStatsMXBean public SnapshotInfo.Bean[] getSnapshots() { List<SnapshotInfo.Bean> beans = new ArrayList<SnapshotInfo.Bean>(); for (INodeDirectory d : getSnapshottableDirs()) { for (Snapshot s : d.getDirectorySnapshottableFeature().getSnapshotList()) { beans.add(toBean(s)); } } return beans.toArray(new SnapshotInfo.Bean[beans.size()]); }
for(INodeDirectory sdir : snapshottables) { for (Snapshot s : sdir.getDirectorySnapshottableFeature() .getSnapshotList()) { Root sroot = s.getRoot(); SnapshotSection.Snapshot.Builder sb = SnapshotSection.Snapshot
@Override // SnapshotStatsMXBean public SnapshotInfo.Bean[] getSnapshots() { List<SnapshotInfo.Bean> beans = new ArrayList<SnapshotInfo.Bean>(); for (INodeDirectory d : getSnapshottableDirs()) { for (Snapshot s : d.getDirectorySnapshottableFeature().getSnapshotList()) { beans.add(toBean(s)); } } return beans.toArray(new SnapshotInfo.Bean[beans.size()]); }
/** * Write {@link #snapshotCounter}, {@link #numSnapshots}, * and all snapshots to the DataOutput. */ public void write(DataOutput out) throws IOException { out.writeInt(snapshotCounter); out.writeInt(numSnapshots.get()); // write all snapshots. for(INodeDirectory snapshottableDir : snapshottables.values()) { for (Snapshot s : snapshottableDir.getDirectorySnapshottableFeature() .getSnapshotList()) { s.write(out); } } }
/** * Save snapshots and snapshot quota for a snapshottable directory. * @param current The directory that the snapshots belongs to. * @param out The {@link DataOutput} to write. * @throws IOException */ public static void saveSnapshots(INodeDirectory current, DataOutput out) throws IOException { DirectorySnapshottableFeature sf = current.getDirectorySnapshottableFeature(); Preconditions.checkArgument(sf != null); // list of snapshots in snapshotsByNames ReadOnlyList<Snapshot> snapshots = sf.getSnapshotList(); out.writeInt(snapshots.size()); for (Snapshot s : snapshots) { // write the snapshot id out.writeInt(s.getId()); } // snapshot quota out.writeInt(sf.getSnapshotQuota()); }
/** * Save snapshots and snapshot quota for a snapshottable directory. * @param current The directory that the snapshots belongs to. * @param out The {@link DataOutput} to write. * @throws IOException */ public static void saveSnapshots(INodeDirectory current, DataOutput out) throws IOException { DirectorySnapshottableFeature sf = current.getDirectorySnapshottableFeature(); Preconditions.checkArgument(sf != null); // list of snapshots in snapshotsByNames ReadOnlyList<Snapshot> snapshots = sf.getSnapshotList(); out.writeInt(snapshots.size()); for (Snapshot s : snapshots) { // write the snapshot id out.writeInt(s.getId()); } // snapshot quota out.writeInt(sf.getSnapshotQuota()); }
"Directory is not a snapshottable directory: " + dirPath); final ReadOnlyList<Snapshot> snapshots = sf.getSnapshotList(); int skipSize = ReadOnlyList.Util.binarySearch(snapshots, startAfter); skipSize = skipSize < 0 ? -skipSize - 1 : skipSize + 1;
"Directory is not a snapshottable directory: " + dirPath); final ReadOnlyList<Snapshot> snapshots = sf.getSnapshotList(); int skipSize = ReadOnlyList.Util.binarySearch(snapshots, startAfter); skipSize = skipSize < 0 ? -skipSize - 1 : skipSize + 1;
/** * Check the correctness of snapshot list within snapshottable dir */ private void checkSnapshotList(INodeDirectory srcRoot, String[] sortedNames, String[] names) { assertTrue(srcRoot.isSnapshottable()); ReadOnlyList<Snapshot> listByName = srcRoot .getDirectorySnapshottableFeature().getSnapshotList(); assertEquals(sortedNames.length, listByName.size()); for (int i = 0; i < listByName.size(); i++) { assertEquals(sortedNames[i], listByName.get(i).getRoot().getLocalName()); } List<DirectoryDiff> listByTime = srcRoot.getDiffs().asList(); assertEquals(names.length, listByTime.size()); for (int i = 0; i < listByTime.size(); i++) { Snapshot s = srcRoot.getDirectorySnapshottableFeature().getSnapshotById( listByTime.get(i).getSnapshotId()); assertEquals(names[i], s.getRoot().getLocalName()); } }
for(INodeDirectory sdir : snapshottables) { for (Snapshot s : sdir.getDirectorySnapshottableFeature() .getSnapshotList()) { Root sroot = s.getRoot(); SnapshotSection.Snapshot.Builder sb = SnapshotSection.Snapshot
for(INodeDirectory sdir : snapshottables) { for (Snapshot s : sdir.getDirectorySnapshottableFeature() .getSnapshotList()) { Root sroot = s.getRoot(); SnapshotSection.Snapshot.Builder sb = SnapshotSection.Snapshot