Package org.apache.bookkeeper.meta
Class LedgerMetadataSerDe
- java.lang.Object
-
- org.apache.bookkeeper.meta.LedgerMetadataSerDe
-
public class LedgerMetadataSerDe extends java.lang.ObjectSerialization and deserialization for LedgerMetadata.
-
-
Field Summary
Fields Modifier and Type Field Description static intCURRENT_METADATA_FORMAT_VERSIONstatic intMAXIMUM_METADATA_FORMAT_VERSIONstatic intMETADATA_FORMAT_VERSION_1Text based manual serialization.static intMETADATA_FORMAT_VERSION_2Protobuf based, serialized using TextFormat.static intMETADATA_FORMAT_VERSION_3Protobuf based, serialized in binary format.
-
Constructor Summary
Constructors Constructor Description LedgerMetadataSerDe()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LedgerMetadataparseConfig(byte[] bytes, long ledgerId, java.util.Optional<java.lang.Long> metadataStoreCtime)Parses a given byte array and transforms into a LedgerConfig object.byte[]serialize(LedgerMetadata metadata)
-
-
-
Field Detail
-
METADATA_FORMAT_VERSION_1
public static final int METADATA_FORMAT_VERSION_1
Text based manual serialization. Available from v4.0.x onwards.- See Also:
- Constant Field Values
-
METADATA_FORMAT_VERSION_2
public static final int METADATA_FORMAT_VERSION_2
Protobuf based, serialized using TextFormat. Available from v4.2.x onwards. Can contain ctime or not, but if it contains ctime it can only be parse by v4.4.x onwards.- See Also:
- Constant Field Values
-
METADATA_FORMAT_VERSION_3
public static final int METADATA_FORMAT_VERSION_3
Protobuf based, serialized in binary format. Available from v4.9.x onwards.- See Also:
- Constant Field Values
-
MAXIMUM_METADATA_FORMAT_VERSION
public static final int MAXIMUM_METADATA_FORMAT_VERSION
- See Also:
- Constant Field Values
-
CURRENT_METADATA_FORMAT_VERSION
public static final int CURRENT_METADATA_FORMAT_VERSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
serialize
public byte[] serialize(LedgerMetadata metadata) throws java.io.IOException
- Throws:
java.io.IOException
-
parseConfig
public LedgerMetadata parseConfig(byte[] bytes, long ledgerId, java.util.Optional<java.lang.Long> metadataStoreCtime) throws java.io.IOException
Parses a given byte array and transforms into a LedgerConfig object.- Parameters:
bytes- byte array to parsemetadataStoreCtime- metadata store creation time, used for legacy ledgers- Returns:
- LedgerConfig
- Throws:
java.io.IOException- if the given byte[] cannot be parsed
-
-