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(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.BookieSocketAddress>> 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.BookieSocketAddress>> |
getAllEnsembles()
Returns all the ensembles of this entry.
|
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.BookieSocketAddress> |
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 |
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(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.BookieSocketAddress>> 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 java.util.NavigableMap<java.lang.Long,? extends java.util.List<org.apache.bookkeeper.net.BookieSocketAddress>> getAllEnsembles()
LedgerMetadata
getAllEnsembles
in interface LedgerMetadata
public int getEnsembleSize()
LedgerMetadata
getEnsembleSize
in interface LedgerMetadata
public int getWriteQuorumSize()
LedgerMetadata
getWriteQuorumSize
in interface LedgerMetadata
public int getAckQuorumSize()
LedgerMetadata
getAckQuorumSize
in interface LedgerMetadata
public long getCtime()
LedgerMetadata
getCtime
in interface LedgerMetadata
public boolean hasPassword()
hasPassword
in interface LedgerMetadata
public byte[] getPassword()
LedgerMetadata
getPassword
in interface LedgerMetadata
public DigestType getDigestType()
LedgerMetadata
getDigestType
in interface LedgerMetadata
public long getLastEntryId()
LedgerMetadata
If this ledger is not sealed LedgerMetadata.isClosed()
, it returns -1L
.
getLastEntryId
in interface LedgerMetadata
public long getLength()
LedgerMetadata
If this ledger is not sealed LedgerMetadata.isClosed()
, it returns 0
.
getLength
in interface LedgerMetadata
public boolean isClosed()
LedgerMetadata
isClosed
in interface LedgerMetadata
public LedgerMetadata.State getState()
LedgerMetadata
getState
in interface LedgerMetadata
public java.util.List<org.apache.bookkeeper.net.BookieSocketAddress> getEnsembleAt(long entryId)
LedgerMetadata
entryId
.getEnsembleAt
in interface LedgerMetadata
entryId
- the entry id to retrieve its ensemble informationentryId
.public java.util.Map<java.lang.String,byte[]> getCustomMetadata()
LedgerMetadata
getCustomMetadata
in interface LedgerMetadata
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toSafeString()
toSafeString
in interface LedgerMetadata
public int getMetadataFormatVersion()
LedgerMetadata
getMetadataFormatVersion
in interface LedgerMetadata
boolean shouldStoreCtime()
public long getCToken()
LedgerMetadata
getCToken
in interface LedgerMetadata
Copyright © 2011–2020 The Apache Software Foundation. All rights reserved.