/** * 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()); }
out.print(name.isEmpty()? "/": name); out.print(": quota="); out.print(getSnapshotQuota());
dir.getChildrenNum(Snapshot.CURRENT_STATE_ID), dir.getDirectorySnapshottableFeature().getNumSnapshots(), dir.getDirectorySnapshottableFeature().getSnapshotQuota(), dir.getParent() == null ? DFSUtilClient.EMPTY_BYTES : DFSUtil.string2Bytes(dir.getParent().getFullPathName()));
public static SnapshottableDirectoryStatus.Bean toBean(INodeDirectory d) { return new SnapshottableDirectoryStatus.Bean( d.getFullPathName(), d.getDirectorySnapshottableFeature().getNumSnapshots(), d.getDirectorySnapshottableFeature().getSnapshotQuota(), d.getModificationTime(), Short.valueOf(Integer.toOctalString( d.getFsPermissionShort())), d.getUserName(), d.getGroupName()); }
if (parent.getDirectorySnapshottableFeature().getSnapshotQuota() > 0) {
/** * 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()); }
out.print(name.isEmpty()? "/": name); out.print(": quota="); out.print(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()); }
out.print(name.isEmpty()? "/": name); out.print(": quota="); out.print(getSnapshotQuota());
dir.getChildrenNum(Snapshot.CURRENT_STATE_ID), dir.getDirectorySnapshottableFeature().getNumSnapshots(), dir.getDirectorySnapshottableFeature().getSnapshotQuota(), dir.getParent() == null ? DFSUtil.EMPTY_BYTES : DFSUtil.string2Bytes(dir.getParent().getFullPathName()));
dir.getChildrenNum(Snapshot.CURRENT_STATE_ID), dir.getDirectorySnapshottableFeature().getNumSnapshots(), dir.getDirectorySnapshottableFeature().getSnapshotQuota(), dir.getParent() == null ? DFSUtil.EMPTY_BYTES : DFSUtil.string2Bytes(dir.getParent().getFullPathName()));
public static SnapshottableDirectoryStatus.Bean toBean(INodeDirectory d) { return new SnapshottableDirectoryStatus.Bean( d.getFullPathName(), d.getDirectorySnapshottableFeature().getNumSnapshots(), d.getDirectorySnapshottableFeature().getSnapshotQuota(), d.getModificationTime(), Short.valueOf(Integer.toOctalString( d.getFsPermissionShort())), d.getUserName(), d.getGroupName()); }
public static SnapshottableDirectoryStatus.Bean toBean(INodeDirectory d) { return new SnapshottableDirectoryStatus.Bean( d.getFullPathName(), d.getDirectorySnapshottableFeature().getNumSnapshots(), d.getDirectorySnapshottableFeature().getSnapshotQuota(), d.getModificationTime(), Short.valueOf(Integer.toOctalString( d.getFsPermissionShort())), d.getUserName(), d.getGroupName()); }
if (parent.getDirectorySnapshottableFeature().getSnapshotQuota() > 0) {
if (parent.getDirectorySnapshottableFeature().getSnapshotQuota() > 0) {
.getSnapshotQuota()); assertTrue(rootNode.isSnapshottable()); assertEquals(DirectorySnapshottableFeature.SNAPSHOT_LIMIT, rootNode.getDirectorySnapshottableFeature().getSnapshotQuota()); assertTrue(rootNode.isSnapshottable()); assertEquals(DirectorySnapshottableFeature.SNAPSHOT_LIMIT, rootNode.getDirectorySnapshottableFeature().getSnapshotQuota()); rootNode = fsdir.getINode4Write(root.toString()).asDirectory(); assertTrue(rootNode.isSnapshottable()); assertEquals(0, rootNode.getDirectorySnapshottableFeature().getSnapshotQuota()); assertEquals(0, rootNode.getDirectorySnapshottableFeature().getSnapshotQuota());