use of com.pingcap.tikv.codec.CodecDataInput in project tispark by pingcap.
the class CatalogTransaction method getLatestSchemaVersion.
long getLatestSchemaVersion() {
ByteString versionBytes = MetaCodec.bytesGet(MetaCodec.KEY_SCHEMA_VERSION, this.snapshot);
CodecDataInput cdi = new CodecDataInput(versionBytes.toByteArray());
return Long.parseLong(new String(cdi.toByteArray(), StandardCharsets.UTF_8));
}
use of com.pingcap.tikv.codec.CodecDataInput in project tispark by pingcap.
the class CoprocessorIterator method createDataInputReader.
void createDataInputReader() {
requireNonNull(chunkList, "Chunk list should not be null.");
if (0 > chunkIndex || chunkIndex >= chunkList.size()) {
throw new IllegalArgumentException();
}
dataInput = new CodecDataInput(chunkList.get(chunkIndex).getRowsData());
rowReader = RowReaderFactory.createRowReader(dataInput);
}
use of com.pingcap.tikv.codec.CodecDataInput in project tispark by pingcap.
the class TiRegion method decodeRegion.
private Region decodeRegion(Region region, boolean isRawRegion) {
Region.Builder builder = Region.newBuilder().setId(region.getId()).setRegionEpoch(region.getRegionEpoch()).addAllPeers(region.getPeersList());
if (region.getStartKey().isEmpty() || isRawRegion) {
builder.setStartKey(region.getStartKey());
} else {
byte[] decodedStartKey = BytesCodec.readBytes(new CodecDataInput(region.getStartKey()));
builder.setStartKey(ByteString.copyFrom(decodedStartKey));
}
if (region.getEndKey().isEmpty() || isRawRegion) {
builder.setEndKey(region.getEndKey());
} else {
byte[] decodedEndKey = BytesCodec.readBytes(new CodecDataInput(region.getEndKey()));
builder.setEndKey(ByteString.copyFrom(decodedEndKey));
}
return builder.build();
}
Aggregations