Interface ManagedLedgerFactory

  • All Known Implementing Classes:
    ManagedLedgerFactoryImpl

    @LimitedPrivate
    @Stable
    public interface ManagedLedgerFactory
    A factory to open/create managed ledgers and delete them.
    • Method Detail

      • open

        ManagedLedger open​(java.lang.String name)
                    throws java.lang.InterruptedException,
                           ManagedLedgerException
        Open a managed ledger. If the managed ledger does not exist, a new one will be automatically created. Uses the default configuration parameters.
        Parameters:
        name - the unique name that identifies the managed ledger
        Returns:
        the managed ledger
        Throws:
        ManagedLedgerException
        java.lang.InterruptedException
      • open

        ManagedLedger open​(java.lang.String name,
                           ManagedLedgerConfig config)
                    throws java.lang.InterruptedException,
                           ManagedLedgerException
        Open a managed ledger. If the managed ledger does not exist, a new one will be automatically created.
        Parameters:
        name - the unique name that identifies the managed ledger
        config - managed ledger configuration
        Returns:
        the managed ledger
        Throws:
        ManagedLedgerException
        java.lang.InterruptedException
      • asyncOpen

        void asyncOpen​(java.lang.String name,
                       AsyncCallbacks.OpenLedgerCallback callback,
                       java.lang.Object ctx)
        Asynchronous open method.
        Parameters:
        name - the unique name that identifies the managed ledger
        callback - callback object
        ctx - opaque context
        See Also:
        open(String)
      • asyncOpen

        void asyncOpen​(java.lang.String name,
                       ManagedLedgerConfig config,
                       AsyncCallbacks.OpenLedgerCallback callback,
                       java.util.function.Supplier<java.lang.Boolean> mlOwnershipChecker,
                       java.lang.Object ctx)
        Asynchronous open method.
        Parameters:
        name - the unique name that identifies the managed ledger
        config - managed ledger configuration
        callback - callback object
        mlOwnershipChecker - checks ml-ownership in case updating ml-metadata fails due to ownership conflict
        ctx - opaque context
        See Also:
        open(String, ManagedLedgerConfig)
      • openReadOnlyCursor

        ReadOnlyCursor openReadOnlyCursor​(java.lang.String managedLedgerName,
                                          Position startPosition,
                                          ManagedLedgerConfig config)
                                   throws java.lang.InterruptedException,
                                          ManagedLedgerException
        Open a ReadOnlyCursor positioned to the earliest entry for the specified managed ledger
        Parameters:
        managedLedgerName -
        startPosition - set the cursor on that particular position. If setting to `PositionImpl.earliest` it will be positioned on the first available entry.
        Returns:
        Throws:
        java.lang.InterruptedException
        ManagedLedgerException
      • asyncOpenReadOnlyCursor

        void asyncOpenReadOnlyCursor​(java.lang.String managedLedgerName,
                                     Position startPosition,
                                     ManagedLedgerConfig config,
                                     AsyncCallbacks.OpenReadOnlyCursorCallback callback,
                                     java.lang.Object ctx)
        Open a ReadOnlyCursor positioned to the earliest entry for the specified managed ledger
        Parameters:
        managedLedgerName -
        startPosition - set the cursor on that particular position. If setting to `PositionImpl.earliest` it will be positioned on the first available entry.
        callback -
        ctx -
      • getManagedLedgerInfo

        ManagedLedgerInfo getManagedLedgerInfo​(java.lang.String name)
                                        throws java.lang.InterruptedException,
                                               ManagedLedgerException
        Get the current metadata info for a managed ledger.
        Parameters:
        name - the unique name that identifies the managed ledger
        Throws:
        java.lang.InterruptedException
        ManagedLedgerException
      • asyncGetManagedLedgerInfo

        void asyncGetManagedLedgerInfo​(java.lang.String name,
                                       AsyncCallbacks.ManagedLedgerInfoCallback callback,
                                       java.lang.Object ctx)
        Asynchronously get the current metadata info for a managed ledger.
        Parameters:
        name - the unique name that identifies the managed ledger
        callback - callback object
        ctx - opaque context
      • delete

        void delete​(java.lang.String name)
             throws java.lang.InterruptedException,
                    ManagedLedgerException
        Delete a managed ledger. If it's not open, it's metadata will get regardless deleted.
        Parameters:
        name -
        Throws:
        java.lang.InterruptedException
        ManagedLedgerException
      • asyncDelete

        void asyncDelete​(java.lang.String name,
                         AsyncCallbacks.DeleteLedgerCallback callback,
                         java.lang.Object ctx)
        Delete a managed ledger. If it's not open, it's metadata will get regardless deleted.
        Parameters:
        name -
        Throws:
        java.lang.InterruptedException
        ManagedLedgerException