/** * Load the created list from fsimage. * @param parent The directory that the created list belongs to. * @param in The {@link DataInput} to read. * @return The created list. */ private static List<INode> loadCreatedList(INodeDirectory parent, DataInput in) throws IOException { // read the size of the created list int createdSize = in.readInt(); List<INode> createdList = new ArrayList<INode>(createdSize); for (int i = 0; i < createdSize; i++) { byte[] createdNodeName = FSImageSerialization.readLocalName(in); INode created = loadCreated(createdNodeName, parent); createdList.add(created); } return createdList; }
INodeDirectoryAttributes snapshotINode = loadSnapshotINodeInDirectoryDiff( snapshot, in, loader); List<INode> createdList = loadCreatedList(parent, in); List<INode> deletedList = loadDeletedList(parent, createdList, in, loader);
/** * Load the {@link SnapshotDiff} list for the INodeDirectoryWithSnapshot * directory. * * @param dir * The snapshottable directory for loading. * @param in * The {@link DataInput} instance to read. * @param loader * The loader */ public static void loadDirectoryDiffList(INodeDirectory dir, DataInput in, FSImageFormat.Loader loader) throws IOException { final int size = in.readInt(); if (dir.isWithSnapshot()) { DirectoryDiffList diffs = dir.getDiffs(); for (int i = 0; i < size; i++) { diffs.addFirst(loadDirectoryDiff(dir, in, loader)); } } }
if (numSnapshots >= 0) { SnapshotFSImageFormat.loadSnapshotList(parent, numSnapshots, in, this); if (parent.getDirectorySnapshottableFeature().getSnapshotQuota() > 0) { SnapshotFSImageFormat.loadDirectoryDiffList(parent, in, this);
SnapshotFSImageFormat.saveSnapshots(current.asDirectory(), out); } else { out.writeInt(-1); // # of snapshots SnapshotFSImageFormat.saveDirectoryDiffList(current, out, referenceMap);
public static FileDiffList loadFileDiffList(DataInput in, FSImageFormat.Loader loader) throws IOException { final int size = in.readInt(); if (size == -1) { return null; } else { final FileDiffList diffs = new FileDiffList(); FileDiff posterior = null; for(int i = 0; i < size; i++) { final FileDiff d = loadFileDiff(posterior, in, loader); diffs.addFirst(d); posterior = d; } return diffs; } }
LayoutVersion.Feature.SNAPSHOT, imgVersion)) { fileDiffs = SnapshotFSImageFormat.loadFileDiffList(in, this);
if (numSnapshots >= 0) { SnapshotFSImageFormat.loadSnapshotList(parent, numSnapshots, in, this); if (parent.getDirectorySnapshottableFeature().getSnapshotQuota() > 0) { SnapshotFSImageFormat.loadDirectoryDiffList(parent, in, this);
SnapshotFSImageFormat.saveSnapshots(current.asDirectory(), out); } else { out.writeInt(-1); // # of snapshots SnapshotFSImageFormat.saveDirectoryDiffList(current, out, referenceMap);
public static FileDiffList loadFileDiffList(DataInput in, FSImageFormat.Loader loader) throws IOException { final int size = in.readInt(); if (size == -1) { return null; } else { final FileDiffList diffs = new FileDiffList(); FileDiff posterior = null; for(int i = 0; i < size; i++) { final FileDiff d = loadFileDiff(posterior, in, loader); diffs.addFirst(d); posterior = d; } return diffs; } }
LayoutVersion.Feature.SNAPSHOT, imgVersion)) { fileDiffs = SnapshotFSImageFormat.loadFileDiffList(in, this);
INodeDirectoryAttributes snapshotINode = loadSnapshotINodeInDirectoryDiff( snapshot, in, loader); List<INode> createdList = loadCreatedList(parent, in); List<INode> deletedList = loadDeletedList(parent, createdList, in, loader);
if (numSnapshots >= 0) { SnapshotFSImageFormat.loadSnapshotList(parent, numSnapshots, in, this); if (parent.getDirectorySnapshottableFeature().getSnapshotQuota() > 0) { SnapshotFSImageFormat.loadDirectoryDiffList(parent, in, this);
SnapshotFSImageFormat.saveSnapshots(current.asDirectory(), out); } else { out.writeInt(-1); // # of snapshots SnapshotFSImageFormat.saveDirectoryDiffList(current, out, referenceMap);
/** Load the created list in a DirectoryDiff */ private List<INode> loadCreatedList(InputStream in, INodeDirectory dir, int size) throws IOException { List<INode> clist = new ArrayList<INode>(size); for (long c = 0; c < size; c++) { CreatedListEntry entry = CreatedListEntry.parseDelimitedFrom(in); INode created = SnapshotFSImageFormat.loadCreated(entry.getName() .toByteArray(), dir); clist.add(created); } return clist; }
public static FileDiffList loadFileDiffList(DataInput in, FSImageFormat.Loader loader) throws IOException { final int size = in.readInt(); if (size == -1) { return null; } else { final FileDiffList diffs = new FileDiffList(); FileDiff posterior = null; for(int i = 0; i < size; i++) { final FileDiff d = loadFileDiff(posterior, in, loader); diffs.addFirst(d); posterior = d; } return diffs; } }
/** * Load the {@link SnapshotDiff} list for the INodeDirectoryWithSnapshot * directory. * * @param dir * The snapshottable directory for loading. * @param in * The {@link DataInput} instance to read. * @param loader * The loader */ public static void loadDirectoryDiffList(INodeDirectory dir, DataInput in, FSImageFormat.Loader loader) throws IOException { final int size = in.readInt(); if (dir.isWithSnapshot()) { DirectoryDiffList diffs = dir.getDiffs(); for (int i = 0; i < size; i++) { diffs.addFirst(loadDirectoryDiff(dir, in, loader)); } } }
LayoutVersion.Feature.SNAPSHOT, imgVersion)) { fileDiffs = SnapshotFSImageFormat.loadFileDiffList(in, this);
INodeDirectoryAttributes snapshotINode = loadSnapshotINodeInDirectoryDiff( snapshot, in, loader); List<INode> createdList = loadCreatedList(parent, in); List<INode> deletedList = loadDeletedList(parent, createdList, in, loader);
/** Load the created list in a DirectoryDiff */ private List<INode> loadCreatedList(InputStream in, INodeDirectory dir, int size) throws IOException { List<INode> clist = new ArrayList<INode>(size); for (long c = 0; c < size; c++) { CreatedListEntry entry = CreatedListEntry.parseDelimitedFrom(in); INode created = SnapshotFSImageFormat.loadCreated(entry.getName() .toByteArray(), dir); clist.add(created); } return clist; }