public class LedgerHandleAdv extends LedgerHandle
LedgerHandle
to provide API to add entries with
user supplied entryIds. Through this interface Ledger Length may not be accurate wile the
ledger being written.Modifier and Type | Class and Description |
---|---|
(package private) static class |
LedgerHandleAdv.PendingOpsComparator |
LedgerHandle.EnsembleInfo, LedgerHandle.LastAddConfirmedCallback, LedgerHandle.LastConfirmedCtx, LedgerHandle.NoopCloseCallback, LedgerHandle.SyncAddCallback, LedgerHandle.SyncCloseCallback, LedgerHandle.SyncReadCallback, LedgerHandle.SyncReadLastConfirmedCallback
Modifier and Type | Field and Description |
---|---|
(package private) static org.slf4j.Logger |
LOG |
bk, blockAddCompletions, bookieFailureHistory, distributionSchedule, enableParallelRecoveryRead, ensembleChangeCounter, explicitLacFlushPolicy, INVALID_ENTRY_ID, lacUpdateHitsCounter, lacUpdateMissesCounter, lastAddConfirmed, lastAddPushed, ledgerId, ledgerKey, length, macManager, metadata, numEnsembleChanges, pendingAddOps, recoveryReadBatchSize, throttler
Constructor and Description |
---|
LedgerHandleAdv(BookKeeper bk,
long ledgerId,
LedgerMetadata metadata,
BookKeeper.DigestType digestType,
byte[] password) |
Modifier and Type | Method and Description |
---|---|
long |
addEntry(long entryId,
byte[] data)
Add entry synchronously to an open ledger.
|
long |
addEntry(long entryId,
byte[] data,
int offset,
int length)
Add entry synchronously to an open ledger.
|
void |
asyncAddEntry(byte[] data,
int offset,
int length,
AsyncCallback.AddCallback cb,
Object ctx)
LedgerHandleAdv will not allow addEntry without providing an entryId
|
void |
asyncAddEntry(io.netty.buffer.ByteBuf data,
AsyncCallback.AddCallback cb,
Object ctx)
LedgerHandleAdv will not allow addEntry without providing an entryId
|
void |
asyncAddEntry(long entryId,
byte[] data,
AsyncCallback.AddCallback cb,
Object ctx)
Add entry asynchronously to an open ledger.
|
void |
asyncAddEntry(long entryId,
byte[] data,
int offset,
int length,
AsyncCallback.AddCallback cb,
Object ctx)
Add entry asynchronously to an open ledger, using an offset and range.
|
protected void |
doAsyncAddEntry(PendingAddOp op,
io.netty.buffer.ByteBuf data,
AsyncCallback.AddCallback cb,
Object ctx)
Overriding part is mostly around setting entryId.
|
addEntry, addEntry, addToLength, asyncAddEntry, asyncClose, asyncCloseInternal, asyncReadEntries, asyncReadEntriesInternal, asyncReadExplicitLastConfirmed, asyncReadLastConfirmed, asyncReadLastConfirmedAndEntry, asyncReadUnconfirmedEntries, asyncRecoveryAddEntry, asyncTryReadLastConfirmed, close, doAsyncCloseInternal, drainPendingAddsToErrorOut, errorOutPendingAdds, errorOutPendingAdds, getCustomMetadata, getDigestManager, getDistributionSchedule, getId, getLastAddConfirmed, getLastAddPushed, getLedgerKey, getLedgerMetadata, getLength, getNumBookies, getNumFragments, handleBookieFailure, handleUnrecoverableErrorDuringAdd, initializeExplicitLacFlushPolicy, isClosed, readEntries, readExplicitLastConfirmed, readLastConfirmed, readUnconfirmedEntries, recover, recover, registerOperationFailureOnBookie, replaceBookieInMetadata, rereadMetadata, sendAddSuccessCallbacks, setLastAddConfirmed, tryReadLastConfirmed, unsetSuccessAndSendWriteRequest, updateLastConfirmed, writeLedgerConfig
LedgerHandleAdv(BookKeeper bk, long ledgerId, LedgerMetadata metadata, BookKeeper.DigestType digestType, byte[] password) throws GeneralSecurityException, NumberFormatException
public long addEntry(long entryId, byte[] data) throws InterruptedException, BKException
addEntry
in class LedgerHandle
entryId
- entryId of the entry to adddata
- array of bytes to be written to the ledgerInterruptedException
BKException
public long addEntry(long entryId, byte[] data, int offset, int length) throws InterruptedException, BKException
addEntry
in class LedgerHandle
entryId
- entryId of the entry to adddata
- array of bytes to be written to the ledgeroffset
- offset from which to take bytes from datalength
- number of bytes to take from dataInterruptedException
BKException
public void asyncAddEntry(long entryId, byte[] data, AsyncCallback.AddCallback cb, Object ctx)
asyncAddEntry
in class LedgerHandle
entryId
- entryId of the entry to adddata
- array of bytes to be writtencb
- object implementing callbackinterfacectx
- some control objectpublic void asyncAddEntry(long entryId, byte[] data, int offset, int length, AsyncCallback.AddCallback cb, Object ctx)
asyncAddEntry
in class LedgerHandle
entryId
- entryId of the entry to adddata
- array of bytes to be writtenoffset
- offset from which to take bytes from datalength
- number of bytes to take from datacb
- object implementing callbackinterfacectx
- some control objectArrayIndexOutOfBoundsException
- if offset or length is negative or offset and length sum to a
value higher than the length of data.protected void doAsyncAddEntry(PendingAddOp op, io.netty.buffer.ByteBuf data, AsyncCallback.AddCallback cb, Object ctx)
doAsyncAddEntry
in class LedgerHandle
public void asyncAddEntry(io.netty.buffer.ByteBuf data, AsyncCallback.AddCallback cb, Object ctx)
asyncAddEntry
in class LedgerHandle
public void asyncAddEntry(byte[] data, int offset, int length, AsyncCallback.AddCallback cb, Object ctx)
asyncAddEntry
in class LedgerHandle
data
- array of bytes to be writtenoffset
- offset from which to take bytes from datalength
- number of bytes to take from datacb
- object implementing callbackinterfacectx
- some control objectCopyright © 2011–2017 The Apache Software Foundation. All rights reserved.