1

I can see it is possible to use a single Environment transaction to work on multiple stores. (I'm also assuming writes are possible too).

The high level api of Entity Stores is very convenient for me, but I could not find a way of sharing Entity Store transactions. Looking at the code, I can see entity stores are actually creating Environment transactions but since these are individual transactions I cannot perform operations across multiple stores and commit/abort a single transaction.

Am I missing something or should I say goodbye to Entity Store apis and fall back to Store API?

mahonya
  • 9,247
  • 7
  • 39
  • 68

2 Answers2

1

I was the one who initially asked that question to which you are referencing.

In Xodus there are three different ways to use it: - Environments; - Entity Stores; - VFS.

I'm using Environments API and all Transactions are created for whole Environment. And as I understood correctly you are using Entity Stores API, so you are able to use only StroreTransaction which is started only for a particular Store and to manipulate its Entities.

So, if you require to share one transaction against multiple stores then you require to switch to Environment API.

  • Taras
Taras
  • 56
  • 4
1

If using Environments API you can access any data in the environment regardless of how many named stores are created in it. In the Environments API, Store is just a named key-value map.

PersistentEntityStore is created atop of Environment. Single physical (disk) location corresponds to both Environment and PersistentEntityStore. Transactions are created against Environment or PersistentEntityStore. No matter which API you use, transactions cannot be shared between instances of Environment and between instances of PersistentEntityStore.

Vyacheslav Lukianov
  • 1,913
  • 8
  • 12