-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What would it take to abstract the storage? #1
Comments
The library itself doesn't actually care how you store it. All the examples use atoms, but the library has no built-in assumptions about that. The functions like As for datomic, it should be possible. I assume you want to store the matches for a given rule in your datomic db. You can get all the matches for a given rule like this: (def rules
(o/ruleset
{::character-position
[:what
[id ::x x]
[id ::y y]
:then-finally
(println (o/query-all o/*session* ::character-position)) ; [{:id :player :x 10 :y 10} {:id :monster :x 1 :y 5} {:id :boss :x 15 :y 0}]
]})) So in theory you could replace that You will probably still need to keep the session in some kind of container though. Locally you'll need to keep the session in an atom, volatile, or something like that. But every time you update it, the |
As of version 0.5.0 you can now query all the individual facts from a session, so that might be a better way to store them in datomic. All you do is run |
@oakes Could you please either document this storage functionality a little bit, or point to examples? |
If you mean how to serialize sessions, i wrote about it here: https://github.com/oakes/odoyle-rules#serializing-a-session |
Thanks for the pointer! |
My understanding from the readme is that
what
rule/data is implemented/backed via a clojure atom. Roughly, what do you think it would take to abstarct the storage? in my specific use case, i'm considering what it would take to back odoyle with datomic cloud. Do you see any obvious blockers or refactors?Thanks for any input!
The text was updated successfully, but these errors were encountered: