The CSpace implementation managed to factor out an implementation that completely avoided thread local storage. Unfortunately that's not so easy with the PersistStore.
PSpace* GetThreadPtr<PSpace>()
Get the pointer to the PSpace in thread local storage, or returns nullptr if none has been set.
void SetThreadPtr(PSpace* pspace)
Set the pointer to the PSpace in thread local storage.
PersistStore* GetThreadPersistStore()
If a PSpace is set in thread local storage then returns the associated PersistStore, otherwise returns nullptr.