Interface LedgerMetadata

All Known Implementing Classes:
LedgerMetadataImpl

@LimitedPrivate @Unstable public interface LedgerMetadata
Represents the client-side metadata of a ledger. It is immutable.
Since:
4.6
  • Method Details

    • getLedgerId

      long getLedgerId()
      Returns the id of this ledger.
      Returns:
      the id of this ledger.
    • getEnsembleSize

      int getEnsembleSize()
      Returns the ensemble size of this ledger.
      Returns:
      the ensemble size of this ledger.
    • getWriteQuorumSize

      int getWriteQuorumSize()
      Returns the write quorum size of this ledger.
      Returns:
      the write quorum size of this ledger.
    • getAckQuorumSize

      int getAckQuorumSize()
      Returns the ack quorum size of this ledger.
      Returns:
      the ack quorum size of this ledger.
    • getLastEntryId

      long getLastEntryId()
      Returns the last entry id of this ledger.

      If this ledger is not sealed isClosed(), it returns -1L.

      Returns:
      the last entry id of this ledger if it is sealed, otherwise -1.
    • getLength

      long getLength()
      Returns the length of this ledger.

      If this ledger is not sealed isClosed(), it returns 0.

      Returns:
      the length of this ledger if it is sealed, otherwise 0.
    • hasPassword

      boolean hasPassword()
      Whether the metadata contains the password and digest type for the ledger. Ledgers created with version 4.1.0 clients or older do not have this information.
      Returns:
      true if the metadata contains the password and digest type, false otherwise.
    • getPassword

      byte[] getPassword()
      Get the password for the ledger. For ledgers created with version 4.1.0 or older, an empty byte array is returned.
      Returns:
      the password for the ledger.
    • getDigestType

      DigestType getDigestType()
      Returns the digest type used by this ledger. May return null if the ledger was created with version 4.1.0 or below.
      Returns:
      the digest type used by this ledger.
    • getCtime

      long getCtime()
      Returns the creation timestamp of this ledger.
      Returns:
      the creation timestamp of this ledger.
    • isClosed

      boolean isClosed()
      Returns whether the ledger is sealed or not.
      Returns:
      true if the ledger is sealed, otherwise false.
    • getCustomMetadata

      Map<String,byte[]> getCustomMetadata()
      Returns the custom metadata stored with the ledgers.
      Returns:
      the custom metadata stored with the ledgers.
    • getEnsembleAt

      List<BookieId> getEnsembleAt(long entryId)
      Returns the ensemble at the given entryId.
      Parameters:
      entryId - the entry id to retrieve its ensemble information
      Returns:
      the ensemble which contains the given entryId.
    • getAllEnsembles

      NavigableMap<Long,? extends List<BookieId>> getAllEnsembles()
      Returns all the ensembles of this ledger.
      Returns:
      all the ensembles of this ledger.
    • getState

      Returns the state of the metadata.
      Returns:
      the state of the metadata.
    • toSafeString

      String toSafeString()
      Similar to #toString(), but omits the password of the ledger, so that it is safe to log the output.
      Returns:
      a string representation of the metadata, omitting the password.
    • getMetadataFormatVersion

      int getMetadataFormatVersion()
      Get the format version which should be used to serialize the metadata.
      Returns:
      the format version.
    • getCToken

      long getCToken()
      Get the unique creator token of the Ledger.
      Returns:
      the creator token