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 byruntimes
, reading from the streaminput
, and publishes status events toevents
.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 publishedclient
- The HTTP client that will be usedcontext
- The runtime repository contextrepositories
- 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 byruntimes
, reading from the streaminput
, and publishes status events toevents
.- Parameters:
description
- The runtime runtimesevents
- The event receiverinput
- The input streamcancelled
- A function that returnstrue
if the operation should be cancelled- Returns:
- A writer
-
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 interfaceCoffeePickCatalogType
- Returns:
- A stream of events
-
search
Description copied from interface:CoffeePickCatalogType
Search for all runtimes matching the given parameters.- Specified by:
search
in interfaceCoffeePickCatalogType
- Parameters:
parameters
- The parameters- Returns:
- The matching runtimes
-
searchExact
- Specified by:
searchExact
in interfaceCoffeePickCatalogType
- 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 interfaceCoffeePickCatalogType
- 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.ExceptionDescription copied from interface:CoffeePickCatalogType
Update the repository with the given URI. The method takes a functioncancelled
that will be evaluated repeatedly and, if the function returnstrue
at any point, the operation will be cancelled.- Specified by:
updateRepository
in interfaceCoffeePickCatalogType
- Parameters:
uri
- The URIcancelled
- A function that returnstrue
if the operation should be cancelled- Throws:
java.lang.Exception
- On errorsjava.util.concurrent.CancellationException
- Ifcancelled
returnstrue
while the operation is running
-
listRepositories
- Specified by:
listRepositories
in interfaceCoffeePickCatalogType
- Returns:
- An immutable snapshot of the current repositories
-