I want to build a Windows Application (WPF) that will use RavenDb Embedded and that will support the use of a USB Key for the location of the central database.
When the USB key is not present, the application will use a local store.
When the USB Key is present, the application will use the store on the key as the main store.
Of course, when when the USB key is present, the data between the two stores are merged/synced.
Is there a “known” pattern for doing this? Is there out-of-the-box of “merging” data between two stores? Does RavenDb Embedded support “multiple store databases”?
Per the documentation, Embedded mode does not support multiple databases. However, you can manage multiple databases yourself by creating two separate EmbeddableDocumentStore instances with different DataDirectory paths.
You can enable Embedded+HTTP mode to replicate between the two instances, as long as you put them on different HTTP ports.
That said, I don’t think it’s a very good idea to have raven using a USB key directly. The concerns are:
What happens if the key is removed in the middle of a write operation? Raven is supposed to handle shutdowns well, but my guess is that you will get some exceptions thrown, and I don’t think it was designed with that scenario in mind.
Disk I/O may possibly be not be sufficient for performance, but perhaps that depends on the rated speed of the USB stick. Try it and let us know what your performance is like.