org.apache.cassandra.io.sstable.metadata

## Class MetadataSerializer

- java.lang.Object
- - org.apache.cassandra.io.sstable.metadata.MetadataSerializer

- All Implemented Interfaces:
    IMetadataSerializer
  Direct Known Subclasses:
    LegacyMetadataSerializer

      public class MetadataSerializer
      extends java.lang.Object
      implements IMetadataSerializer

  Metadata serializer for SSTables version >= 'k'.

       File format := | number of components (4 bytes) | toc | component1 | component2 | ... |
       toc         := | component type (4 bytes) | position of component |

  IMetadataComponent.Type's ordinal() defines the order of serialization.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MetadataSerializer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Map<MetadataType,MetadataComponent>` | `deserialize(Descriptor descriptor, java.util.EnumSet<MetadataType> types)` Deserialize specified metadata components from given descriptor.
    `java.util.Map<MetadataType,MetadataComponent>` | `deserialize(Descriptor descriptor, FileDataInput in, java.util.EnumSet<MetadataType> types)`
    `MetadataComponent` | `deserialize(Descriptor descriptor, MetadataType type)` Deserialized only metadata component specified from given descriptor.
    `void` | `mutateLevel(Descriptor descriptor, int newLevel)` Mutate SSTable level
    `void` | `mutateRepairedAt(Descriptor descriptor, long newRepairedAt)` Mutate repairedAt time
    `void` | `serialize(java.util.Map<MetadataType,MetadataComponent> components, Version version, DataOutputPlus out)` Serialize given metadata components

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MetadataSerializer

          public MetadataSerializer()

  - ### Method Detail

    - #### serialize

          public void serialize(java.util.Map<MetadataType,MetadataComponent> components,
                                Version version,
                                DataOutputPlus out)
                         throws java.io.IOException

      Description copied from interface: `IMetadataSerializer`
      Serialize given metadata components
      Specified by:
        `serialize` in interface `IMetadataSerializer`
      Parameters:
        `components` - Metadata components to serialize
      Throws:
        `java.io.IOException`

    - #### deserialize

          public java.util.Map<MetadataType,MetadataComponent> deserialize(Descriptor descriptor,
                                                                           java.util.EnumSet<MetadataType> types)
                                                                    throws java.io.IOException

      Description copied from interface: `IMetadataSerializer`
      Deserialize specified metadata components from given descriptor.
      Specified by:
        `deserialize` in interface `IMetadataSerializer`
      Parameters:
        `descriptor` - SSTable descriptor
      Returns:
        Deserialized metadata components, in deserialized order.
      Throws:
        `java.io.IOException`

    - #### deserialize

          public MetadataComponent deserialize(Descriptor descriptor,
                                               MetadataType type)
                                        throws java.io.IOException

      Description copied from interface: `IMetadataSerializer`
      Deserialized only metadata component specified from given descriptor.
      Specified by:
        `deserialize` in interface `IMetadataSerializer`
      Parameters:
        `descriptor` - SSTable descriptor
        `type` - Metadata component type to deserialize
      Returns:
        Deserialized metadata component. Can be null if specified type does not exist.
      Throws:
        `java.io.IOException`

    - #### deserialize

          public java.util.Map<MetadataType,MetadataComponent> deserialize(Descriptor descriptor,
                                                                           FileDataInput in,
                                                                           java.util.EnumSet<MetadataType> types)
                                                                    throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### mutateLevel

          public void mutateLevel(Descriptor descriptor,
                                  int newLevel)
                           throws java.io.IOException

      Description copied from interface: `IMetadataSerializer`
      Mutate SSTable level
      Specified by:
        `mutateLevel` in interface `IMetadataSerializer`
      Parameters:
        `descriptor` - SSTable descriptor
        `newLevel` - new SSTable level
      Throws:
        `java.io.IOException`

    - #### mutateRepairedAt

          public void mutateRepairedAt(Descriptor descriptor,
                                       long newRepairedAt)
                                throws java.io.IOException

      Description copied from interface: `IMetadataSerializer`
      Mutate repairedAt time
      Specified by:
        `mutateRepairedAt` in interface `IMetadataSerializer`
      Throws:
        `java.io.IOException`

Copyright © 2018 The Apache Software Foundation