Interface ISchemaVersion


  • public interface ISchemaVersion
    A serialization schema for HLLs. Reads and writes HLL metadata to and from byte[] representations.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      IWordDeserializer getDeserializer​(HLLType type, int wordLength, byte[] bytes)
      Builds an HLL deserializer that matches this schema version.
      org.apache.solr.util.hll.IWordSerializer getSerializer​(HLLType type, int wordLength, int wordCount)
      Builds an HLL serializer that matches this schema version.
      int paddingBytes​(HLLType type)
      The number of metadata bytes required for a serialized HLL of the specified type.
      org.apache.solr.util.hll.IHLLMetadata readMetadata​(byte[] bytes)
      Reads the metadata bytes of the serialized HLL.
      int schemaVersionNumber()  
      void writeMetadata​(byte[] bytes, org.apache.solr.util.hll.IHLLMetadata metadata)
      Writes metadata bytes to serialized HLL.
    • Method Detail

      • paddingBytes

        int paddingBytes​(HLLType type)
        The number of metadata bytes required for a serialized HLL of the specified type.
        Parameters:
        type - the type of the serialized HLL
        Returns:
        the number of padding bytes needed in order to fully accommodate the needed metadata.
      • writeMetadata

        void writeMetadata​(byte[] bytes,
                           org.apache.solr.util.hll.IHLLMetadata metadata)
        Writes metadata bytes to serialized HLL.
        Parameters:
        bytes - the padded data bytes of the HLL
        metadata - the metadata to write to the padding bytes
      • readMetadata

        org.apache.solr.util.hll.IHLLMetadata readMetadata​(byte[] bytes)
        Reads the metadata bytes of the serialized HLL.
        Parameters:
        bytes - the serialized HLL
        Returns:
        the HLL metadata
      • getSerializer

        org.apache.solr.util.hll.IWordSerializer getSerializer​(HLLType type,
                                                               int wordLength,
                                                               int wordCount)
        Builds an HLL serializer that matches this schema version.
        Parameters:
        type - the HLL type that will be serialized. This cannot be null.
        wordLength - the length of the 'words' that comprise the data of the HLL. Words must be at least 5 bits and at most 64 bits long.
        wordCount - the number of 'words' in the HLL's data.
        Returns:
        a byte array serializer used to serialize a HLL according to this schema version's specification.
        See Also:
        paddingBytes(HLLType), IWordSerializer
      • getDeserializer

        IWordDeserializer getDeserializer​(HLLType type,
                                          int wordLength,
                                          byte[] bytes)
        Builds an HLL deserializer that matches this schema version.
        Parameters:
        type - the HLL type that will be deserialized. This cannot be null.
        wordLength - the length of the 'words' that comprise the data of the serialized HLL. Words must be at least 5 bits and at most 64 bits long.
        bytes - the serialized HLL to deserialize. This cannot be null.
        Returns:
        a byte array deserializer used to deserialize a HLL serialized according to this schema version's specification.
      • schemaVersionNumber

        int schemaVersionNumber()
        Returns:
        the schema version number.