Package org.apache.bookkeeper.bookie
Class EntryLogMetadata
- java.lang.Object
-
- org.apache.bookkeeper.bookie.EntryLogMetadata
-
- Direct Known Subclasses:
EntryLogMetadata.EntryLogMetadataRecyclable
public class EntryLogMetadata extends java.lang.ObjectRecords the total size, remaining size and the set of ledgers that comprise a entry log.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEntryLogMetadata.EntryLogMetadataRecyclableRecyclableEntryLogMetadataclass.
-
Field Summary
Fields Modifier and Type Field Description protected longentryLogIdprotected ConcurrentLongLongHashMapledgersMapprotected longremainingSizeprotected longtotalSize
-
Constructor Summary
Constructors Modifier Constructor Description protectedEntryLogMetadata()EntryLogMetadata(long logId)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLedgerSize(long ledgerId, long size)voidclear()booleancontainsLedger(long ledgerId)static EntryLogMetadata.EntryLogMetadataRecyclabledeserialize(java.io.DataInputStream in)DeserializesEntryLogMetadata.EntryLogMetadataRecyclablefrom givenDataInputStream.longgetEntryLogId()ConcurrentLongLongHashMapgetLedgersMap()longgetRemainingSize()longgetTotalSize()doublegetUsage()booleanisEmpty()voidremoveLedgerIf(java.util.function.LongPredicate predicate)voidserialize(java.io.DataOutputStream out)SerializesEntryLogMetadataand writes toDataOutputStream.java.lang.StringtoString()
-
-
-
Field Detail
-
entryLogId
protected long entryLogId
-
totalSize
protected long totalSize
-
remainingSize
protected long remainingSize
-
ledgersMap
protected final ConcurrentLongLongHashMap ledgersMap
-
-
Method Detail
-
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
public ConcurrentLongLongHashMap getLedgersMap()
-
removeLedgerIf
public void removeLedgerIf(java.util.function.LongPredicate predicate)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
serialize
public void serialize(java.io.DataOutputStream out) throws java.io.IOException, java.lang.IllegalStateExceptionSerializesEntryLogMetadataand 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:
java.io.IOException- throws if it couldn't serialize metadata-fieldsjava.lang.IllegalStateException- throws if it couldn't serialize ledger-map
-
deserialize
public static EntryLogMetadata.EntryLogMetadataRecyclable deserialize(java.io.DataInputStream in) throws java.io.IOException
DeserializesEntryLogMetadata.EntryLogMetadataRecyclablefrom givenDataInputStream. Caller has to recycle returnedEntryLogMetadata.EntryLogMetadataRecyclable.- Parameters:
in-- Returns:
- Throws:
java.io.IOException
-
clear
public void clear()
-
-