class ReadOnlyLedgerHandle extends LedgerHandle implements org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.LedgerMetadataListener
Modifier and Type | Class and Description |
---|---|
(package private) class |
ReadOnlyLedgerHandle.MetadataUpdater |
LedgerHandle.EnsembleInfo, LedgerHandle.LastAddConfirmedCallback, LedgerHandle.LastConfirmedCtx, LedgerHandle.NoopCloseCallback, LedgerHandle.SyncAddCallback, LedgerHandle.SyncCloseCallback, LedgerHandle.SyncReadCallback, LedgerHandle.SyncReadLastConfirmedCallback
bk, blockAddCompletions, bookieFailureHistory, distributionSchedule, enableParallelRecoveryRead, ensembleChangeCounter, explicitLacFlushPolicy, INVALID_ENTRY_ID, lacUpdateHitsCounter, lacUpdateMissesCounter, lastAddConfirmed, lastAddPushed, ledgerId, ledgerKey, length, LOG, macManager, metadata, numEnsembleChanges, pendingAddOps, recoveryReadBatchSize, throttler
Constructor and Description |
---|
ReadOnlyLedgerHandle(BookKeeper bk,
long ledgerId,
LedgerMetadata metadata,
BookKeeper.DigestType digestType,
byte[] password,
boolean watch) |
Modifier and Type | Method and Description |
---|---|
long |
addEntry(byte[] data)
Add entry synchronously to an open ledger.
|
long |
addEntry(byte[] data,
int offset,
int length)
Add entry synchronously to an open ledger.
|
void |
asyncAddEntry(byte[] data,
AsyncCallback.AddCallback cb,
Object ctx)
Add entry asynchronously to an open ledger.
|
void |
asyncAddEntry(byte[] data,
int offset,
int length,
AsyncCallback.AddCallback cb,
Object ctx)
Add entry asynchronously to an open ledger, using an offset and range.
|
void |
asyncClose(AsyncCallback.CloseCallback cb,
Object ctx)
Asynchronous close, any adds in flight will return errors.
|
void |
close()
Close this ledger synchronously.
|
(package private) void |
handleBookieFailure(Map<Integer,org.apache.bookkeeper.net.BookieSocketAddress> failedBookies) |
protected void |
initializeExplicitLacFlushPolicy() |
void |
onChanged(long lid,
LedgerMetadata newMetadata)
Triggered each time ledger metadata changed.
|
String |
toString() |
addEntry, addEntry, addToLength, asyncAddEntry, asyncAddEntry, asyncAddEntry, asyncCloseInternal, asyncReadEntries, asyncReadEntriesInternal, asyncReadExplicitLastConfirmed, asyncReadLastConfirmed, asyncReadLastConfirmedAndEntry, asyncReadUnconfirmedEntries, asyncRecoveryAddEntry, asyncTryReadLastConfirmed, doAsyncAddEntry, doAsyncCloseInternal, drainPendingAddsToErrorOut, errorOutPendingAdds, errorOutPendingAdds, getCustomMetadata, getDigestManager, getDistributionSchedule, getId, getLastAddConfirmed, getLastAddPushed, getLedgerKey, getLedgerMetadata, getLength, getNumBookies, getNumFragments, handleUnrecoverableErrorDuringAdd, isClosed, readEntries, readExplicitLastConfirmed, readLastConfirmed, readUnconfirmedEntries, recover, recover, registerOperationFailureOnBookie, replaceBookieInMetadata, rereadMetadata, sendAddSuccessCallbacks, setLastAddConfirmed, tryReadLastConfirmed, unsetSuccessAndSendWriteRequest, updateLastConfirmed, writeLedgerConfig
ReadOnlyLedgerHandle(BookKeeper bk, long ledgerId, LedgerMetadata metadata, BookKeeper.DigestType digestType, byte[] password, boolean watch) throws GeneralSecurityException, NumberFormatException
public void close() throws InterruptedException, BKException
LedgerHandle
close
in interface AutoCloseable
close
in class LedgerHandle
InterruptedException
BKException
LedgerHandle.asyncClose(org.apache.bookkeeper.client.AsyncCallback.CloseCallback, java.lang.Object)
public void asyncClose(AsyncCallback.CloseCallback cb, Object ctx)
LedgerHandle
asyncClose
in class LedgerHandle
cb
- callback implementationctx
- control objectpublic long addEntry(byte[] data) throws InterruptedException, BKException
LedgerHandle
addEntry
in class LedgerHandle
data
- array of bytes to be written to the ledgerInterruptedException
BKException
public long addEntry(byte[] data, int offset, int length) throws InterruptedException, BKException
LedgerHandle
addEntry
in class LedgerHandle
data
- 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(byte[] data, AsyncCallback.AddCallback cb, Object ctx)
LedgerHandle
asyncAddEntry
in class LedgerHandle
data
- array of bytes to be writtencb
- object implementing callbackinterfacectx
- some control objectpublic void asyncAddEntry(byte[] data, int offset, int length, AsyncCallback.AddCallback cb, Object ctx)
LedgerHandle
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 objectvoid handleBookieFailure(Map<Integer,org.apache.bookkeeper.net.BookieSocketAddress> failedBookies)
handleBookieFailure
in class LedgerHandle
public void onChanged(long lid, LedgerMetadata newMetadata)
org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.LedgerMetadataListener
onChanged
in interface org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.LedgerMetadataListener
lid
- ledger id.newMetadata
- new ledger metadata.protected void initializeExplicitLacFlushPolicy()
initializeExplicitLacFlushPolicy
in class LedgerHandle
Copyright © 2011–2017 The Apache Software Foundation. All rights reserved.