Internals
In-memory indexes, real lock behavior and the absence of automatic replay.
Gnosis owns a shared Strand plus subject, predicate and object DashMap<String, Vec<u64>> indexes. add_triple holds the Strand write guard while appending and adding its sequence to all three indexes. query holds the Strand read guard during candidate lookup and block reads. DashMap uses locks internally; its reads are not lock-free.
get_neighbors holds a subject-index guard before taking a Strand read lock, while add_triple takes the Strand lock before updating that index. Concurrent operations can therefore contend in opposite lock order. Avoid claiming unrestricted concurrent-reader/writer safety without addressing that implementation path.
The constructor and SDK GnosisStore::open initialize empty indexes. There is no public method to import rebuilt indexes. A separate function returning three DashMaps does not attach them to a Gnosis instance. Re-adding historical triples through add_triple appends duplicates rather than restoring indexes in place.
An all-wildcard query scans retained Strand records and can read old triples without these indexes. Subject/predicate/object queries and get_neighbors only find entries added to the current indexes. Invalid JSON triples are skipped during reads, while underlying Strand retrieval errors are returned. No automatic repair or compaction follows from a skipped record.