Package com.io7m.coffeepick.api

# Interface CoffeePickCatalogType

All Known Implementing Classes:
  `CoffeePickCatalog`

    public interface CoffeePickCatalogType

The interface exposed by the catalog. A catalog represents an aggregated set of repositories over which searches can be performed. Essentially, the catalog is the set of runtimes that the user can get. Contrast this to the inventory, which represents the set of runtimes that the user currently has.

See Also:
  `CoffeePickInventoryType`

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `io.reactivex.rxjava3.core.Observable<CoffeePickCatalogEventType>` | `events()` | Access the stream of events published by the catalog when the state of the catalog changes.
  `java.io.InputStream` | `fetch​(java.lang.String id)` |
  `java.util.List<RuntimeRepositoryType>` | `listRepositories()` |
  `java.util.Map<java.lang.String,​RuntimeDescription>` | `search​(CoffeePickSearch parameters)` | Search for all runtimes matching the given parameters.
  `default java.util.Map<java.lang.String,​RuntimeDescription>` | `searchAll()` |
  `default java.util.Optional<RuntimeDescription>` | `searchExact​(java.lang.String id)` |
  `default RuntimeDescription` | `searchExactOrFail​(java.lang.String id)` |
  `default void` | `updateRepository​(java.net.URI uri)` | Update the repository with the given URI.
  `void` | `updateRepository​(java.net.URI uri, CoffeePickIsCancelledType cancelled)` | Update the repository with the given URI.

- ## Method Details

  - ### events

    io.reactivex.rxjava3.core.Observable<CoffeePickCatalogEventType> events()
    Access the stream of events published by the catalog when the state of the catalog changes.
    Returns:
      A stream of events

  - ### search

    java.util.Map<java.lang.String,​RuntimeDescription> search​(CoffeePickSearch parameters)
    Search for all runtimes matching the given parameters.
    Parameters:
      `parameters` - The parameters
    Returns:
      The matching runtimes

  - ### searchAll

    default java.util.Map<java.lang.String,​RuntimeDescription> searchAll()
    Returns:
      All runtimes in the inventory

  - ### searchExact

    default java.util.Optional<RuntimeDescription> searchExact​(java.lang.String id)
    Parameters:
      `id` - The ID of the runtime
    Returns:
      The runtime with the given ID

  - ### searchExactOrFail

    default RuntimeDescription searchExactOrFail​(java.lang.String id) throws java.io.FileNotFoundException
    Parameters:
      `id` - The ID of the runtime
    Returns:
      The runtime with the given ID
    Throws:
      `java.io.FileNotFoundException` - If no runtime exists with the given ID

  - ### fetch

    java.io.InputStream fetch​(java.lang.String id) throws java.io.IOException
    Parameters:
      `id` - The ID of the runtime
    Returns:
      An input stream representing the archive of the runtime
    Throws:
      `java.io.IOException` - On I/O errors

  - ### updateRepository

    void updateRepository​(java.net.URI uri, CoffeePickIsCancelledType cancelled) throws java.lang.Exception, java.util.concurrent.CancellationException
    Update the repository with the given URI. The method takes a function `cancelled` that will be evaluated repeatedly and, if the function returns `true` at any point, the operation will be cancelled.
    Parameters:
      `uri` - The URI
      `cancelled` - A function that returns `true` if the operation should be cancelled
    Throws:
      `java.lang.Exception` - On errors
      `java.util.concurrent.CancellationException` - If `cancelled` returns `true` while the operation is running

  - ### updateRepository

    default void updateRepository​(java.net.URI uri) throws java.lang.Exception
    Update the repository with the given URI.
    Parameters:
      `uri` - The URI
    Throws:
      `java.lang.Exception` - On errors

  - ### listRepositories

    java.util.List<RuntimeRepositoryType> listRepositories()
    Returns:
      An immutable snapshot of the current repositories