Package org.apache.bookkeeper.verifier
Class BookkeeperVerifier.LedgerInfo
- java.lang.Object
-
- org.apache.bookkeeper.verifier.BookkeeperVerifier.LedgerInfo
-
- Enclosing class:
- BookkeeperVerifier
class BookkeeperVerifier.LedgerInfo extends java.lang.Object
Contains the state required to reconstruct the contents of any entry in the ledger. The seed value passed into the constructor fully determines the contents of the ledger. Each EntryInfo has its own seed generated sequentially from a Random instance seeded from the original seed. It then uses that seed to generate a secondary Random instance for generating the bytes within the entry. See EntryIterator for details. Random(seed) | E0 -> Random(E0) -> getBuffer() | E1 -> Random(E1) -> getBuffer() | E2 -> Random(E2) -> getBuffer() | E3 -> Random(E3) -> getBuffer() | E4 -> Random(E4) -> getBuffer() | ...
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
BookkeeperVerifier.LedgerInfo.EntryIterator
-
Field Summary
Fields Modifier and Type Field Description (package private) BookkeeperVerifier.LedgerInfo.EntryIterator
iter
(package private) java.util.function.Consumer<java.util.function.Consumer<java.lang.Integer>>
onLastOp
(package private) java.util.function.Consumer<java.util.function.Consumer<java.lang.Integer>>
onLastWrite
(package private) int
readsInProgress
(package private) java.util.TreeSet<java.lang.Long>
writesCompleted
(package private) java.util.TreeSet<java.lang.Long>
writesInProgress
-
Constructor Summary
Constructors Constructor Description LedgerInfo(long ledgerID, long seed)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
closeWrite(long entryID, java.util.function.Consumer<java.lang.Integer> cb)
(package private) void
decReads(java.util.function.Consumer<java.lang.Integer> cb)
(package private) long
getConfirmedLAC()
(package private) BookkeeperVerifier.LedgerInfo.EntryIterator
getIterator()
(package private) long
getLastEntryIDCompleted()
(package private) java.util.ArrayList<BookkeeperVerifier.EntryInfo>
getNextEntries(int num)
(package private) void
incReads()
boolean
isClosed()
(package private) void
onLastOpComplete(java.util.function.Consumer<java.lang.Integer> cb, java.util.function.Consumer<java.util.function.Consumer<java.lang.Integer>> newOnLastOp)
The idea here is that we may need to register an operation which needs to run whenever the final op completes on this Ledger (like deletion).(package private) void
onLastWriteComplete(java.util.function.Consumer<java.lang.Integer> cb, java.util.function.Consumer<java.util.function.Consumer<java.lang.Integer>> newOnLastWrite)
Very similar to onLastOpComplete, but gets called on the final call to closeWrite.(package private) void
openWrite(long entryID)
void
setClosed()
(package private) void
updateLAC(long lac)
-
-
-
Field Detail
-
writesInProgress
final java.util.TreeSet<java.lang.Long> writesInProgress
-
writesCompleted
final java.util.TreeSet<java.lang.Long> writesCompleted
-
readsInProgress
int readsInProgress
-
onLastOp
java.util.function.Consumer<java.util.function.Consumer<java.lang.Integer>> onLastOp
-
onLastWrite
java.util.function.Consumer<java.util.function.Consumer<java.lang.Integer>> onLastWrite
-
-
Method Detail
-
getLastEntryIDCompleted
long getLastEntryIDCompleted()
-
getConfirmedLAC
long getConfirmedLAC()
-
getNextEntries
java.util.ArrayList<BookkeeperVerifier.EntryInfo> getNextEntries(int num)
-
getIterator
BookkeeperVerifier.LedgerInfo.EntryIterator getIterator()
-
openWrite
void openWrite(long entryID)
-
incReads
void incReads()
-
onLastOpComplete
void onLastOpComplete(java.util.function.Consumer<java.lang.Integer> cb, java.util.function.Consumer<java.util.function.Consumer<java.lang.Integer>> newOnLastOp)
The idea here is that we may need to register an operation which needs to run whenever the final op completes on this Ledger (like deletion). If there are none, newOnLastOp should be called synchronously with cb. Otherwise, cb should be called synchronously with cb and newOnLastOp should be called with the cb passed in with the decReads or closeWrite. In the deletion case, cb would be the callback for the error from the deletion operation (if it happens). The reason for all of this is that the delete case will need to chain an async call to delete into the async callback chain for whatever the last operation to complete on this Ledger. newOnLastOp would invoke that delete. The cb passed in allows it to pick up and continue the original chain.- Parameters:
cb
- Callback to get result of newOnLastOp if called nownewOnLastOp
- Callback to be invoked on the last decReads or closeWrite, should be passed the cb passed in with the final closeWrite or decReads
-
onLastWriteComplete
void onLastWriteComplete(java.util.function.Consumer<java.lang.Integer> cb, java.util.function.Consumer<java.util.function.Consumer<java.lang.Integer>> newOnLastWrite)
Very similar to onLastOpComplete, but gets called on the final call to closeWrite.- Parameters:
cb
- Callback to get result of newOnLastWrite if called nownewOnLastWrite
- Callback to be invoked on the last closeWrite, should be passed the cb passed in with the final closeWrite.
-
closeWrite
void closeWrite(long entryID, java.util.function.Consumer<java.lang.Integer> cb)
-
updateLAC
void updateLAC(long lac)
-
decReads
void decReads(java.util.function.Consumer<java.lang.Integer> cb)
-
isClosed
public boolean isClosed()
-
setClosed
public void setClosed()
-
-