Package org.apache.hadoop.hdfs.server.federation.store.driver.impl
Class StateStoreSerializableImpl
java.lang.Object
org.apache.hadoop.hdfs.server.federation.store.driver.StateStoreDriver
org.apache.hadoop.hdfs.server.federation.store.driver.impl.StateStoreBaseImpl
org.apache.hadoop.hdfs.server.federation.store.driver.impl.StateStoreSerializableImpl
- All Implemented Interfaces:
org.apache.hadoop.hdfs.server.federation.store.driver.StateStoreRecordOperations
State Store driver that stores a serialization of the records. The serializer
is pluggable.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static StringgetOriginalPrimaryKey(String stateStoreRecordKey) Get the original primary key for the given state store record key.protected static StringgetPrimaryKey(org.apache.hadoop.hdfs.server.federation.store.records.BaseRecord record) Get the primary key for a record.booleaninit(Configuration config, String id, Collection<Class<? extends org.apache.hadoop.hdfs.server.federation.store.records.BaseRecord>> records, org.apache.hadoop.hdfs.server.federation.metrics.StateStoreMetrics metrics) Initialize the state store connection.protected <T extends org.apache.hadoop.hdfs.server.federation.store.records.BaseRecord>
TCreates a record from an input data string.protected <T extends org.apache.hadoop.hdfs.server.federation.store.records.BaseRecord>
byte[]serialize(T record) Serialize a record using the serializer.protected <T extends org.apache.hadoop.hdfs.server.federation.store.records.BaseRecord>
StringserializeString(T record) Serialize a record using the serializer.Methods inherited from class org.apache.hadoop.hdfs.server.federation.store.driver.impl.StateStoreBaseImpl
get, getMultiple, put, remove, remove, removeMultipleMethods inherited from class org.apache.hadoop.hdfs.server.federation.store.driver.StateStoreDriver
close, getConf, getIdentifier, getMetrics, getTime, handleOverwriteAndDelete, initDriver, initRecordStorage, isDriverReady, verifyDriverReadyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hdfs.server.federation.store.driver.StateStoreRecordOperations
get, putAll, remove, removeAll
-
Field Details
-
SLASH_MARK
Mark for slashes in path names.- See Also:
-
COLON_MARK
Mark for colon in path names.- See Also:
-
-
Constructor Details
-
StateStoreSerializableImpl
public StateStoreSerializableImpl()
-
-
Method Details
-
init
public boolean init(Configuration config, String id, Collection<Class<? extends org.apache.hadoop.hdfs.server.federation.store.records.BaseRecord>> records, org.apache.hadoop.hdfs.server.federation.metrics.StateStoreMetrics metrics) Description copied from class:StateStoreDriverInitialize the state store connection.- Overrides:
initin classStateStoreDriver- Parameters:
config- Configuration for the driver.id- Identifier for the driver.records- Records that are supported.metrics- State store metrics.- Returns:
- If initialized and ready, false if failed to initialize driver.
-
serialize
protected <T extends org.apache.hadoop.hdfs.server.federation.store.records.BaseRecord> byte[] serialize(T record) Serialize a record using the serializer.- Type Parameters:
T- Type of the state store record.- Parameters:
record- Record to serialize.- Returns:
- Byte array with the serialization of the record.
-
serializeString
protected <T extends org.apache.hadoop.hdfs.server.federation.store.records.BaseRecord> String serializeString(T record) Serialize a record using the serializer.- Type Parameters:
T- Type of the state store record.- Parameters:
record- Record to serialize.- Returns:
- String with the serialization of the record.
-
newRecord
protected <T extends org.apache.hadoop.hdfs.server.federation.store.records.BaseRecord> T newRecord(String data, Class<T> clazz, boolean includeDates) throws IOException Creates a record from an input data string.- Type Parameters:
T- Type of the state store record.- Parameters:
data- Serialized text of the record.clazz- Record class.includeDates- If dateModified and dateCreated are serialized.- Returns:
- The created record by deserializing the input text.
- Throws:
IOException- If the record deserialization fails.
-
getPrimaryKey
protected static String getPrimaryKey(org.apache.hadoop.hdfs.server.federation.store.records.BaseRecord record) Get the primary key for a record. If we don't want to store in folders, we need to remove / from the name.- Parameters:
record- Record to get the primary key for.- Returns:
- Primary key for the record.
-
getOriginalPrimaryKey
Get the original primary key for the given state store record key. The returned key is readable as it is the original key.- Parameters:
stateStoreRecordKey- The record primary key stored by the state store implementations.- Returns:
- The original primary key for the given record key.
-