Package com.usatiuk.objects.snapshot
Interface Snapshot<K extends Comparable<K>,V>
- Type Parameters:
K
- the type of the keyV
- the type of the value
- All Superinterfaces:
AutoCloseable
Interface for a snapshot of a database.
Represents a point-in-time view of a storage, with a unique ID.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
getIterator
(IteratorStart start, K key) Get a list of iterators representing the snapshot.long
id()
Get the ID of the snapshot.readObject
(K name) Read an object from the snapshot.
-
Method Details
-
getIterator
Get a list of iterators representing the snapshot. The iterators have priority: the first one in the list is the highest. The data type of the iterator is a tombstone: a tombstone represents a deleted value that does not exist anymore. The list of iterators is intended to be consumed byTombstoneSkippingIterator
- Returns:
- a list of iterators
-
readObject
Read an object from the snapshot.- Parameters:
name
- the name of the object- Returns:
- an optional containing the object if it exists, or an empty optional if it does not
-
id
long id()Get the ID of the snapshot.- Returns:
- the ID of the snapshot
-
close
void close()- Specified by:
close
in interfaceAutoCloseable
-