use of com.palantir.atlasdb.table.description.TableMetadata in project atlasdb by palantir.
the class KeyValueServiceMigrator method getPartitioners.
private List<RowNamePartitioner> getPartitioners(KeyValueService kvs, TableReference table) {
try {
byte[] metadata = kvs.getMetadataForTable(table);
TableMetadata tableMeta = TableMetadata.BYTES_HYDRATOR.hydrateFromBytes(metadata);
return tableMeta.getRowMetadata().getPartitionersForRow();
} catch (RuntimeException e) {
processMessage("Could not resolve partitioners from table metadata for " + table + " this may result in a small decrease in performance migrating this table.", e, KvsMigrationMessageLevel.WARN);
return ImmutableList.of();
}
}
use of com.palantir.atlasdb.table.description.TableMetadata in project atlasdb by palantir.
the class TransactionRemotingTest method testGetTableMetadata.
@Test
public void testGetTableMetadata() {
TableMetadata metadata = service.getTableMetadata("sweep.priority");
Assert.assertFalse(metadata.getColumns().hasDynamicColumns());
}
use of com.palantir.atlasdb.table.description.TableMetadata in project atlasdb by palantir.
the class TableCellValDeserializer method deserialize.
@Override
public TableCellVal deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
JsonNode node = jp.readValueAsTree();
String tableName = node.get("table").textValue();
TableMetadata metadata = metadataCache.getMetadata(tableName);
Map<Cell, byte[]> values = AtlasDeserializers.deserializeCellVals(metadata, node.get("data"));
return new TableCellVal(tableName, values);
}
use of com.palantir.atlasdb.table.description.TableMetadata in project atlasdb by palantir.
the class TableRangeDeserializer method deserialize.
@Override
public TableRange deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
JsonNode node = jp.readValueAsTree();
String tableName = node.get("table").textValue();
TableMetadata metadata = metadataCache.getMetadata(tableName);
JsonNode optBatchSize = node.get("batch_size");
int batchSize = optBatchSize == null ? 2000 : optBatchSize.asInt();
Iterable<byte[]> columns = AtlasDeserializers.deserializeNamedCols(metadata.getColumns(), node.get("cols"));
byte[] startRow = new byte[0];
byte[] endRow = new byte[0];
if (node.has("prefix")) {
startRow = AtlasDeserializers.deserializeRowPrefix(metadata.getRowMetadata(), node.get("prefix"));
endRow = RangeRequests.createEndNameForPrefixScan(startRow);
} else {
if (node.has("raw_start")) {
startRow = node.get("raw_start").binaryValue();
} else if (node.has("start")) {
startRow = AtlasDeserializers.deserializeRow(metadata.getRowMetadata(), node.get("start"));
}
if (node.has("raw_end")) {
endRow = node.get("raw_end").binaryValue();
} else if (node.has("end")) {
endRow = AtlasDeserializers.deserializeRow(metadata.getRowMetadata(), node.get("end"));
}
}
return new TableRange(tableName, startRow, endRow, columns, batchSize);
}
use of com.palantir.atlasdb.table.description.TableMetadata in project atlasdb by palantir.
the class TableCellValSerializer method serialize.
@Override
public void serialize(TableCellVal value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
TableMetadata metadata = metadataCache.getMetadata(value.getTableName());
Preconditions.checkNotNull(metadata, "Unknown table %s", value.getTableName());
jgen.writeStartObject();
jgen.writeStringField("table", value.getTableName());
jgen.writeArrayFieldStart("data");
for (Entry<Cell, byte[]> result : value.getResults().entrySet()) {
serialize(jgen, metadata, result);
}
jgen.writeEndArray();
jgen.writeEndObject();
}
Aggregations