Search in sources :

Example 1 with ValidationMetadata

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()));
}
Also used : MetadataComponent(org.apache.cassandra.io.sstable.metadata.MetadataComponent) SerializationHeader(org.apache.cassandra.db.SerializationHeader) MetadataType(org.apache.cassandra.io.sstable.metadata.MetadataType) ValidationMetadata(org.apache.cassandra.io.sstable.metadata.ValidationMetadata) MetadataComponent(org.apache.cassandra.io.sstable.metadata.MetadataComponent)

Aggregations

SerializationHeader (org.apache.cassandra.db.SerializationHeader)1 MetadataComponent (org.apache.cassandra.io.sstable.metadata.MetadataComponent)1 MetadataType (org.apache.cassandra.io.sstable.metadata.MetadataType)1 ValidationMetadata (org.apache.cassandra.io.sstable.metadata.ValidationMetadata)1