Interface Handle

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
ReadHandle, WriteAdvHandle, WriteHandle
All Known Implementing Classes:
LedgerHandle, LedgerHandleAdv, ReadOnlyLedgerHandle

@Public @Unstable public interface Handle extends AutoCloseable
Handle to manage an open ledger.
Since:
4.6
  • Method Details

    • getId

      long getId()
      Get the id of the current ledger.
      Returns:
      the id of the ledger
    • close

      default void close() throws BKException, InterruptedException
      Close this handle synchronously.
      Specified by:
      close in interface AutoCloseable
      Throws:
      BKException
      InterruptedException
      See Also:
    • closeAsync

      CompletableFuture<Void> closeAsync()
      Asynchronous close the handle.
      Returns:
      an handle to access the result of the operation
    • getLedgerMetadata

      LedgerMetadata getLedgerMetadata()
      Returns the metadata of this ledger.

      This call only retrieves the metadata cached locally. If there is any metadata updated, the read handle will receive the metadata updates and update the metadata locally. The metadata notification can be deplayed, so it is possible you can receive a stale copy of ledger metadata from this call.

      Returns:
      the metadata of this ledger.