Class RuntimeDescriptionDatabase
- java.lang.Object
-
- com.io7m.coffeepick.runtime.database.RuntimeDescriptionDatabase
-
@ThreadSafe public final class RuntimeDescriptionDatabase extends java.lang.ObjectA persistent database of runtime descriptions.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(RuntimeDescription description)Add a runtime to the cache.voiddelete(java.lang.String id)Delete a runtime from the cache.java.util.Map<java.lang.String,RuntimeDescription>descriptions()static RuntimeDescriptionDatabaseopen(java.nio.file.Path path)Open an existing, or create a new, on-disk cache.java.util.Optional<java.time.OffsetDateTime>updated()
-
-
-
Method Detail
-
open
public static RuntimeDescriptionDatabase open(java.nio.file.Path path) throws java.io.IOException
Open an existing, or create a new, on-disk cache. The cache will be populated from the contents of the given directory if it exists and contains runtime descriptions.- Parameters:
path- The directory- Returns:
- A new cache
- Throws:
java.io.IOException- On I/O errors
-
updated
public java.util.Optional<java.time.OffsetDateTime> updated()
- Returns:
- The time of the most recent database update
-
add
public void add(RuntimeDescription description)
Add a runtime to the cache. The runtime will be persisted to disk, but no exception will be raised if persisting the file fails.- Parameters:
description- The runtimes to be added
-
delete
public void delete(java.lang.String id)
Delete a runtime from the cache. The runtime will be deleted from disk, but no exception will be raised if deleting the file fails.- Parameters:
id- The runtimes to be added
-
descriptions
public java.util.Map<java.lang.String,RuntimeDescription> descriptions()
- Returns:
- A read-only map of the current runtimes
-
-