Package org.apache.bookkeeper.bookie
Class EntryLogMetadata
java.lang.Object
org.apache.bookkeeper.bookie.EntryLogMetadata
- Direct Known Subclasses:
EntryLogMetadata.EntryLogMetadataRecyclable
Records the total size, remaining size and the set of ledgers that comprise a
entry log.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected final ConcurrentLongLongHashMapprotected longprotected long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLedgerSize(long ledgerId, long size) voidclear()booleancontainsLedger(long ledgerId) DeserializesEntryLogMetadata.EntryLogMetadataRecyclablefrom givenDataInputStream.longlonglongdoublegetUsage()booleanisEmpty()voidremoveLedgerIf(LongPredicate predicate) voidSerializesEntryLogMetadataand writes toDataOutputStream.toString()
-
Field Details
-
entryLogId
protected long entryLogId -
totalSize
protected long totalSize -
remainingSize
protected long remainingSize -
ledgersMap
-
-
Constructor Details
-
EntryLogMetadata
protected EntryLogMetadata() -
EntryLogMetadata
public EntryLogMetadata(long logId)
-
-
Method Details
-
addLedgerSize
public void addLedgerSize(long ledgerId, long size) -
containsLedger
public boolean containsLedger(long ledgerId) -
getUsage
public double getUsage() -
isEmpty
public boolean isEmpty() -
getEntryLogId
public long getEntryLogId() -
getTotalSize
public long getTotalSize() -
getRemainingSize
public long getRemainingSize() -
getLedgersMap
-
removeLedgerIf
-
toString
-
serialize
SerializesEntryLogMetadataand writes toDataOutputStream.schema: 2-bytes: schema-version 8-bytes: entrylog-entryLogId 8-bytes: entrylog-totalSize 8-bytes: entrylog-remainingSize 8-bytes: total number of ledgers ledgers-map [repeat]: (8-bytes::ledgerId, 8-bytes::size-of-ledger)
- Parameters:
out-- Throws:
IOException- throws if it couldn't serialize metadata-fieldsIllegalStateException- throws if it couldn't serialize ledger-map
-
deserialize
public static EntryLogMetadata.EntryLogMetadataRecyclable deserialize(DataInputStream in) throws IOException DeserializesEntryLogMetadata.EntryLogMetadataRecyclablefrom givenDataInputStream. Caller has to recycle returnedEntryLogMetadata.EntryLogMetadataRecyclable.- Parameters:
in-- Returns:
- Throws:
IOException
-
clear
public void clear()
-