Interface Snapshot
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
StandardSnapshot
Represents a loaded and limited snapshot of the database. In order to provide fine-grained access, this specifies a
subset of
Path and ResourceId instances which must be locked. Changes to the Snapshot only
happen in memory and do not write data to disk.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionadd(ResourceId resourceId) Adds a newResourceEntrywith the suppliedResourceId, returning the result.voidclose()Closes this snapshot, releasing any underlying system resources associated with this snapshot.findResourceEntry(ResourceId resourceId) Finds theResourceEntryat the supplied ResourceId.findResourceEntry(Path path) Finds theResourceEntryat the supplied path.findTaskEntry(ResourceId resourceId) Finds theTaskEntryassociated with the suppliedResourceId.getOrCreateTaskEntry(ResourceId resourceId) Gets theTaskEntryor throws an instance ofSnapshotMissException.Gets allResourceEntryinstances in thisSnapshot.default ResourceEntrygetResourceEntry(ResourceId resourceId) Gets theResourceEntryor throws an instance ofSnapshotMissException.default ResourceEntrygetResourceEntry(Path path) Gets theResourceEntryor throws an instance ofSnapshotMissException.Collection<TaskEntry<?>> List allResourceEntryinstances matching thePath.
-
Method Details
-
list
List allResourceEntryinstances matching thePath. As aSnapshotmay be backed by aStreamfrom theDataStore, it is required that the Stream reach a terminal state or be explicitly closed. Closing thisSnapshotwill close the stream associatd with it.- Parameters:
path- the path- Returns:
- the
Stream<ResourceEntry>
-
findTaskEntry
Finds theTaskEntryassociated with the suppliedResourceId.- Parameters:
resourceId- theResourceId- Returns:
- the
Optionalcontaining theTaskEntry<ResourceId>
-
getOrCreateTaskEntry
Gets theTaskEntryor throws an instance ofSnapshotMissException. -
getResourceEntry
Gets theResourceEntryor throws an instance ofSnapshotMissException.- Parameters:
path- the Resource id- Returns:
- the
ResourceEntry, never null
-
findResourceEntry
Finds theResourceEntryat the supplied path.- Parameters:
path- the path- Returns:
- an
Optionalcontaining the Entry.
-
getResourceEntry
Gets theResourceEntryor throws an instance ofSnapshotMissException.- Parameters:
resourceId- the Resource id- Returns:
- the
ResourceEntry, never null - Throws:
SnapshotMissException- if the snapshot entry was never loaded
-
findResourceEntry
Finds theResourceEntryat the supplied ResourceId.- Parameters:
resourceId- the path- Returns:
- an
Optionalcontaining the Entry.
-
getTaskEntries
Collection<TaskEntry<?>> getTaskEntries() -
getResourceEntries
Collection<ResourceEntry> getResourceEntries()Gets allResourceEntryinstances in thisSnapshot.- Returns:
- gets all
ResourceEntryinstances associated with thisSnapshot
-
add
Adds a newResourceEntrywith the suppliedResourceId, returning the result. Any previously accessedResourceEntryinstances.- Parameters:
resourceId- theResourceId- Returns:
- the
ResourceEntrywhich was added. - Throws:
SnapshotMissException- if the snapshot entry was never loadedDuplicateException- if aResourceIdalready exists
-
close
void close()Closes this snapshot, releasing any underlying system resources associated with this snapshot.- Specified by:
closein interfaceAutoCloseable
-