Package com.io7m.coffeepick.api
Interface CoffeePickInventoryType
- All Known Implementing Classes:
CoffeePickInventory
public interface CoffeePickInventoryType
The interface exposed by the inventory. An inventory represents the set of runtimes
that the user currently has. Contrast this to the catalog, which represents the set of
runtimes that the user may get.
- See Also:
CoffeePickCatalogType
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
CoffeePickInventoryType.RuntimeCancellableArchiveWriterType
A function for writing archive data.static class
CoffeePickInventoryType.UnpackOption
Options for unpacking. -
Method Summary
Modifier and Type Method Description void
delete(java.lang.String id)
Delete the runtime with the given identifier.io.reactivex.rxjava3.core.Observable<CoffeePickInventoryEventType>
events()
Access the stream of events published by the inventory when the state of the inventory changes.java.util.Optional<java.nio.file.Path>
pathOf(java.lang.String id)
Return the path of the given runtime in the inventory if it exists, or nothing if it does not.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 java.nio.file.Path
unpack(java.lang.String id, java.nio.file.Path path)
Unpack the runtime with the given ID topath
.default java.nio.file.Path
unpack(java.lang.String id, java.nio.file.Path path, CoffeePickIsCancelledType cancelled)
Unpack the runtime with the given ID topath
.java.nio.file.Path
unpack(java.lang.String id, java.nio.file.Path path, CoffeePickIsCancelledType cancelled, java.util.Set<CoffeePickInventoryType.UnpackOption> options)
Unpack the runtime with the given ID topath
.default CoffeePickVerification
verify(java.lang.String id)
Verify the archive of the runtime with the given ID.CoffeePickVerification
verify(java.lang.String id, CoffeePickIsCancelledType cancelled)
Verify the archive of the runtime with the given ID.java.nio.file.Path
write(RuntimeDescription description, CoffeePickInventoryType.RuntimeCancellableArchiveWriterType writer)
Save a runtime.
-
Method Details
-
events
io.reactivex.rxjava3.core.Observable<CoffeePickInventoryEventType> events()Access the stream of events published by the inventory when the state of the inventory changes.- Returns:
- A stream of events
-
search
Search for all runtimes matching the given parameters.- Parameters:
parameters
- The parameters- Returns:
- The matching runtimes
-
searchAll
- Returns:
- All runtimes in the inventory
-
searchExact
- Parameters:
id
- The ID of the runtime- Returns:
- The runtime with the given ID
-
write
java.nio.file.Path write(RuntimeDescription description, CoffeePickInventoryType.RuntimeCancellableArchiveWriterType writer) throws java.io.IOException, java.util.concurrent.CancellationExceptionSave a runtime. The method calls the given writer method when it needs to write an archive of the runtime to disk.- Parameters:
description
- The runtime runtimeswriter
- A function that will be called to write data- Returns:
- The path of the saved archive
- Throws:
java.io.IOException
- On I/O errorsjava.util.concurrent.CancellationException
- Ifcancelled
returnstrue
while the operation is running
-
pathOf
java.util.Optional<java.nio.file.Path> pathOf(java.lang.String id) throws java.io.IOExceptionReturn the path of the given runtime in the inventory if it exists, or nothing if it does not.- Parameters:
id
- The identifier- Returns:
- The path to the runtime if it is installed
- Throws:
java.io.IOException
- On I/O errors
-
unpack
java.nio.file.Path unpack(java.lang.String id, java.nio.file.Path path, CoffeePickIsCancelledType cancelled, java.util.Set<CoffeePickInventoryType.UnpackOption> options) throws java.io.IOException, java.util.concurrent.CancellationExceptionUnpack the runtime with the given ID topath
. The method takes a functioncancelled
that will be evaluated repeatedly and, if the function returnstrue
at any point, the operation will be cancelled.- Parameters:
id
- The runtime IDpath
- The target pathoptions
- The unpacking optionscancelled
- A function that returnstrue
if the operation should be cancelled- Returns:
- The path of the unpacked archive
- Throws:
java.io.IOException
- On I/O errorsjava.util.concurrent.CancellationException
- Ifcancelled
returnstrue
while the operation is running
-
unpack
default java.nio.file.Path unpack(java.lang.String id, java.nio.file.Path path, CoffeePickIsCancelledType cancelled) throws java.io.IOException, java.util.concurrent.CancellationExceptionUnpack the runtime with the given ID topath
. The method takes a functioncancelled
that will be evaluated repeatedly and, if the function returnstrue
at any point, the operation will be cancelled.- Parameters:
id
- The runtime IDpath
- The target pathcancelled
- A function that returnstrue
if the operation should be cancelled- Returns:
- The path of the unpacked archive
- Throws:
java.io.IOException
- On I/O errorsjava.util.concurrent.CancellationException
- Ifcancelled
returnstrue
while the operation is running
-
unpack
default java.nio.file.Path unpack(java.lang.String id, java.nio.file.Path path) throws java.io.IOExceptionUnpack the runtime with the given ID topath
.- Parameters:
id
- The runtime IDpath
- The target path- Returns:
- The path of the unpacked archive
- Throws:
java.io.IOException
- On I/O errors
-
delete
void delete(java.lang.String id) throws java.io.IOExceptionDelete the runtime with the given identifier. Does nothing if no runtime has the given identifier.- Parameters:
id
- The identifier- Throws:
java.io.IOException
- On I/O errors
-
verify
Verify the archive of the runtime with the given ID.- Parameters:
id
- The identifier- Returns:
- The verification results
- Throws:
java.io.IOException
- On I/O errors
-
verify
CoffeePickVerification verify(java.lang.String id, CoffeePickIsCancelledType cancelled) throws java.io.IOException, java.util.concurrent.CancellationExceptionVerify the archive of the runtime with the given ID. The method takes a functioncancelled
that will be evaluated repeatedly and, if the function returnstrue
at any point, the operation will be cancelled.- Parameters:
id
- The identifiercancelled
- A function that returnstrue
if the operation should be cancelled- Returns:
- The verification results
- Throws:
java.io.IOException
- On I/O errorsjava.util.concurrent.CancellationException
- Ifcancelled
returnstrue
while the operation is running
-