/** * Get statistics about this CachePool. * * @return Cache pool statistics. */ private CachePoolStats getStats() { return new CachePoolStats.Builder(). setBytesNeeded(bytesNeeded). setBytesCached(bytesCached). setBytesOverlimit(getBytesOverlimit()). setFilesNeeded(filesNeeded). setFilesCached(filesCached). build(); }
/** * Returns a CachePoolInfo describing this CachePool based on the permissions * of the calling user. Unprivileged users will see only minimal descriptive * information about the pool. * * @param pc Permission checker to be used to validate the user's permissions, * or null * @return CachePoolEntry describing this CachePool */ public CachePoolEntry getEntry(FSPermissionChecker pc) { boolean hasPermission = true; if (pc != null) { try { pc.checkPermission(this, FsAction.READ); } catch (AccessControlException e) { hasPermission = false; } } return new CachePoolEntry(getInfo(hasPermission), hasPermission ? getStats() : new CachePoolStats.Builder().build()); }
public static CachePoolStatsProto convert(CachePoolStats stats) { CachePoolStatsProto.Builder builder = CachePoolStatsProto.newBuilder(); builder.setBytesNeeded(stats.getBytesNeeded()); builder.setBytesCached(stats.getBytesCached()); builder.setBytesOverlimit(stats.getBytesOverlimit()); builder.setFilesNeeded(stats.getFilesNeeded()); builder.setFilesCached(stats.getFilesCached()); return builder.build(); }
public static CachePoolStats convert (CachePoolStatsProto proto) { CachePoolStats.Builder builder = new CachePoolStats.Builder(); builder.setBytesNeeded(proto.getBytesNeeded()); builder.setBytesCached(proto.getBytesCached()); builder.setBytesOverlimit(proto.getBytesOverlimit()); builder.setFilesNeeded(proto.getFilesNeeded()); builder.setFilesCached(proto.getFilesCached()); return builder.build(); }
public static CachePoolEntry convert (CachePoolEntryProto proto) { CachePoolInfo info = PBHelper.convert(proto.getInfo()); CachePoolStats stats = PBHelper.convert(proto.getStats()); return new CachePoolEntry(info, stats); }
public static CachePoolEntry convert(CachePoolEntryProto proto) { CachePoolInfo info = convert(proto.getInfo()); CachePoolStats stats = convert(proto.getStats()); return new CachePoolEntry(info, stats); }