Interface MassIdentifierLoader

All Superinterfaces:
AutoCloseable

@Incubating public interface MassIdentifierLoader extends AutoCloseable
A loader for mass loading of entity identifiers, used in particular during mass indexing.

If the total count of identifiers to load is unknown, totalCount() should remain unimplemented, i.e. return an empty optional. This will let the mass indexer know to increment the total on each new batch loaded instead of relying on the total being provided before the indexing starts.

The loading of the identifiers is considered as finished when MassIdentifierSink.complete() is called from the loadNext().

  • Method Details

    • close

      void close()
      Specified by:
      close in interface AutoCloseable
    • loadNext

      void loadNext() throws InterruptedException
      Loads one batch of identifiers and adds them to the sink, or calls MassIdentifierSink.complete() to notify the caller that there are no more identifiers to load.

      Calls to the sink must be performed synchronously (before this method returns).

      Throws:
      InterruptedException - If the thread was interrupted while performing I/O operations. This will lead to aborting mass indexing completely.
    • totalCount

      default OptionalLong totalCount()
      Returns:
      The total count of identifiers expected to be loaded.