@Override public int hashCode() { long result = getLength() ^ getFileCount() ^ getDirectoryCount() ^ getSnapshotLength() ^ getSnapshotFileCount() ^ getSnapshotDirectoryCount() ^ getSnapshotSpaceConsumed() ^ getErasureCodingPolicy().hashCode(); return ((int) result) ^ super.hashCode(); }
@Override public boolean equals(Object to) { if (this == to) { return true; } else if (to instanceof ContentSummary) { ContentSummary right = (ContentSummary) to; return getLength() == right.getLength() && getFileCount() == right.getFileCount() && getDirectoryCount() == right.getDirectoryCount() && getSnapshotLength() == right.getSnapshotLength() && getSnapshotFileCount() == right.getSnapshotFileCount() && getSnapshotDirectoryCount() == right.getSnapshotDirectoryCount() && getSnapshotSpaceConsumed() == right.getSnapshotSpaceConsumed() && getErasureCodingPolicy().equals(right.getErasureCodingPolicy()) && super.equals(to); } else { return super.equals(to); } }
@Override protected void processPath(PathData item) throws IOException { ContentSummary contentSummary = item.fs.getContentSummary(item.path); long length = contentSummary.getLength(); long spaceConsumed = contentSummary.getSpaceConsumed(); if (excludeSnapshots) { length -= contentSummary.getSnapshotLength(); spaceConsumed -= contentSummary.getSnapshotSpaceConsumed(); } getUsagesTable().addRow(formatSize(length), formatSize(spaceConsumed), item); } }
public static ContentSummaryProto convert(ContentSummary cs) { if (cs == null) return null; ContentSummaryProto.Builder builder = ContentSummaryProto.newBuilder(); builder.setLength(cs.getLength()). setFileCount(cs.getFileCount()). setDirectoryCount(cs.getDirectoryCount()). setSnapshotLength(cs.getSnapshotLength()). setSnapshotFileCount(cs.getSnapshotFileCount()). setSnapshotDirectoryCount(cs.getSnapshotDirectoryCount()). setSnapshotSpaceConsumed(cs.getSnapshotSpaceConsumed()). setQuota(cs.getQuota()). setSpaceConsumed(cs.getSpaceConsumed()). setSpaceQuota(cs.getSpaceQuota()). setErasureCodingPolicy(cs.getErasureCodingPolicy()); if (cs.isTypeQuotaSet() || cs.isTypeConsumedAvailable()) { builder.setTypeQuotaInfos(getBuilder(cs)); } return builder.build(); }