Class NostrVStoreEventStore
java.lang.Object
org.ngengine.nostr4j.store.NostrVStoreEventStore
- All Implemented Interfaces:
NostrEventStore
Saves events in a VStore and keeps recent reads in memory.
-
Nested Class Summary
Nested classes/interfaces inherited from interface NostrEventStore
NostrEventStore.Entry -
Field Summary
Fields inherited from interface NostrEventStore
ORDER -
Constructor Summary
ConstructorsConstructorDescriptionNostrVStoreEventStore(org.ngengine.platform.VStore store, int memoryCapacity) -
Method Summary
Modifier and TypeMethodDescriptionorg.ngengine.platform.AsyncTask<Iterator<org.ngengine.nostr4j.store.NostrEventIndex.Metadata>> candidates(NostrFilter filter, Predicate<org.ngengine.nostr4j.store.NostrEventIndex.Metadata> eligible) Returns filter candidates from newest to oldest.org.ngengine.platform.AsyncTask<Void> clear()Removes events without deleting metadata or unrelated files.org.ngengine.platform.AsyncTask<Void> discardEntry(String id) Removes an event when its contents are not needed.entryIds()org.ngengine.platform.AsyncTask<List<org.ngengine.nostr4j.store.NostrEventIndex.Metadata>> maintenanceBatch(String after, int count) Returns at most count metadata entries after the previous ID, wrapping at the end.org.ngengine.platform.AsyncTask<NostrEventStore.Entry> org.ngengine.platform.AsyncTask<byte[]> readMetadata(String name) org.ngengine.platform.AsyncTask<NostrEventStore.Entry> removeEntry(String id) org.ngengine.platform.AsyncTask<Void> writeEntry(String id, NostrEventStore.Entry entry) Saves a new event.org.ngengine.platform.AsyncTask<Void> writeMetadata(String name, byte[] value)
-
Constructor Details
-
NostrVStoreEventStore
public NostrVStoreEventStore(org.ngengine.platform.VStore store, int memoryCapacity)
-
-
Method Details
-
readEntry
- Specified by:
readEntryin interfaceNostrEventStore
-
writeEntry
Description copied from interface:NostrEventStoreSaves a new event. Duplicate IDs keep their original receipt time.- Specified by:
writeEntryin interfaceNostrEventStore
-
removeEntry
- Specified by:
removeEntryin interfaceNostrEventStore
-
discardEntry
Description copied from interface:NostrEventStoreRemoves an event when its contents are not needed.- Specified by:
discardEntryin interfaceNostrEventStore
-
entryIds
- Specified by:
entryIdsin interfaceNostrEventStore
-
clear
Description copied from interface:NostrEventStoreRemoves events without deleting metadata or unrelated files.- Specified by:
clearin interfaceNostrEventStore
-
candidates
public org.ngengine.platform.AsyncTask<Iterator<org.ngengine.nostr4j.store.NostrEventIndex.Metadata>> candidates(NostrFilter filter, Predicate<org.ngengine.nostr4j.store.NostrEventIndex.Metadata> eligible) Description copied from interface:NostrEventStoreReturns filter candidates from newest to oldest.- Specified by:
candidatesin interfaceNostrEventStore
-
maintenanceBatch
public org.ngengine.platform.AsyncTask<List<org.ngengine.nostr4j.store.NostrEventIndex.Metadata>> maintenanceBatch(String after, int count) Description copied from interface:NostrEventStoreReturns at most count metadata entries after the previous ID, wrapping at the end.- Specified by:
maintenanceBatchin interfaceNostrEventStore
-
readMetadata
- Specified by:
readMetadatain interfaceNostrEventStore
-
writeMetadata
- Specified by:
writeMetadatain interfaceNostrEventStore
-