Package org.apache.bookkeeper.bookie
Class LedgerEntryPage
- java.lang.Object
-
- org.apache.bookkeeper.bookie.LedgerEntryPage
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class LedgerEntryPage extends java.lang.Object implements java.lang.AutoCloseableThis is a page in the LedgerCache. It holds the locations (entrylogfile, offset) for entry ids.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceLedgerEntryPage.EntryVisitorInterface for getEntries to propagate entry, pos pairs.
-
Constructor Summary
Constructors Constructor Description LedgerEntryPage(int pageSize, int entriesPerPage)LedgerEntryPage(int pageSize, int entriesPerPage, LEPStateChangeCallback callback)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanequals(java.lang.Object other)voidgetEntries(LedgerEntryPage.EntryVisitor vis)Iterates over non-empty entry mappings.java.util.PrimitiveIterator.OfLonggetEntriesIterator()EntryKeygetEntryKey()(package private) longgetFirstEntry()(package private) longgetFirstEntryPosition()static intgetIndexEntrySize()longgetLastEntry()(package private) longgetLedger()(package private) longgetMaxPossibleEntry()longgetOffset(int position)java.nio.ByteBuffergetPageToWrite()intgetVersion()inthashCode()booleaninUse()(package private) booleanisClean()booleanisDeleted()voidmarkDeleted()voidreadPage(FileInfo fi)voidreleasePage()voidreleasePageNoCallback()voidresetPage()(package private) voidsetClean(int versionOfCleaning)(package private) voidsetLedgerAndFirstEntry(long ledgerId, long firstEntry)voidsetOffset(long offset, int position)java.lang.StringtoString()voidusePage()voidzeroPage()
-
-
-
Constructor Detail
-
LedgerEntryPage
public LedgerEntryPage(int pageSize, int entriesPerPage)
-
LedgerEntryPage
public LedgerEntryPage(int pageSize, int entriesPerPage, LEPStateChangeCallback callback)
-
-
Method Detail
-
getIndexEntrySize
public static int getIndexEntrySize()
-
resetPage
public void resetPage()
-
markDeleted
public void markDeleted()
-
isDeleted
public boolean isDeleted()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
usePage
public void usePage()
-
releasePageNoCallback
public void releasePageNoCallback()
-
releasePage
public void releasePage()
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
setClean
void setClean(int versionOfCleaning)
-
isClean
boolean isClean()
-
setOffset
public void setOffset(long offset, int position)
-
getOffset
public long getOffset(int position)
-
zeroPage
public void zeroPage()
-
readPage
public void readPage(FileInfo fi) throws java.io.IOException
- Throws:
java.io.IOException
-
getPageToWrite
public java.nio.ByteBuffer getPageToWrite()
-
getLedger
long getLedger()
-
getVersion
public int getVersion()
-
getEntryKey
public EntryKey getEntryKey()
-
setLedgerAndFirstEntry
void setLedgerAndFirstEntry(long ledgerId, long firstEntry)
-
getFirstEntry
long getFirstEntry()
-
getMaxPossibleEntry
long getMaxPossibleEntry()
-
getFirstEntryPosition
long getFirstEntryPosition()
-
inUse
public boolean inUse()
-
getLastEntry
public long getLastEntry()
-
getEntries
public void getEntries(LedgerEntryPage.EntryVisitor vis) throws java.lang.Exception
Iterates over non-empty entry mappings.- Parameters:
vis- Consumer for entry position pairs.- Throws:
java.lang.Exception
-
getEntriesIterator
public java.util.PrimitiveIterator.OfLong getEntriesIterator()
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
-