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
  • 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

      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
    • write

      java.nio.file.Path write​(RuntimeDescription description, CoffeePickInventoryType.RuntimeCancellableArchiveWriterType writer) throws java.io.IOException, java.util.concurrent.CancellationException
      Save 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 runtimes
      writer - A function that will be called to write data
      Returns:
      The path of the saved archive
      Throws:
      java.io.IOException - On I/O errors
      java.util.concurrent.CancellationException - If cancelled returns true while the operation is running
    • pathOf

      java.util.Optional<java.nio.file.Path> pathOf​(java.lang.String id) throws java.io.IOException
      Return 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.CancellationException
      Unpack the runtime with the given ID to path. 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:
      id - The runtime ID
      path - The target path
      options - The unpacking options
      cancelled - A function that returns true if the operation should be cancelled
      Returns:
      The path of the unpacked archive
      Throws:
      java.io.IOException - On I/O errors
      java.util.concurrent.CancellationException - If cancelled returns true 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.CancellationException
      Unpack the runtime with the given ID to path. 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:
      id - The runtime ID
      path - The target path
      cancelled - A function that returns true if the operation should be cancelled
      Returns:
      The path of the unpacked archive
      Throws:
      java.io.IOException - On I/O errors
      java.util.concurrent.CancellationException - If cancelled returns true while the operation is running
    • unpack

      default java.nio.file.Path unpack​(java.lang.String id, java.nio.file.Path path) throws java.io.IOException
      Unpack the runtime with the given ID to path.
      Parameters:
      id - The runtime ID
      path - 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.IOException
      Delete 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

      default CoffeePickVerification verify​(java.lang.String id) throws java.io.IOException
      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.CancellationException
      Verify the archive of the runtime with the given ID. 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:
      id - The identifier
      cancelled - A function that returns true if the operation should be cancelled
      Returns:
      The verification results
      Throws:
      java.io.IOException - On I/O errors
      java.util.concurrent.CancellationException - If cancelled returns true while the operation is running