use of org.apache.cassandra.io.sstable.metadata.ValidationMetadata in project cassandra by apache.
the class FBUtilities method newPartitioner.
/**
* Create a new instance of a partitioner defined in an SSTable Descriptor
* @param desc Descriptor of an sstable
* @return a new IPartitioner instance
* @throws IOException
*/
public static IPartitioner newPartitioner(Descriptor desc) throws IOException {
EnumSet<MetadataType> types = EnumSet.of(MetadataType.VALIDATION, MetadataType.HEADER);
Map<MetadataType, MetadataComponent> sstableMetadata = desc.getMetadataSerializer().deserialize(desc, types);
ValidationMetadata validationMetadata = (ValidationMetadata) sstableMetadata.get(MetadataType.VALIDATION);
SerializationHeader.Component header = (SerializationHeader.Component) sstableMetadata.get(MetadataType.HEADER);
return newPartitioner(validationMetadata.partitioner, Optional.of(header.getKeyType()));
}
Aggregations