public static GetFsStatsResponseProto convert(long[] fsStats) { GetFsStatsResponseProto.Builder result = GetFsStatsResponseProto .newBuilder(); if (fsStats.length >= ClientProtocol.GET_STATS_CAPACITY_IDX + 1) result.setCapacity(fsStats[ClientProtocol.GET_STATS_CAPACITY_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_USED_IDX + 1) result.setUsed(fsStats[ClientProtocol.GET_STATS_USED_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_REMAINING_IDX + 1) result.setRemaining(fsStats[ClientProtocol.GET_STATS_REMAINING_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_UNDER_REPLICATED_IDX + 1) result.setUnderReplicated( fsStats[ClientProtocol.GET_STATS_UNDER_REPLICATED_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_CORRUPT_BLOCKS_IDX + 1) result.setCorruptBlocks( fsStats[ClientProtocol.GET_STATS_CORRUPT_BLOCKS_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_MISSING_BLOCKS_IDX + 1) result.setMissingBlocks( fsStats[ClientProtocol.GET_STATS_MISSING_BLOCKS_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_MISSING_REPL_ONE_BLOCKS_IDX + 1) result.setMissingReplOneBlocks( fsStats[ClientProtocol.GET_STATS_MISSING_REPL_ONE_BLOCKS_IDX]); return result.build(); }
public static long[] convert(GetFsStatsResponseProto res) { long[] result = new long[ClientProtocol.STATS_ARRAY_LENGTH]; result[ClientProtocol.GET_STATS_CAPACITY_IDX] = res.getCapacity(); result[ClientProtocol.GET_STATS_USED_IDX] = res.getUsed(); result[ClientProtocol.GET_STATS_REMAINING_IDX] = res.getRemaining(); result[ClientProtocol.GET_STATS_UNDER_REPLICATED_IDX] = res.getUnderReplicated(); result[ClientProtocol.GET_STATS_CORRUPT_BLOCKS_IDX] = res.getCorruptBlocks(); result[ClientProtocol.GET_STATS_MISSING_BLOCKS_IDX] = res.getMissingBlocks(); result[ClientProtocol.GET_STATS_MISSING_REPL_ONE_BLOCKS_IDX] = res.getMissingReplOneBlocks(); result[ClientProtocol.GET_STATS_BYTES_IN_FUTURE_BLOCKS_IDX] = res.hasBlocksInFuture() ? res.getBlocksInFuture() : 0; return result; }
public static GetFsStatsResponseProto convert(long[] fsStats) { GetFsStatsResponseProto.Builder result = GetFsStatsResponseProto .newBuilder(); if (fsStats.length >= ClientProtocol.GET_STATS_CAPACITY_IDX + 1) result.setCapacity(fsStats[ClientProtocol.GET_STATS_CAPACITY_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_USED_IDX + 1) result.setUsed(fsStats[ClientProtocol.GET_STATS_USED_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_REMAINING_IDX + 1) result.setRemaining(fsStats[ClientProtocol.GET_STATS_REMAINING_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_UNDER_REPLICATED_IDX + 1) result.setUnderReplicated( fsStats[ClientProtocol.GET_STATS_UNDER_REPLICATED_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_CORRUPT_BLOCKS_IDX + 1) result.setCorruptBlocks( fsStats[ClientProtocol.GET_STATS_CORRUPT_BLOCKS_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_MISSING_BLOCKS_IDX + 1) result.setMissingBlocks( fsStats[ClientProtocol.GET_STATS_MISSING_BLOCKS_IDX]); return result.build(); }
public static GetFsStatsResponseProto convert(long[] fsStats) { GetFsStatsResponseProto.Builder result = GetFsStatsResponseProto.newBuilder(); if (fsStats.length >= ClientProtocol.GET_STATS_CAPACITY_IDX + 1) { result.setCapacity(fsStats[ClientProtocol.GET_STATS_CAPACITY_IDX]); } if (fsStats.length >= ClientProtocol.GET_STATS_USED_IDX + 1) { result.setUsed(fsStats[ClientProtocol.GET_STATS_USED_IDX]); } if (fsStats.length >= ClientProtocol.GET_STATS_REMAINING_IDX + 1) { result.setRemaining(fsStats[ClientProtocol.GET_STATS_REMAINING_IDX]); } if (fsStats.length >= ClientProtocol.GET_STATS_UNDER_REPLICATED_IDX + 1) { result.setUnderReplicated( fsStats[ClientProtocol.GET_STATS_UNDER_REPLICATED_IDX]); } if (fsStats.length >= ClientProtocol.GET_STATS_CORRUPT_BLOCKS_IDX + 1) { result.setCorruptBlocks( fsStats[ClientProtocol.GET_STATS_CORRUPT_BLOCKS_IDX]); } if (fsStats.length >= ClientProtocol.GET_STATS_MISSING_BLOCKS_IDX + 1) { result.setMissingBlocks( fsStats[ClientProtocol.GET_STATS_MISSING_BLOCKS_IDX]); } return result.build(); }
public static long[] convert(GetFsStatsResponseProto res) { long[] result = new long[7]; result[ClientProtocol.GET_STATS_CAPACITY_IDX] = res.getCapacity(); result[ClientProtocol.GET_STATS_USED_IDX] = res.getUsed(); result[ClientProtocol.GET_STATS_REMAINING_IDX] = res.getRemaining(); result[ClientProtocol.GET_STATS_UNDER_REPLICATED_IDX] = res.getUnderReplicated(); result[ClientProtocol.GET_STATS_CORRUPT_BLOCKS_IDX] = res.getCorruptBlocks(); result[ClientProtocol.GET_STATS_MISSING_BLOCKS_IDX] = res.getMissingBlocks(); result[ClientProtocol.GET_STATS_MISSING_REPL_ONE_BLOCKS_IDX] = res.getMissingReplOneBlocks(); return result; }
@Override public GetFsStatsResponseProto getFsStats(RpcController controller, GetFsStatusRequestProto req) throws ServiceException { try { return PBHelper.convert(server.getStats()); } catch (IOException e) { throw new ServiceException(e); } }
public static GetFsStatsResponseProto convert(long[] fsStats) { GetFsStatsResponseProto.Builder result = GetFsStatsResponseProto .newBuilder(); if (fsStats.length >= ClientProtocol.GET_STATS_CAPACITY_IDX + 1) result.setCapacity(fsStats[ClientProtocol.GET_STATS_CAPACITY_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_USED_IDX + 1) result.setUsed(fsStats[ClientProtocol.GET_STATS_USED_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_REMAINING_IDX + 1) result.setRemaining(fsStats[ClientProtocol.GET_STATS_REMAINING_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_UNDER_REPLICATED_IDX + 1) result.setUnderReplicated( fsStats[ClientProtocol.GET_STATS_UNDER_REPLICATED_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_CORRUPT_BLOCKS_IDX + 1) result.setCorruptBlocks( fsStats[ClientProtocol.GET_STATS_CORRUPT_BLOCKS_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_MISSING_BLOCKS_IDX + 1) result.setMissingBlocks( fsStats[ClientProtocol.GET_STATS_MISSING_BLOCKS_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_MISSING_REPL_ONE_BLOCKS_IDX + 1) result.setMissingReplOneBlocks( fsStats[ClientProtocol.GET_STATS_MISSING_REPL_ONE_BLOCKS_IDX]); if (fsStats.length >= ClientProtocol.GET_STATS_BYTES_IN_FUTURE_BLOCKS_IDX + 1) { result.setBlocksInFuture( fsStats[ClientProtocol.GET_STATS_BYTES_IN_FUTURE_BLOCKS_IDX]); } return result.build(); }
@Override public GetFsStatsResponseProto getFsStats(RpcController controller, GetFsStatusRequestProto req) throws ServiceException { try { return PBHelperClient.convert(server.getStats()); } catch (IOException e) { throw new ServiceException(e); } }
public static long[] convert(GetFsStatsResponseProto res) { long[] result = new long[6]; result[ClientProtocol.GET_STATS_CAPACITY_IDX] = res.getCapacity(); result[ClientProtocol.GET_STATS_USED_IDX] = res.getUsed(); result[ClientProtocol.GET_STATS_REMAINING_IDX] = res.getRemaining(); result[ClientProtocol.GET_STATS_UNDER_REPLICATED_IDX] = res.getUnderReplicated(); result[ClientProtocol.GET_STATS_CORRUPT_BLOCKS_IDX] = res.getCorruptBlocks(); result[ClientProtocol.GET_STATS_MISSING_BLOCKS_IDX] = res.getMissingBlocks(); return result; }