StateStoreSerializer (Apache Hadoop HDFS-RBF 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.server.federation.store.driver, class: StateStoreSerializer

Package org.apache.hadoop.hdfs.server.federation.store.driver

# Class StateStoreSerializer

java.lang.Object
org.apache.hadoop.hdfs.server.federation.store.driver.StateStoreSerializer

Direct Known Subclasses:
  `StateStoreSerializerPBImpl`

public abstract class StateStoreSerializer extends Object
Serializer to store and retrieve data in the State Store.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `StateStoreSerializer()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract <T extends BaseRecord>
  T`
  `deserialize(byte[] byteArray, Class<T> clazz)`
  Deserialize a bytes array into a record.
  `abstract <T extends BaseRecord>
  T`
  `deserialize(String data, Class<T> clazz)`
  Deserialize a string into a record.
  `static StateStoreSerializer`
  `getSerializer()`
  Get the default serializer based.
  `static StateStoreSerializer`
  `getSerializer(org.apache.hadoop.conf.Configuration conf)`
  Get a serializer based on the provided configuration.
  `static <T> T`
  `newRecord(Class<T> clazz)`
  Create a new record.
  `abstract <T> T`
  `newRecordInstance(Class<T> clazz)`
  Create a new record.
  `abstract byte[]`
  `serialize(BaseRecord record)`
  Serialize a record into a byte array.
  `abstract String`
  `serializeString(BaseRecord record)`
  Serialize a record into a string.

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

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

- ## Constructor Details

  - ### StateStoreSerializer

    public StateStoreSerializer()

- ## Method Details

  - ### getSerializer

    public static StateStoreSerializer getSerializer()
    Get the default serializer based.
    Returns:
      Singleton serializer.

  - ### getSerializer

    public static StateStoreSerializer getSerializer(org.apache.hadoop.conf.Configuration conf)
    Get a serializer based on the provided configuration.
    Parameters:
      `conf` - Configuration. Default if null.
    Returns:
      Singleton serializer.

  - ### newRecord

    public static <T> T newRecord(Class<T> clazz)
    Create a new record.
    Type Parameters:
      `T` - Type of the record.
    Parameters:
      `clazz` - Class of the new record.
    Returns:
      New record.

  - ### newRecordInstance

    public abstract <T> T newRecordInstance(Class<T> clazz)
    Create a new record.
    Type Parameters:
      `T` - Type of the record.
    Parameters:
      `clazz` - Class of the new record.
    Returns:
      New record.

  - ### serialize

    public abstract byte[] serialize(BaseRecord record)
    Serialize a record into a byte array.
    Parameters:
      `record` - Record to serialize.
    Returns:
      Byte array with the serialized record.

  - ### serializeString

    public abstract String serializeString(BaseRecord record)
    Serialize a record into a string.
    Parameters:
      `record` - Record to serialize.
    Returns:
      String with the serialized record.

  - ### deserialize

    public abstract <T extends BaseRecord> T deserialize(byte[] byteArray, Class<T> clazz) throws IOException
    Deserialize a bytes array into a record.
    Type Parameters:
      `T` - Type of the record.
    Parameters:
      `byteArray` - Byte array to deserialize.
      `clazz` - Class of the record.
    Returns:
      New record.
    Throws:
      `IOException` - If it cannot deserialize the record.

  - ### deserialize

    public abstract <T extends BaseRecord> T deserialize(String data, Class<T> clazz) throws IOException
    Deserialize a string into a record.
    Type Parameters:
      `T` - Type of the record.
    Parameters:
      `data` - String with the data to deserialize.
      `clazz` - Class of the record.
    Returns:
      New record.
    Throws:
      `IOException` - If it cannot deserialize the record.