Class LedgerMetadataIndex
- java.lang.Object
-
- org.apache.bookkeeper.bookie.storage.ldb.LedgerMetadataIndex
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class LedgerMetadataIndex extends java.lang.Object implements java.io.Closeable
Maintains an index for the ledgers metadata.The key is the ledgerId and the value is the
DbLedgerStorageDataFormats.LedgerData
content.
-
-
Constructor Summary
Constructors Constructor Description LedgerMetadataIndex(ServerConfiguration conf, KeyValueStorageFactory storageFactory, java.lang.String basePath, StatsLogger stats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
clearLimbo(long ledgerId)
void
close()
void
delete(long ledgerId)
void
flush()
Flushes all pending changes.DbLedgerStorageDataFormats.LedgerData
get(long ledgerId)
java.lang.Iterable<java.lang.Long>
getActiveLedgersInRange(long firstLedgerId, long lastLedgerId)
(package private) int
getStorageStateFlags()
void
removeDeletedLedgers()
void
set(long ledgerId, DbLedgerStorageDataFormats.LedgerData ledgerData)
(package private) void
setExplicitLac(long ledgerId, io.netty.buffer.ByteBuf lac)
boolean
setFenced(long ledgerId)
boolean
setLimbo(long ledgerId)
void
setMasterKey(long ledgerId, byte[] masterKey)
(package private) boolean
setStorageStateFlags(int expected, int newFlags)
-
-
-
Constructor Detail
-
LedgerMetadataIndex
public LedgerMetadataIndex(ServerConfiguration conf, KeyValueStorageFactory storageFactory, java.lang.String basePath, StatsLogger stats) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
get
public DbLedgerStorageDataFormats.LedgerData get(long ledgerId) throws java.io.IOException
- Throws:
java.io.IOException
-
set
public void set(long ledgerId, DbLedgerStorageDataFormats.LedgerData ledgerData) throws java.io.IOException
- Throws:
java.io.IOException
-
delete
public void delete(long ledgerId) throws java.io.IOException
- Throws:
java.io.IOException
-
getActiveLedgersInRange
public java.lang.Iterable<java.lang.Long> getActiveLedgersInRange(long firstLedgerId, long lastLedgerId) throws java.io.IOException
- Throws:
java.io.IOException
-
setFenced
public boolean setFenced(long ledgerId) throws java.io.IOException
- Throws:
java.io.IOException
-
setLimbo
public boolean setLimbo(long ledgerId) throws java.io.IOException
- Throws:
java.io.IOException
-
clearLimbo
public boolean clearLimbo(long ledgerId) throws java.io.IOException
- Throws:
java.io.IOException
-
setMasterKey
public void setMasterKey(long ledgerId, byte[] masterKey) throws java.io.IOException
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
Flushes all pending changes.- Throws:
java.io.IOException
-
removeDeletedLedgers
public void removeDeletedLedgers() throws java.io.IOException
- Throws:
java.io.IOException
-
getStorageStateFlags
int getStorageStateFlags() throws java.io.IOException
- Throws:
java.io.IOException
-
setStorageStateFlags
boolean setStorageStateFlags(int expected, int newFlags) throws java.io.IOException
- Throws:
java.io.IOException
-
setExplicitLac
void setExplicitLac(long ledgerId, io.netty.buffer.ByteBuf lac) throws java.io.IOException
- Throws:
java.io.IOException
-
-