class LedgerMetadataImpl extends java.lang.Object implements LedgerMetadata
It provides parsing and serialization methods of such metadata.
LedgerMetadata.State| Modifier and Type | Field and Description |
|---|---|
(package private) static org.slf4j.Logger |
LOG |
(package private) boolean |
storeCtime |
| Constructor and Description |
|---|
LedgerMetadataImpl(long ledgerId,
int metadataFormatVersion,
int ensembleSize,
int writeQuorumSize,
int ackQuorumSize,
LedgerMetadata.State state,
java.util.Optional<java.lang.Long> lastEntryId,
java.util.Optional<java.lang.Long> length,
java.util.Map<java.lang.Long,java.util.List<org.apache.bookkeeper.net.BookieId>> ensembles,
java.util.Optional<DigestType> digestType,
java.util.Optional<byte[]> password,
long ctime,
boolean storeCtime,
long cToken,
java.util.Map<java.lang.String,byte[]> customMetadata) |
| Modifier and Type | Method and Description |
|---|---|
int |
getAckQuorumSize()
Returns the ack quorum size of this ledger.
|
java.util.NavigableMap<java.lang.Long,? extends java.util.List<org.apache.bookkeeper.net.BookieId>> |
getAllEnsembles()
Returns all the ensembles of this ledger.
|
long |
getCtime()
Returns the creation timestamp of this ledger.
|
long |
getCToken()
Get the unique creator token of the Ledger.
|
java.util.Map<java.lang.String,byte[]> |
getCustomMetadata()
Returns the custom metadata stored with the ledgers.
|
DigestType |
getDigestType()
Returns the digest type used by this ledger.
|
java.util.List<org.apache.bookkeeper.net.BookieId> |
getEnsembleAt(long entryId)
Returns the ensemble at the given
entryId. |
int |
getEnsembleSize()
Returns the ensemble size of this ledger.
|
long |
getLastEntryId()
Returns the last entry id of this ledger.
|
long |
getLedgerId()
Returns the id of this ledger.
|
long |
getLength()
Returns the length of this ledger.
|
int |
getMetadataFormatVersion()
Get the format version which should be used to serialize the metadata.
|
byte[] |
getPassword()
Get the password for the ledger.
|
LedgerMetadata.State |
getState()
Returns the state of the metadata.
|
int |
getWriteQuorumSize()
Returns the write quorum size of this ledger.
|
boolean |
hasPassword()
In versions 4.1.0 and below, the digest type and password were not
stored in the metadata.
|
boolean |
isClosed()
Returns whether the ledger is sealed or not.
|
(package private) boolean |
shouldStoreCtime() |
java.lang.String |
toSafeString()
Returns a string representation of this LedgerMetadata object by
filtering out the password field.
|
java.lang.String |
toString() |
LedgerMetadataImpl(long ledgerId,
int metadataFormatVersion,
int ensembleSize,
int writeQuorumSize,
int ackQuorumSize,
LedgerMetadata.State state,
java.util.Optional<java.lang.Long> lastEntryId,
java.util.Optional<java.lang.Long> length,
java.util.Map<java.lang.Long,java.util.List<org.apache.bookkeeper.net.BookieId>> ensembles,
java.util.Optional<DigestType> digestType,
java.util.Optional<byte[]> password,
long ctime,
boolean storeCtime,
long cToken,
java.util.Map<java.lang.String,byte[]> customMetadata)
public long getLedgerId()
LedgerMetadatagetLedgerId in interface LedgerMetadatapublic java.util.NavigableMap<java.lang.Long,? extends java.util.List<org.apache.bookkeeper.net.BookieId>> getAllEnsembles()
LedgerMetadatagetAllEnsembles in interface LedgerMetadatapublic int getEnsembleSize()
LedgerMetadatagetEnsembleSize in interface LedgerMetadatapublic int getWriteQuorumSize()
LedgerMetadatagetWriteQuorumSize in interface LedgerMetadatapublic int getAckQuorumSize()
LedgerMetadatagetAckQuorumSize in interface LedgerMetadatapublic long getCtime()
LedgerMetadatagetCtime in interface LedgerMetadatapublic boolean hasPassword()
hasPassword in interface LedgerMetadatapublic byte[] getPassword()
LedgerMetadatagetPassword in interface LedgerMetadatapublic DigestType getDigestType()
LedgerMetadatagetDigestType in interface LedgerMetadatapublic long getLastEntryId()
LedgerMetadataIf this ledger is not sealed LedgerMetadata.isClosed(), it returns -1L.
getLastEntryId in interface LedgerMetadatapublic long getLength()
LedgerMetadataIf this ledger is not sealed LedgerMetadata.isClosed(), it returns 0.
getLength in interface LedgerMetadatapublic boolean isClosed()
LedgerMetadataisClosed in interface LedgerMetadatapublic LedgerMetadata.State getState()
LedgerMetadatagetState in interface LedgerMetadatapublic java.util.List<org.apache.bookkeeper.net.BookieId> getEnsembleAt(long entryId)
LedgerMetadataentryId.getEnsembleAt in interface LedgerMetadataentryId - the entry id to retrieve its ensemble informationentryId.public java.util.Map<java.lang.String,byte[]> getCustomMetadata()
LedgerMetadatagetCustomMetadata in interface LedgerMetadatapublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toSafeString()
toSafeString in interface LedgerMetadatapublic int getMetadataFormatVersion()
LedgerMetadatagetMetadataFormatVersion in interface LedgerMetadataboolean shouldStoreCtime()
public long getCToken()
LedgerMetadatagetCToken in interface LedgerMetadataCopyright © 2011–2024 The Apache Software Foundation. All rights reserved.