@Override public CloseableIterator<ReadItem, DurableDataLogException> getReader() throws DurableDataLogException { ensurePreconditions(); return new LogReader(getLogMetadata(), this.bookKeeper, this.config); }
@Override public long getEpoch() { ensurePreconditions(); return getLogMetadata().getEpoch(); }
private void reportMetrics() { this.metrics.ledgerCount(getLogMetadata().getLedgers().size()); this.metrics.queueStats(this.writes.getStatistics()); }
val oldMetadata = getLogMetadata(); val newMetadata = oldMetadata.truncate(upToAddress);
@Override public void disable() throws DurableDataLogException { // Get the current metadata, disable it, and then persist it back. synchronized (this.lock) { ensurePreconditions(); LogMetadata metadata = getLogMetadata(); Preconditions.checkState(metadata.isEnabled(), "BookKeeperLog is already disabled."); metadata = this.logMetadata.asDisabled(); persistMetadata(metadata, false); this.logMetadata = metadata; log.info("{}: Disabled (Epoch = {}, UpdateVersion = {}).", this.traceObjectId, metadata.getEpoch(), metadata.getUpdateVersion()); } // Close this instance of the BookKeeperLog. This ensures the proper cancellation of any ongoing writes. close(); }
LogMetadata metadata = getLogMetadata(); metadata = updateMetadata(metadata, newLedger, false); LedgerMetadata ledgerMetadata = metadata.getLedger(newLedger.getId());