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 CoffeePickCatalogTypecreate(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.InputStreamfetch(java.lang.String id)java.util.List<RuntimeRepositoryType>listRepositories()static CoffeePickInventoryType.RuntimeCancellableArchiveWriterTypepublishingWriter(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)voidupdateRepository(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, waitMethods 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 returnstrueif the operation should be cancelled- Returns:
- A writer
-
events
Description copied from interface:CoffeePickCatalogTypeAccess the stream of events published by the catalog when the state of the catalog changes.- Specified by:
eventsin interfaceCoffeePickCatalogType- Returns:
- A stream of events
-
search
Description copied from interface:CoffeePickCatalogTypeSearch for all runtimes matching the given parameters.- Specified by:
searchin interfaceCoffeePickCatalogType- Parameters:
parameters- The parameters- Returns:
- The matching runtimes
-
searchExact
- Specified by:
searchExactin 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:
fetchin 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:CoffeePickCatalogTypeUpdate the repository with the given URI. The method takes a functioncancelledthat will be evaluated repeatedly and, if the function returnstrueat any point, the operation will be cancelled.- Specified by:
updateRepositoryin interfaceCoffeePickCatalogType- Parameters:
uri- The URIcancelled- A function that returnstrueif the operation should be cancelled- Throws:
java.lang.Exception- On errorsjava.util.concurrent.CancellationException- Ifcancelledreturnstruewhile the operation is running
-
listRepositories
- Specified by:
listRepositoriesin interfaceCoffeePickCatalogType- Returns:
- An immutable snapshot of the current repositories
-