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.AutoCloseable
This 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 interface
LedgerEntryPage.EntryVisitor
Interface 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 void
close()
boolean
equals(java.lang.Object other)
void
getEntries(LedgerEntryPage.EntryVisitor vis)
Iterates over non-empty entry mappings.java.util.PrimitiveIterator.OfLong
getEntriesIterator()
EntryKey
getEntryKey()
(package private) long
getFirstEntry()
(package private) long
getFirstEntryPosition()
static int
getIndexEntrySize()
long
getLastEntry()
(package private) long
getLedger()
(package private) long
getMaxPossibleEntry()
long
getOffset(int position)
java.nio.ByteBuffer
getPageToWrite()
int
getVersion()
int
hashCode()
boolean
inUse()
(package private) boolean
isClean()
boolean
isDeleted()
void
markDeleted()
void
readPage(FileInfo fi)
void
releasePage()
void
releasePageNoCallback()
void
resetPage()
(package private) void
setClean(int versionOfCleaning)
(package private) void
setLedgerAndFirstEntry(long ledgerId, long firstEntry)
void
setOffset(long offset, int position)
java.lang.String
toString()
void
usePage()
void
zeroPage()
-
-
-
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:
toString
in classjava.lang.Object
-
usePage
public void usePage()
-
releasePageNoCallback
public void releasePageNoCallback()
-
releasePage
public void releasePage()
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in 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:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.lang.Exception
-
-