Package com.io7m.coffeepick.client.vanilla

# Class CoffeePickCatalog

java.lang.Object
com.io7m.coffeepick.client.vanilla.CoffeePickCatalog

All Implemented Interfaces:
  `CoffeePickCatalogType`

    public final class CoffeePickCatalog
    extends java.lang.Object
    implements CoffeePickCatalogType

The default catalog implementation.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `static CoffeePickCatalogType` | `create​(io.reactivex.rxjava3.subjects.Subject<CoffeePickCatalogEventType> events, java.net.http.HttpClient client, RuntimeRepositoryContextType context, RuntimeRepositoryProviderRegistryType repositories)` | Create a new catalog.
  `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()` |
  `static CoffeePickInventoryType.RuntimeCancellableArchiveWriterType` | `publishingWriter​(RuntimeDescription description, io.reactivex.rxjava3.subjects.Subject<CoffeePickCatalogEventType> events, CoffeePickIsCancelledType cancelled, java.io.InputStream input)` | A writer that writes an archive described by `runtimes`, reading from the stream `input`, and publishes status events to `events`.
  `java.util.Map<java.lang.String,​RuntimeDescription>` | `search​(CoffeePickSearch parameters)` | Search for all runtimes matching the given parameters.
  `java.util.Optional<RuntimeDescription>` | `searchExact​(java.lang.String id)` |
  `void` | `updateRepository​(java.net.URI uri, CoffeePickIsCancelledType cancelled)` | Update the repository with the given URI.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface com.io7m.coffeepick.api.CoffeePickCatalogType

  `searchAll, searchExactOrFail, updateRepository`

- ## Method Details

  - ### create

    public static CoffeePickCatalogType create​(io.reactivex.rxjava3.subjects.Subject<CoffeePickCatalogEventType> events, java.net.http.HttpClient client, RuntimeRepositoryContextType context, RuntimeRepositoryProviderRegistryType repositories)
    Create a new catalog.
    Parameters:
      `events` - A subject to which events will be published
      `client` - The HTTP client that will be used
      `context` - The runtime repository context
      `repositories` - A repository registry
    Returns:
      A new catalog

  - ### publishingWriter

    public static CoffeePickInventoryType.RuntimeCancellableArchiveWriterType publishingWriter​(RuntimeDescription description, io.reactivex.rxjava3.subjects.Subject<CoffeePickCatalogEventType> events, CoffeePickIsCancelledType cancelled, java.io.InputStream input)
    A writer that writes an archive described by `runtimes`, reading from the stream `input`, and publishes status events to `events`.
    Parameters:
      `description` - The runtime runtimes
      `events` - The event receiver
      `input` - The input stream
      `cancelled` - A function that returns `true` if the operation should be cancelled
    Returns:
      A writer

  - ### events

    public io.reactivex.rxjava3.core.Observable<CoffeePickCatalogEventType> events()
    Description copied from interface: `CoffeePickCatalogType`
    Access the stream of events published by the catalog when the state of the catalog changes.
    Specified by:
      `events` in interface `CoffeePickCatalogType`
    Returns:
      A stream of events

  - ### search

    public java.util.Map<java.lang.String,​RuntimeDescription> search​(CoffeePickSearch parameters)
    Description copied from interface: `CoffeePickCatalogType`
    Search for all runtimes matching the given parameters.
    Specified by:
      `search` in interface `CoffeePickCatalogType`
    Parameters:
      `parameters` - The parameters
    Returns:
      The matching runtimes

  - ### searchExact

    public java.util.Optional<RuntimeDescription> searchExact​(java.lang.String id)
    Specified by:
      `searchExact` in interface `CoffeePickCatalogType`
    Parameters:
      `id` - The ID of the runtime
    Returns:
      The runtime with the given ID

  - ### fetch

    public java.io.InputStream fetch​(java.lang.String id) throws java.io.IOException
    Specified by:
      `fetch` in interface `CoffeePickCatalogType`
    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

    public void updateRepository​(java.net.URI uri, CoffeePickIsCancelledType cancelled) throws java.lang.Exception
    Description copied from interface: `CoffeePickCatalogType`
    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.
    Specified by:
      `updateRepository` in interface `CoffeePickCatalogType`
    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

  - ### listRepositories

    public java.util.List<RuntimeRepositoryType> listRepositories()
    Specified by:
      `listRepositories` in interface `CoffeePickCatalogType`
    Returns:
      An immutable snapshot of the current repositories