-
Notifications
You must be signed in to change notification settings - Fork 6
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
Use agent instead of atom to implement mock connection #4
Conversation
Can't merge this right now because it may leave some concurrency issues unaddressed. In particular, the proposed change does not let you read your own writes with Even if it is okay, the need for a proper implementation of I'll keep you posted as I make progress. |
According to the docs I see now that my implementation is not correct, i've implemened |
I noticed another problem: the future is delivered before the fn that updates the agent returns, so |
@ChrisBlom it is not another problem, it is the same problem :) I had not noticed the issue with |
0a8f206
to
2dcc2a0
Compare
@ChrisBlom thanks, I'd appreciate if you could add a little test for the RYW semantics |
And we still need a proper implementation of |
src/datomock/impl.clj
Outdated
(->MockConnection (atom (->MockConnState db [])) (d/next-t db) parent-log (atom nil))) | ||
(let [state-agent (-> (agent (->MockConnState db [] nil)) | ||
(add-watch ::force-deliver-promise (fn [_ _ old new] | ||
(when-not (= old new) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should use identical?
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChrisBlom yes, it will be equivalent and faster since the deliver-tx-res
field will not be collection-typed.
2e7363f
to
0585d69
Compare
71a82a6
to
0a2a452
Compare
I've implemented |
the implementation is not correct, |
Uses an agent to manage the state of the mock connection,
see #2