You are right!

If, say, a file write, fails the data would reside only in your memory refs.

One way to make sure the two thing are always in sync is to be able to
rollback the in-memory state (and replaying all subsequent actions) by
holding on to the old version until the agent could be derefed as correctly
updated to or maybe even beyond the expected version of the datastructure.
I think.

Im not sure how you would persist the queue of incoming actions by the same
pattern, though.

I guess you should have a look on Two-phase commits.

/Linus
Den 15 okt 2014 20:15 skrev "shahrdad shadab" <clojure.langu...@gmail.com>:

> Hi folks
>
>  I know when I send/send-off an action to an agent within a STM
> transaction no action will be
> dispatched if transaction fails to commit.
> I was expecting similar behaviour when agent fails: the transaction does
> not commit when
> the action puts the agent in an invalid / failed state.
> It seems my expectation is wrong because the sent action will be
> dispatched only when transaction successfully committed which by the time
> it is too late to un-commit things.
> In such scenario the resource (database, file,...) will be out of sync
> with the modified collection in STM.  Am I missing any thing here?
>
> Any comments is highly appreciated.
>
> Thanks a lot
> Best regards
> Shahrdad
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to