/** * Creates a {@link Put} to store the given {@code snapshot} for the given {@code tableName} in * the quota table. */ static Put createPutForSpaceSnapshot(TableName tableName, SpaceQuotaSnapshot snapshot) { Put p = new Put(getTableRowKey(tableName)); p.addColumn( QUOTA_FAMILY_USAGE, QUOTA_QUALIFIER_POLICY, SpaceQuotaSnapshot.toProtoSnapshot(snapshot).toByteArray()); return p; }
TableQuotaSnapshot.newBuilder() .setTableName(ProtobufUtil.toProtoTableName(entry.getKey())) .setSnapshot(SpaceQuotaSnapshot.toProtoSnapshot(entry.getValue())).build()); NamespaceQuotaSnapshot.newBuilder() .setNamespace(entry.getKey()) .setSnapshot(SpaceQuotaSnapshot.toProtoSnapshot(entry.getValue())).build());
@Override public GetSpaceQuotaSnapshotsResponse getSpaceQuotaSnapshots( RpcController controller, GetSpaceQuotaSnapshotsRequest request) throws ServiceException { try { final RegionServerSpaceQuotaManager manager = regionServer.getRegionServerSpaceQuotaManager(); final GetSpaceQuotaSnapshotsResponse.Builder builder = GetSpaceQuotaSnapshotsResponse.newBuilder(); if (manager != null) { final Map<TableName,SpaceQuotaSnapshot> snapshots = manager.copyQuotaSnapshots(); for (Entry<TableName,SpaceQuotaSnapshot> snapshot : snapshots.entrySet()) { builder.addSnapshots(TableQuotaSnapshot.newBuilder() .setTableName(ProtobufUtil.toProtoTableName(snapshot.getKey())) .setSnapshot(SpaceQuotaSnapshot.toProtoSnapshot(snapshot.getValue())) .build()); } } return builder.build(); } catch (Exception e) { throw new ServiceException(e); } }
/** * Creates a {@link Put} to store the given {@code snapshot} for the given {@code tableName} in * the quota table. */ static Put createPutForSpaceSnapshot(TableName tableName, SpaceQuotaSnapshot snapshot) { Put p = new Put(getTableRowKey(tableName)); p.addColumn( QUOTA_FAMILY_USAGE, QUOTA_QUALIFIER_POLICY, SpaceQuotaSnapshot.toProtoSnapshot(snapshot).toByteArray()); return p; }
/** * Creates a {@link Put} to store the given {@code snapshot} for the given {@code tableName} in * the quota table. */ static Put createPutForSpaceSnapshot(TableName tableName, SpaceQuotaSnapshot snapshot) { Put p = new Put(getTableRowKey(tableName)); p.addColumn( QUOTA_FAMILY_USAGE, QUOTA_QUALIFIER_POLICY, SpaceQuotaSnapshot.toProtoSnapshot(snapshot).toByteArray()); return p; }