Search in sources :

Example 1 with CodecRegistry

use of org.apache.hadoop.hdds.utils.db.CodecRegistry in project ozone by apache.

the class KeyManagerImpl method getNextGreaterString.

private String getNextGreaterString(String volumeName, String bucketName, String keyPrefix) throws IOException {
    // Increment the last character of the string and return the new ozone key.
    Preconditions.checkArgument(!Strings.isNullOrEmpty(keyPrefix), "Key prefix is null or empty");
    CodecRegistry codecRegistry = ((RDBStore) metadataManager.getStore()).getCodecRegistry();
    byte[] keyPrefixInBytes = codecRegistry.asRawData(keyPrefix);
    keyPrefixInBytes[keyPrefixInBytes.length - 1]++;
    String nextPrefix = codecRegistry.asObject(keyPrefixInBytes, String.class);
    return metadataManager.getOzoneKey(volumeName, bucketName, nextPrefix);
}
Also used : CodecRegistry(org.apache.hadoop.hdds.utils.db.CodecRegistry) RDBStore(org.apache.hadoop.hdds.utils.db.RDBStore)

Aggregations

CodecRegistry (org.apache.hadoop.hdds.utils.db.CodecRegistry)1 RDBStore (org.apache.hadoop.hdds.utils.db.RDBStore)1