vvvvalvalval / datomock

Mocking and forking Datomic Peer connections in-memory.
MIT License
130 stars 6 forks source link

Client API support? #6

Open den1k opened 6 years ago

den1k commented 6 years ago

Quickly skimmed through the client API and it has with-db. Now that cloud is a thing it would be amazing to quickly fork prod DB's. Anything holding this back?

https://docs.datomic.com/client-api/datomic.client.api.html#var-with-db

vvvvalvalval commented 6 years ago

@den1k db.with() support on clients is potentially somewhat unreliable for this use - I'm waiting for Stuart Halloway to come back to me with more info.

In any case, if we're to create with-backed mock connections on Clients, it's probably more sensible to do it in another library.

iku000888 commented 4 years ago

Just another :+1: form me

stevebuik commented 3 years ago

and one from me too, especially now that dev-local exists.

Joshua Heimbach was also asking about this capability on slack so interest is building

vvvvalvalval commented 3 years ago

Alright folks, I probably won't have time to make that dev anytime soon, especially given that I don't use the client lib currently.

Having said that: as I mentioned above, I think it's sensible to do that in a separate lib, to keep dependencies separate. So feel free to make that lib - I suggest datomock-client for the name. I really don't expect it to be hard, an undocumented implementation should be below 200 LoC. I could imagine this as a Kata in a Clojure meetup.

Compared to this lib, the main additional difficulties I see are:

  1. Making the API async will make things slightly harder than in this lib, you'll probably want to keep the state in a core.async loop rather than an Atom or Agent (a nice core.async exercise!).

  2. The Client API offers no protocol or interface for Connections. There probably is one, but as an implementation detail that will have to be discovered and relied on.