类 ManagedLedgerImpl
java.lang.Object
org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl
- 所有已实现的接口:
org.apache.bookkeeper.client.AsyncCallback.CreateCallback,ManagedLedger
- 直接已知子类:
ReadOnlyManagedLedgerImpl
public class ManagedLedgerImpl
extends Object
implements ManagedLedger, org.apache.bookkeeper.client.AsyncCallback.CreateCallback
-
嵌套类概要
嵌套类 -
字段概要
字段修饰符和类型字段说明protected static final AtomicLongFieldUpdater<ManagedLedgerImpl>protected static final intprotected final org.apache.bookkeeper.client.BookKeeperprotected final Clockprotected ManagedLedgerConfigprotected org.apache.bookkeeper.client.LedgerHandleprotected longprotected static final intprotected static final intprotected final org.apache.bookkeeper.client.BookKeeper.DigestTypeprotected final NavigableMap<Long,MLDataFormats.ManagedLedgerInfo.LedgerInfo> protected final ManagedLedgerMBeanImplprotected final Stringprotected ManagedLedgerImpl.Stateprotected final MetaStore -
构造器概要
构造器构造器说明ManagedLedgerImpl(ManagedLedgerFactoryImpl factory, org.apache.bookkeeper.client.BookKeeper bookKeeper, MetaStore store, ManagedLedgerConfig config, org.apache.bookkeeper.common.util.OrderedScheduler scheduledExecutor, String name) ManagedLedgerImpl(ManagedLedgerFactoryImpl factory, org.apache.bookkeeper.client.BookKeeper bookKeeper, MetaStore store, ManagedLedgerConfig config, org.apache.bookkeeper.common.util.OrderedScheduler scheduledExecutor, String name, Supplier<Boolean> mlOwnershipChecker) -
方法概要
修饰符和类型方法说明voidactivateCursor(ManagedCursor cursor) addEntry(byte[] data) Append a new entry to the end of a managed ledger.addEntry(byte[] data, int numberOfMessages) Append a new entry to the end of a managed ledger.addEntry(byte[] data, int offset, int length) Append a new entry to the end of a managed ledger.addEntry(byte[] data, int numberOfMessages, int offset, int length) Append a new entry to the end of a managed ledger.voidprotected voidafterFailedAddEntry(int numOfMessages) voidasyncAddEntry(byte[] data, int numberOfMessages, int offset, int length, AsyncCallbacks.AddEntryCallback callback, Object ctx) Append a new entry asynchronously.voidasyncAddEntry(byte[] data, int offset, int length, AsyncCallbacks.AddEntryCallback callback, Object ctx) Append a new entry asynchronously.voidasyncAddEntry(byte[] data, AsyncCallbacks.AddEntryCallback callback, Object ctx) Append a new entry asynchronously.voidasyncAddEntry(io.netty.buffer.ByteBuf buffer, int numberOfMessages, AsyncCallbacks.AddEntryCallback callback, Object ctx) Append a new entry asynchronously.voidasyncAddEntry(io.netty.buffer.ByteBuf buffer, AsyncCallbacks.AddEntryCallback callback, Object ctx) Append a new entry asynchronously.voidasyncClose(AsyncCallbacks.CloseCallback callback, Object ctx) Close the ManagedLedger asynchronously.protected voidasyncCreateLedger(org.apache.bookkeeper.client.BookKeeper bookKeeper, ManagedLedgerConfig config, org.apache.bookkeeper.client.BookKeeper.DigestType digestType, org.apache.bookkeeper.client.AsyncCallback.CreateCallback cb, Map<String, byte[]> metadata) Create ledger async and schedule a timeout task to check ledger-creation is complete else it fails the callback with TimeoutException.voidasyncDelete(AsyncCallbacks.DeleteLedgerCallback callback, Object ctx) Async delete a ledger.voidasyncDeleteCursor(String consumerName, AsyncCallbacks.DeleteCursorCallback callback, Object ctx) Delete a ManagedCursor asynchronously.voidasyncDeleteProperty(String key, AsyncCallbacks.UpdatePropertiesCallback callback, Object ctx) Async delete the property by key.asyncFindPosition(com.google.common.base.Predicate<Entry> predicate) Find position by sequenceId.voidasyncOffloadPrefix(Position pos, AsyncCallbacks.OffloadCallback callback, Object ctx) Offload as many entries before position as possible to longterm storage.voidasyncOpenCursor(String cursorName, AsyncCallbacks.OpenCursorCallback callback, Object ctx) Open a ManagedCursor asynchronously.voidasyncOpenCursor(String cursorName, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, Map<String, Long> properties, Map<String, String> cursorProperties, AsyncCallbacks.OpenCursorCallback callback, Object ctx) Open a ManagedCursor asynchronously.voidasyncOpenCursor(String cursorName, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, AsyncCallbacks.OpenCursorCallback callback, Object ctx) Open a ManagedCursor asynchronously.protected voidasyncReadEntry(org.apache.bookkeeper.client.api.ReadHandle ledger, long firstEntry, long lastEntry, boolean isSlowestReader, org.apache.bookkeeper.mledger.impl.OpReadEntry opReadEntry, Object ctx) protected voidasyncReadEntry(org.apache.bookkeeper.client.api.ReadHandle ledger, PositionImpl position, AsyncCallbacks.ReadEntryCallback callback, Object ctx) voidasyncReadEntry(PositionImpl position, AsyncCallbacks.ReadEntryCallback callback, Object ctx) voidasyncSetProperties(Map<String, String> properties, AsyncCallbacks.UpdatePropertiesCallback callback, Object ctx) Async update managed-ledger's properties.voidasyncSetProperty(String key, String value, AsyncCallbacks.UpdatePropertiesCallback callback, Object ctx) Async add key-value to propertiesMap.voidasyncTerminate(AsyncCallbacks.TerminateCallback callback, Object ctx) Truncate ledgers The truncate operation will move all cursors to the end of the topic and delete all inactive ledgers.protected booleancheckAndCompleteLedgerOpTask(int rc, org.apache.bookkeeper.client.LedgerHandle lh, Object ctx) check if ledger-op task is already completed by timeout-task.voidCheck current inactive ledger (based onManagedLedgerConfig.getInactiveLedgerRollOverTimeMs()and roll over that ledger if inactive.voidclose()Close the ManagedLedger.voidcreateComplete(int rc, org.apache.bookkeeper.client.LedgerHandle lh, Object ctx) static ManagedLedgerExceptioncreateManagedLedgerException(int bkErrorCode) static ManagedLedgerExceptionvoiddeactivateCursor(ManagedCursor cursor) voiddelete()Delete this ManagedLedger completely from the system.voiddeleteCursor(String name) Remove a ManagedCursor from this ManagedLedger.voiddeleteProperty(String key) Delete the property by key.Get a list of all the active cursors reading from this ManagedLedger.longgetClock()Returns managed-ledger config.longlongGet a list of all the cursors reading from this ManagedLedger.Get the publishing time of the oldest message in the backlog.CompletableFuture<Set<org.apache.bookkeeper.net.BookieId>>getEnsemblesAsync(long ledgerId) longlongGet estimated total unconsumed or backlog size in bytes for the managed ledger, without accounting for replicas.longGet estimated backlog size from a specific position.Gets last confirmed entry of the managed ledger.longlonglongGet last failed offloaded timestamp.longGet last offloaded ledgerId.longGet last suceessful offloaded timestamp.getLedgerInfo(long ledgerId) Get basic ledger summary.getLedgerMetadata(long ledgerId) Get the ManagedLedgerInterceptor for ManagedLedger.CompletableFuture<org.apache.pulsar.common.policies.data.ManagedLedgerInternalStats>getManagedLedgerInternalStats(boolean includeLedgerMetadata) Get managed ledger internal stats.getName()getNextValidLedger(long ledgerId) getNextValidPosition(PositionImpl position) getNextValidPositionInternal(PositionImpl position) longGet the total number of active entries for this managed ledger.longGet the total number of entries for this managed ledger.longReturn the size of all ledgers offloaded to 2nd tier storage.getOptionalLedgerInfo(long ledgerId) Get basic ledger summary.intgetPositionAfterN(PositionImpl startPosition, long n, ManagedLedgerImpl.PositionBound startRange) Get the entry position at a given distance from a given position.getPreviousPosition(PositionImpl position) Get the entry position that come before the specified position in the message stream, using information from the ledger list and each ledger entries count.Returns managed-ledger's properties.Get the slowest consumer.getState()getStats()longGet the total sizes in bytes of the managed ledger, without accounting for replicas.intbooleanTells whether the managed ledger has any active-cursor registered.booleanhasMoreEntries(PositionImpl position) voidinvalidateLedgerHandle(org.apache.bookkeeper.client.api.ReadHandle ledgerHandle) booleanisCursorActive(ManagedCursor cursor) protected booleanbooleanReturns whether the managed ledger was terminated.booleanisValidPosition(PositionImpl position) Validate whether a specified position is valid for the current managed ledger.booleanledgerExists(long ledgerId) voidnewNonDurableCursor(Position startCursorPosition) Creates a new cursor whose metadata is not backed by durable storage.newNonDurableCursor(Position startPosition, String subscriptionName) newNonDurableCursor(Position startCursorPosition, String cursorName, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, boolean isReadCompacted) offloadPrefix(Position pos) Offload as many entries before position as possible to longterm storage.voidonCursorReadPositionUpdated(ManagedCursorImpl cursor, Position newReadPosition) openCursor(String cursorName) Open a ManagedCursor in this ManagedLedger.openCursor(String cursorName, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition) Open a ManagedCursor in this ManagedLedger.openCursor(String cursorName, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, Map<String, Long> properties, Map<String, String> cursorProperties) Open a ManagedCursor in this ManagedLedger.voidSignaling managed ledger that we can resume after BK write failure.voidremoveWaitingCursor(ManagedCursor cursor) Remove a ManagedCursor from this ManagedLedger's waitingCursors.voidRoll current ledger if it is full.voidsetConfig(ManagedLedgerConfig config) Updates managed-ledger config.voidsetEntriesAddedCounter(long count) voidsetProperties(Map<String, String> properties) Update managed-ledger's properties.voidsetProperty(String key, String value) Add key-value to propertiesMap.Terminate the managed ledger and return the last committed entry.voidtrimConsumedLedgersInBackground(boolean isTruncate, CompletableFuture<?> promise) voidtrimConsumedLedgersInBackground(CompletableFuture<?> promise) Trim consumed ledgers in background.voidupdateLedgersIdsComplete(org.apache.bookkeeper.client.LedgerHandle originalCurrentLedger)
-
字段详细资料
-
AsyncOperationTimeoutSeconds
protected static final int AsyncOperationTimeoutSeconds- 另请参阅:
-
bookKeeper
protected final org.apache.bookkeeper.client.BookKeeper bookKeeper -
name
-
digestType
protected final org.apache.bookkeeper.client.BookKeeper.DigestType digestType -
config
-
propertiesMap
-
store
-
ledgers
-
currentLedger
protected volatile org.apache.bookkeeper.client.LedgerHandle currentLedger -
currentLedgerSize
protected long currentLedgerSize -
mlOwnershipChecker
-
DEFAULT_LEDGER_DELETE_RETRIES
protected static final int DEFAULT_LEDGER_DELETE_RETRIES- 另请参阅:
-
DEFAULT_LEDGER_DELETE_BACKOFF_TIME_SEC
protected static final int DEFAULT_LEDGER_DELETE_BACKOFF_TIME_SEC- 另请参阅:
-
state
-
mbean
-
clock
-
ADD_OP_COUNT_UPDATER
-
-
构造器详细资料
-
ManagedLedgerImpl
public ManagedLedgerImpl(ManagedLedgerFactoryImpl factory, org.apache.bookkeeper.client.BookKeeper bookKeeper, MetaStore store, ManagedLedgerConfig config, org.apache.bookkeeper.common.util.OrderedScheduler scheduledExecutor, String name) -
ManagedLedgerImpl
public ManagedLedgerImpl(ManagedLedgerFactoryImpl factory, org.apache.bookkeeper.client.BookKeeper bookKeeper, MetaStore store, ManagedLedgerConfig config, org.apache.bookkeeper.common.util.OrderedScheduler scheduledExecutor, String name, Supplier<Boolean> mlOwnershipChecker)
-
-
方法详细资料
-
getName
- 指定者:
getName在接口中ManagedLedger- 返回:
- the unique name of this ManagedLedger
-
addEntry
从接口复制的说明:ManagedLedgerAppend a new entry to the end of a managed ledger.- 指定者:
addEntry在接口中ManagedLedger- 参数:
data- data entry to be persisted- 返回:
- the Position at which the entry has been inserted
- 抛出:
ManagedLedgerExceptionInterruptedException
-
addEntry
public Position addEntry(byte[] data, int numberOfMessages) throws InterruptedException, ManagedLedgerException 从接口复制的说明:ManagedLedgerAppend a new entry to the end of a managed ledger.- 指定者:
addEntry在接口中ManagedLedger- 参数:
data- data entry to be persistednumberOfMessages- numberOfMessages of entry- 返回:
- the Position at which the entry has been inserted
- 抛出:
ManagedLedgerExceptionInterruptedException
-
addEntry
public Position addEntry(byte[] data, int offset, int length) throws InterruptedException, ManagedLedgerException 从接口复制的说明:ManagedLedgerAppend a new entry to the end of a managed ledger.- 指定者:
addEntry在接口中ManagedLedger- 参数:
data- data entry to be persistedoffset- offset in the data arraylength- number of bytes- 返回:
- the Position at which the entry has been inserted
- 抛出:
ManagedLedgerExceptionInterruptedException
-
addEntry
public Position addEntry(byte[] data, int numberOfMessages, int offset, int length) throws InterruptedException, ManagedLedgerException 从接口复制的说明:ManagedLedgerAppend a new entry to the end of a managed ledger.- 指定者:
addEntry在接口中ManagedLedger- 参数:
data- data entry to be persistednumberOfMessages- numberOfMessages of entryoffset- offset in the data arraylength- number of bytes- 返回:
- the Position at which the entry has been inserted
- 抛出:
ManagedLedgerExceptionInterruptedException
-
asyncAddEntry
从接口复制的说明:ManagedLedgerAppend a new entry asynchronously.- 指定者:
asyncAddEntry在接口中ManagedLedger- 参数:
data- data entry to be persistedcallback- callback objectctx- opaque context- 另请参阅:
-
asyncAddEntry
public void asyncAddEntry(byte[] data, int offset, int length, AsyncCallbacks.AddEntryCallback callback, Object ctx) 从接口复制的说明:ManagedLedgerAppend a new entry asynchronously.- 指定者:
asyncAddEntry在接口中ManagedLedger- 参数:
data- data entry to be persistedoffset- offset in the data arraylength- number of bytescallback- callback objectctx- opaque context- 另请参阅:
-
asyncAddEntry
public void asyncAddEntry(byte[] data, int numberOfMessages, int offset, int length, AsyncCallbacks.AddEntryCallback callback, Object ctx) 从接口复制的说明:ManagedLedgerAppend a new entry asynchronously.- 指定者:
asyncAddEntry在接口中ManagedLedger- 参数:
data- data entry to be persistednumberOfMessages- numberOfMessages of entryoffset- offset in the data arraylength- number of bytescallback- callback objectctx- opaque context- 另请参阅:
-
asyncAddEntry
public void asyncAddEntry(io.netty.buffer.ByteBuf buffer, AsyncCallbacks.AddEntryCallback callback, Object ctx) 从接口复制的说明:ManagedLedgerAppend a new entry asynchronously.- 指定者:
asyncAddEntry在接口中ManagedLedger- 参数:
buffer- buffer with the data entrycallback- callback objectctx- opaque context- 另请参阅:
-
asyncAddEntry
public void asyncAddEntry(io.netty.buffer.ByteBuf buffer, int numberOfMessages, AsyncCallbacks.AddEntryCallback callback, Object ctx) 从接口复制的说明:ManagedLedgerAppend a new entry asynchronously.- 指定者:
asyncAddEntry在接口中ManagedLedger- 参数:
buffer- buffer with the data entrynumberOfMessages- numberOfMessages for data entrycallback- callback objectctx- opaque context- 另请参阅:
-
afterFailedAddEntry
protected void afterFailedAddEntry(int numOfMessages) -
readyToCreateNewLedger
public void readyToCreateNewLedger()从接口复制的说明:ManagedLedgerSignaling managed ledger that we can resume after BK write failure.- 指定者:
readyToCreateNewLedger在接口中ManagedLedger
-
openCursor
public ManagedCursor openCursor(String cursorName) throws InterruptedException, ManagedLedgerException 从接口复制的说明:ManagedLedgerOpen a ManagedCursor in this ManagedLedger. If the cursors doesn't exist, a new one will be created and its position will be at the end of the ManagedLedger.- 指定者:
openCursor在接口中ManagedLedger- 参数:
cursorName- the name associated with the ManagedCursor- 返回:
- the ManagedCursor
- 抛出:
ManagedLedgerExceptionInterruptedException
-
openCursor
public ManagedCursor openCursor(String cursorName, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition) throws InterruptedException, ManagedLedgerException 从接口复制的说明:ManagedLedgerOpen a ManagedCursor in this ManagedLedger.If the cursors doesn't exist, a new one will be created and its position will be at the end of the ManagedLedger.
- 指定者:
openCursor在接口中ManagedLedger- 参数:
cursorName- the name associated with the ManagedCursorinitialPosition- if null, the cursor will be set at latest position when first created- 返回:
- the ManagedCursor
- 抛出:
ManagedLedgerExceptionInterruptedException
-
openCursor
public ManagedCursor openCursor(String cursorName, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, Map<String, Long> properties, Map<String, throws InterruptedException, ManagedLedgerExceptionString> cursorProperties) 从接口复制的说明:ManagedLedgerOpen a ManagedCursor in this ManagedLedger.If the cursors doesn't exist, a new one will be created and its position will be at the end of the ManagedLedger.
- 指定者:
openCursor在接口中ManagedLedger- 参数:
cursorName- the name associated with the ManagedCursorinitialPosition- if null, the cursor will be set at latest position when first createdproperties- user defined properties that will be attached to the first position of the cursor, if the open operation will trigger the creation of the cursor.cursorProperties- the properties for the Cursor- 返回:
- the ManagedCursor
- 抛出:
ManagedLedgerExceptionInterruptedException
-
asyncOpenCursor
public void asyncOpenCursor(String cursorName, AsyncCallbacks.OpenCursorCallback callback, Object ctx) 从接口复制的说明:ManagedLedgerOpen a ManagedCursor asynchronously.- 指定者:
asyncOpenCursor在接口中ManagedLedger- 参数:
cursorName- the name associated with the ManagedCursorcallback- callback objectctx- opaque context- 另请参阅:
-
asyncOpenCursor
public void asyncOpenCursor(String cursorName, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, AsyncCallbacks.OpenCursorCallback callback, Object ctx) 从接口复制的说明:ManagedLedgerOpen a ManagedCursor asynchronously.- 指定者:
asyncOpenCursor在接口中ManagedLedger- 参数:
cursorName- the name associated with the ManagedCursorinitialPosition- if null, the cursor will be set at latest position when first createdcallback- callback objectctx- opaque context- 另请参阅:
-
asyncOpenCursor
public void asyncOpenCursor(String cursorName, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, Map<String, Long> properties, Map<String, String> cursorProperties, AsyncCallbacks.OpenCursorCallback callback, Object ctx) 从接口复制的说明:ManagedLedgerOpen a ManagedCursor asynchronously.- 指定者:
asyncOpenCursor在接口中ManagedLedger- 参数:
cursorName- the name associated with the ManagedCursorinitialPosition- if null, the cursor will be set at latest position when first createdcursorProperties- the properties for the Cursorcallback- callback objectctx- opaque context- 另请参阅:
-
asyncDeleteCursor
public void asyncDeleteCursor(String consumerName, AsyncCallbacks.DeleteCursorCallback callback, Object ctx) 从接口复制的说明:ManagedLedgerDelete a ManagedCursor asynchronously.- 指定者:
asyncDeleteCursor在接口中ManagedLedger- 参数:
consumerName- the name associated with the ManagedCursorcallback- callback objectctx- opaque context- 另请参阅:
-
deleteCursor
从接口复制的说明:ManagedLedgerRemove a ManagedCursor from this ManagedLedger. If the cursor doesn't exist, the operation will still succeed.- 指定者:
deleteCursor在接口中ManagedLedger- 参数:
name- the name associated with the ManagedCursor- 抛出:
InterruptedExceptionManagedLedgerException
-
newNonDurableCursor
public ManagedCursor newNonDurableCursor(Position startCursorPosition) throws ManagedLedgerException 从接口复制的说明:ManagedLedgerCreates a new cursor whose metadata is not backed by durable storage. A caller can treat the non-durable cursor exactly like a normal cursor, with the only difference in that after restart it will not remember which entries were deleted. Also it does not prevent data from being deleted. The cursor is anonymous and can be positioned on an arbitrary position. This method is not-blocking.- 指定者:
newNonDurableCursor在接口中ManagedLedger- 参数:
startCursorPosition- the position where the cursor should be initialized, or null to start from the current latest entry. When starting on a particular cursor position, the first entry to be returned will be the entry next to the specified position- 返回:
- the new NonDurableCursor
- 抛出:
ManagedLedgerException
-
newNonDurableCursor
public ManagedCursor newNonDurableCursor(Position startPosition, String subscriptionName) throws ManagedLedgerException - 指定者:
newNonDurableCursor在接口中ManagedLedger- 抛出:
ManagedLedgerException
-
newNonDurableCursor
public ManagedCursor newNonDurableCursor(Position startCursorPosition, String cursorName, org.apache.pulsar.common.api.proto.CommandSubscribe.InitialPosition initialPosition, boolean isReadCompacted) throws ManagedLedgerException - 指定者:
newNonDurableCursor在接口中ManagedLedger- 抛出:
ManagedLedgerException
-
getCursors
从接口复制的说明:ManagedLedgerGet a list of all the cursors reading from this ManagedLedger.- 指定者:
getCursors在接口中ManagedLedger- 返回:
- a list of cursors
-
getActiveCursors
从接口复制的说明:ManagedLedgerGet a list of all the active cursors reading from this ManagedLedger.- 指定者:
getActiveCursors在接口中ManagedLedger- 返回:
- a list of cursors
-
hasActiveCursors
public boolean hasActiveCursors()Tells whether the managed ledger has any active-cursor registered.- 返回:
- true if at least a cursor exists
-
getNumberOfEntries
public long getNumberOfEntries()从接口复制的说明:ManagedLedgerGet the total number of entries for this managed ledger. This is defined by the number of entries in all the BookKeeper ledgers that are being maintained by this ManagedLedger. This method is non-blocking.- 指定者:
getNumberOfEntries在接口中ManagedLedger- 返回:
- the number of entries
-
getNumberOfActiveEntries
public long getNumberOfActiveEntries()从接口复制的说明:ManagedLedgerGet the total number of active entries for this managed ledger. This is defined by the number of non consumed entries in all the BookKeeper ledgers that are being maintained by this ManagedLedger. This method is non-blocking.- 指定者:
getNumberOfActiveEntries在接口中ManagedLedger- 返回:
- the number of entries
-
getTotalSize
public long getTotalSize()从接口复制的说明:ManagedLedgerGet the total sizes in bytes of the managed ledger, without accounting for replicas. This is defined by the sizes of all the BookKeeper ledgers that are being maintained by this ManagedLedger. This method is non-blocking.- 指定者:
getTotalSize在接口中ManagedLedger- 返回:
- total size in bytes
-
getEstimatedBacklogSize
public long getEstimatedBacklogSize()从接口复制的说明:ManagedLedgerGet estimated total unconsumed or backlog size in bytes for the managed ledger, without accounting for replicas.- 指定者:
getEstimatedBacklogSize在接口中ManagedLedger- 返回:
- estimated total backlog size
-
getEarliestMessagePublishTimeInBacklog
从接口复制的说明:ManagedLedgerGet the publishing time of the oldest message in the backlog.- 指定者:
getEarliestMessagePublishTimeInBacklog在接口中ManagedLedger- 返回:
- the publishing time of the oldest message
-
getEarliestMessagePublishTimeOfPos
-
getEstimatedBacklogSize
Get estimated backlog size from a specific position. -
asyncTerminate
- 指定者:
asyncTerminate在接口中ManagedLedger
-
terminate
从接口复制的说明:ManagedLedgerTerminate the managed ledger and return the last committed entry. Once the managed ledger is terminated, it will not accept any more write- 指定者:
terminate在接口中ManagedLedger- 返回:
- 抛出:
InterruptedExceptionManagedLedgerException
-
isTerminated
public boolean isTerminated()从接口复制的说明:ManagedLedgerReturns whether the managed ledger was terminated.- 指定者:
isTerminated在接口中ManagedLedger
-
close
从接口复制的说明:ManagedLedgerClose the ManagedLedger. This will close all the underlying BookKeeper ledgers. All the ManagedCursors associated will be invalidated.- 指定者:
close在接口中ManagedLedger- 抛出:
ManagedLedgerExceptionInterruptedException
-
asyncClose
从接口复制的说明:ManagedLedgerClose the ManagedLedger asynchronously.- 指定者:
asyncClose在接口中ManagedLedger- 参数:
callback- callback objectctx- opaque context- 另请参阅:
-
createComplete
- 指定者:
createComplete在接口中org.apache.bookkeeper.client.AsyncCallback.CreateCallback
-
updateLedgersIdsComplete
public void updateLedgersIdsComplete(@Nullable org.apache.bookkeeper.client.LedgerHandle originalCurrentLedger) -
rollCurrentLedgerIfFull
public void rollCurrentLedgerIfFull()从接口复制的说明:ManagedLedgerRoll current ledger if it is full.- 指定者:
rollCurrentLedgerIfFull在接口中ManagedLedger
-
asyncFindPosition
public CompletableFuture<Position> asyncFindPosition(com.google.common.base.Predicate<Entry> predicate) 从接口复制的说明:ManagedLedgerFind position by sequenceId.- 指定者:
asyncFindPosition在接口中ManagedLedger
-
getManagedLedgerInterceptor
从接口复制的说明:ManagedLedgerGet the ManagedLedgerInterceptor for ManagedLedger.- 指定者:
getManagedLedgerInterceptor在接口中ManagedLedger
-
getLedgerMetadata
-
getLedgerInfo
从接口复制的说明:ManagedLedgerGet basic ledger summary. will got null if corresponding ledger not exists.- 指定者:
getLedgerInfo在接口中ManagedLedger
-
getOptionalLedgerInfo
从接口复制的说明:ManagedLedgerGet basic ledger summary. will getOptional.empty()if corresponding ledger not exists.- 指定者:
getOptionalLedgerInfo在接口中ManagedLedger
-
invalidateLedgerHandle
public void invalidateLedgerHandle(org.apache.bookkeeper.client.api.ReadHandle ledgerHandle) -
asyncReadEntry
public void asyncReadEntry(PositionImpl position, AsyncCallbacks.ReadEntryCallback callback, Object ctx) -
asyncReadEntry
protected void asyncReadEntry(org.apache.bookkeeper.client.api.ReadHandle ledger, PositionImpl position, AsyncCallbacks.ReadEntryCallback callback, Object ctx) -
asyncReadEntry
protected void asyncReadEntry(org.apache.bookkeeper.client.api.ReadHandle ledger, long firstEntry, long lastEntry, boolean isSlowestReader, org.apache.bookkeeper.mledger.impl.OpReadEntry opReadEntry, Object ctx) -
getStats
- 指定者:
getStats在接口中ManagedLedger- 返回:
- the managed ledger stats MBean
-
hasMoreEntries
-
onCursorReadPositionUpdated
-
addWaitingEntryCallBack
-
maybeUpdateCursorBeforeTrimmingConsumedLedger
public void maybeUpdateCursorBeforeTrimmingConsumedLedger() -
trimConsumedLedgersInBackground
从接口复制的说明:ManagedLedgerTrim consumed ledgers in background.- 指定者:
trimConsumedLedgersInBackground在接口中ManagedLedger
-
trimConsumedLedgersInBackground
-
delete
Delete this ManagedLedger completely from the system.- 指定者:
delete在接口中ManagedLedger- 抛出:
ExceptionInterruptedExceptionManagedLedgerException
-
asyncDelete
从接口复制的说明:ManagedLedgerAsync delete a ledger.- 指定者:
asyncDelete在接口中ManagedLedger
-
offloadPrefix
从接口复制的说明:ManagedLedgerOffload as many entries before position as possible to longterm storage.- 指定者:
offloadPrefix在接口中ManagedLedger- 参数:
pos- the position before which entries will be offloaded- 返回:
- the earliest position which was not offloaded
- 抛出:
InterruptedExceptionManagedLedgerException- 另请参阅:
-
asyncOffloadPrefix
从接口复制的说明:ManagedLedgerOffload as many entries before position as possible to longterm storage. As internally, entries is stored in ledgers, and ledgers can only be operated on as a whole, it is likely not possible to offload every entry before the passed in position. Only complete ledgers will be offloaded. On completion a position will be passed to the callback. This position is the earliest entry which was not offloaded.- 指定者:
asyncOffloadPrefix在接口中ManagedLedger- 参数:
pos- the position before which entries will be offloadedcallback- a callback which will be supplied with the earliest unoffloaded position on completionctx- a context object which will be passed to the callback on completion
-
getPositionAfterN
public PositionImpl getPositionAfterN(PositionImpl startPosition, long n, ManagedLedgerImpl.PositionBound startRange) Get the entry position at a given distance from a given position.- 参数:
startPosition- starting positionn- number of entries to skip aheadstartRange- specifies whether or not to include the start position in calculating the distance- 返回:
- the new position that is n entries ahead
-
getPreviousPosition
Get the entry position that come before the specified position in the message stream, using information from the ledger list and each ledger entries count.- 参数:
position- the current position- 返回:
- the previous position
-
isValidPosition
Validate whether a specified position is valid for the current managed ledger.- 参数:
position- the position to validate- 返回:
- true if the position is valid, false otherwise
-
ledgerExists
public boolean ledgerExists(long ledgerId) -
getNextValidLedger
-
getNextValidPosition
-
getNextValidPositionInternal
-
getFirstPosition
-
getSlowestConsumer
从接口复制的说明:ManagedLedgerGet the slowest consumer.- 指定者:
getSlowestConsumer在接口中ManagedLedger- 返回:
- the slowest consumer
-
activateCursor
-
deactivateCursor
-
removeWaitingCursor
从接口复制的说明:ManagedLedgerRemove a ManagedCursor from this ManagedLedger's waitingCursors.- 指定者:
removeWaitingCursor在接口中ManagedLedger- 参数:
cursor- the ManagedCursor
-
isCursorActive
-
getLedgersInfoAsList
-
getLedgersInfo
-
getConfig
从接口复制的说明:ManagedLedgerReturns managed-ledger config.- 指定者:
getConfig在接口中ManagedLedger
-
setConfig
从接口复制的说明:ManagedLedgerUpdates managed-ledger config.- 指定者:
setConfig在接口中ManagedLedger
-
getEntriesAddedCounter
public long getEntriesAddedCounter() -
getCurrentLedgerEntries
public long getCurrentLedgerEntries() -
getCurrentLedgerSize
public long getCurrentLedgerSize() -
getLastLedgerCreatedTimestamp
public long getLastLedgerCreatedTimestamp() -
getLastLedgerCreationFailureTimestamp
public long getLastLedgerCreationFailureTimestamp() -
getWaitingCursorsCount
public int getWaitingCursorsCount() -
getPendingAddEntriesCount
public int getPendingAddEntriesCount() -
getLastConfirmedEntry
从接口复制的说明:ManagedLedgerGets last confirmed entry of the managed ledger.- 指定者:
getLastConfirmedEntry在接口中ManagedLedger- 返回:
- the last confirmed entry id
-
getState
-
getCacheSize
public long getCacheSize() -
isReadOnly
protected boolean isReadOnly() -
createManagedLedgerException
-
createManagedLedgerException
-
asyncCreateLedger
protected void asyncCreateLedger(org.apache.bookkeeper.client.BookKeeper bookKeeper, ManagedLedgerConfig config, org.apache.bookkeeper.client.BookKeeper.DigestType digestType, org.apache.bookkeeper.client.AsyncCallback.CreateCallback cb, Map<String, byte[]> metadata) Create ledger async and schedule a timeout task to check ledger-creation is complete else it fails the callback with TimeoutException.- 参数:
bookKeeper-config-digestType-cb-metadata-
-
getClock
-
checkAndCompleteLedgerOpTask
protected boolean checkAndCompleteLedgerOpTask(int rc, org.apache.bookkeeper.client.LedgerHandle lh, Object ctx) check if ledger-op task is already completed by timeout-task. If completed then delete the created ledger- 参数:
rc-lh-ctx-- 返回:
-
getOffloadedSize
public long getOffloadedSize()从接口复制的说明:ManagedLedgerReturn the size of all ledgers offloaded to 2nd tier storage.- 指定者:
getOffloadedSize在接口中ManagedLedger
-
getLastOffloadedLedgerId
public long getLastOffloadedLedgerId()从接口复制的说明:ManagedLedgerGet last offloaded ledgerId. If no offloaded yet, it returns 0.- 指定者:
getLastOffloadedLedgerId在接口中ManagedLedger- 返回:
- last offloaded ledgerId
-
getLastOffloadedSuccessTimestamp
public long getLastOffloadedSuccessTimestamp()从接口复制的说明:ManagedLedgerGet last suceessful offloaded timestamp. If no successful offload, it returns 0.- 指定者:
getLastOffloadedSuccessTimestamp在接口中ManagedLedger- 返回:
- last successful offloaded timestamp
-
getLastOffloadedFailureTimestamp
public long getLastOffloadedFailureTimestamp()从接口复制的说明:ManagedLedgerGet last failed offloaded timestamp. If no failed offload, it returns 0.- 指定者:
getLastOffloadedFailureTimestamp在接口中ManagedLedger- 返回:
- last failed offloaded timestamp
-
getProperties
从接口复制的说明:ManagedLedgerReturns managed-ledger's properties.- 指定者:
getProperties在接口中ManagedLedger- 返回:
- key-values of properties
-
setProperty
public void setProperty(String key, String value) throws InterruptedException, ManagedLedgerException 从接口复制的说明:ManagedLedgerAdd key-value to propertiesMap.- 指定者:
setProperty在接口中ManagedLedger- 参数:
key- key of property to addvalue- value of property to add- 抛出:
InterruptedExceptionManagedLedgerException
-
asyncSetProperty
public void asyncSetProperty(String key, String value, AsyncCallbacks.UpdatePropertiesCallback callback, Object ctx) 从接口复制的说明:ManagedLedgerAsync add key-value to propertiesMap.- 指定者:
asyncSetProperty在接口中ManagedLedger- 参数:
key- key of property to addvalue- value of property to addcallback- a callback which will be supplied with the newest properties in managedLedger.ctx- a context object which will be passed to the callback on completion.
-
deleteProperty
从接口复制的说明:ManagedLedgerDelete the property by key.- 指定者:
deleteProperty在接口中ManagedLedger- 参数:
key- key of property to delete- 抛出:
InterruptedExceptionManagedLedgerException
-
asyncDeleteProperty
public void asyncDeleteProperty(String key, AsyncCallbacks.UpdatePropertiesCallback callback, Object ctx) 从接口复制的说明:ManagedLedgerAsync delete the property by key.- 指定者:
asyncDeleteProperty在接口中ManagedLedger- 参数:
key- key of property to deletecallback- a callback which will be supplied with the newest properties in managedLedger.ctx- a context object which will be passed to the callback on completion.
-
setProperties
public void setProperties(Map<String, String> properties) throws InterruptedException, ManagedLedgerException从接口复制的说明:ManagedLedgerUpdate managed-ledger's properties.- 指定者:
setProperties在接口中ManagedLedger- 参数:
properties- key-values of properties- 抛出:
InterruptedExceptionManagedLedgerException
-
asyncSetProperties
public void asyncSetProperties(Map<String, String> properties, AsyncCallbacks.UpdatePropertiesCallback callback, Object ctx) 从接口复制的说明:ManagedLedgerAsync update managed-ledger's properties.- 指定者:
asyncSetProperties在接口中ManagedLedger- 参数:
properties- key-values of properties.callback- a callback which will be supplied with the newest properties in managedLedger.ctx- a context object which will be passed to the callback on completion.
-
setEntriesAddedCounter
public void setEntriesAddedCounter(long count) -
asyncTruncate
从接口复制的说明:ManagedLedgerTruncate ledgers The truncate operation will move all cursors to the end of the topic and delete all inactive ledgers.- 指定者:
asyncTruncate在接口中ManagedLedger
-
getManagedLedgerInternalStats
public CompletableFuture<org.apache.pulsar.common.policies.data.ManagedLedgerInternalStats> getManagedLedgerInternalStats(boolean includeLedgerMetadata) 从接口复制的说明:ManagedLedgerGet managed ledger internal stats.- 指定者:
getManagedLedgerInternalStats在接口中ManagedLedger- 参数:
includeLedgerMetadata- the flag to control managed ledger internal stats include ledger metadata- 返回:
- the future of managed ledger internal stats
-
getEnsemblesAsync
-
checkInactiveLedgerAndRollOver
public void checkInactiveLedgerAndRollOver()从接口复制的说明:ManagedLedgerCheck current inactive ledger (based onManagedLedgerConfig.getInactiveLedgerRollOverTimeMs()and roll over that ledger if inactive.- 指定者:
checkInactiveLedgerAndRollOver在接口中ManagedLedger
-
getTheSlowestNonDurationReadPosition
-