a couple more javadocs

This commit is contained in:
2025-05-13 20:13:28 +02:00
parent 87e127bdfb
commit 66dabdef25
2 changed files with 29 additions and 0 deletions

View File

@@ -8,12 +8,36 @@ import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
/**
* Interface for a snapshot of a database.
* Represents a point-in-time view of a storage, with a unique ID.
*
* @param <K> the type of the key
* @param <V> the type of the value
*/
public interface Snapshot<K extends Comparable<K>, V> extends AutoCloseable { public interface Snapshot<K extends Comparable<K>, V> extends AutoCloseable {
/**
* 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 by {@link com.usatiuk.objects.iterators.TombstoneSkippingIterator}
*
* @return a list of iterators
*/
List<CloseableKvIterator<K, MaybeTombstone<V>>> getIterator(IteratorStart start, K key); List<CloseableKvIterator<K, MaybeTombstone<V>>> getIterator(IteratorStart start, K key);
/**
* Read an object from the snapshot.
* @param name the name of the object
* @return an optional containing the object if it exists, or an empty optional if it does not
*/
@Nonnull @Nonnull
Optional<V> readObject(K name); Optional<V> readObject(K name);
/**
* Get the ID of the snapshot.
* @return the ID of the snapshot
*/
long id(); long id();
@Override @Override

View File

@@ -24,6 +24,11 @@ import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
/**
* CachingObjectPersistentStore is a caching layer for the SerializingObjectPersistentStore
* It stores the already deserialized objects in memory.
*
*/
@ApplicationScoped @ApplicationScoped
public class CachingObjectPersistentStore { public class CachingObjectPersistentStore {
private final AtomicReference<Cache> _cache; private final AtomicReference<Cache> _cache;