Companion
Three ways to get a store's writer, one per intent, so that a mistyped path never quietly becomes a new, empty store: open for a store that exists, create for a new one, and openOrCreate where either will do. And openSecondary to read a store beside its writer.
Each of the first three locks the directory until the store is closed (StoreLockedException if it's already open, naming the process that has it open when it can tell) and recovers the store from its log. Each throws CorruptionException when the store's metadata or control log is damaged, IllegalArgumentException when StoreOptions.encoderBudgetBytes is below twice the store's fragment size, and java.io.IOException when the files can't be accessed.
Functions
Creates a store in dir, making the directory if it's missing. Throws StoreExistsException when dir already holds a store, which is left as it was.
Opens the store in dir, with the CreationOptions it was created with, read from the store. Throws StoreNotFoundException when dir holds no store, and then leaves it exactly as it was.
Opens the store in dir, or creates one with creation if it holds none. Throws CreationOptionsMismatchException when the store there was created with other CreationOptions, and then leaves it as it was; open takes whatever it was created with.
Opens the store in dir for reading beside its writer, in another process, or with no writer at all (SPEC.md §8.1). It takes no lock and never changes anything in dir: it reads what the writer had written when it opened, and catches up with what the writer writes later on SecondaryJsonStore.refresh.
Empties the store in dir, which must not be open, leaving it as create left it: it keeps the CreationOptions it was created with, which are returned, and loses every document, deletion, type and compression dictionary. DocIds start again at 1, so a DocId, NodeRef or Cursor from before the reset may name a new document afterwards, as with a store deleted and created again. A SecondaryJsonStore open on the store keeps the state it read until its next refresh, which shows the empty store.