--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
May I suggest we take a page from the CouchDB book here? In addition
to having a "id" each ref also has a revision id. Let's say the id for
my ref is "foo". Then the first time I modify that ref the revid
becomes "1-foo". From there the 1- is incremented by one on each
writing transaction. This allows for a single string load & compare
for each change, instead of reading the entire contents of the ref.
That combined with CouchDB's copy-on-write means that you can kill a
couchDB process mid-execution, and then restart it without any data
corruption at all.
If we find a way to do external persistence...that would be awesome, I
can think of several use cases for it right now.
Timothy
--
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)
> I'll go one step further and say that we shouldn't have to call
> "persist namespace". It should be automatic such that a change to the
> state of an identity is transactionally written.
>
> Let's start with refs. We can tackle the other identities later.
>
> The API is simple. Call (refp) instead of (ref) when creating a
> persisted ref. Passed into the call are a persistence address (file
> path, DB connection string, etc.) and a name that has to be unique to
> that persistence address. Not all refs end up being referred to by a
> top-level symbol in a package, and multi-process systems are hard...
> Ensuring uniqueness of name is up to the programmer. Upon creation,
> Clojure checks to see if the refp exists in the store; if so it
> instantiates in memory with that state, else it uses the default in
> the call.
First, I like the idea. But I think it's a bit clunky. Putting the
address information directly in the refp means you'll probably need it
in multiple places, as the most common usage is probably to store more
than one data item in each storage. This strikes me as a bad idea,
violating DRY.
How about introducing a second part to the api? (store) creates a
wrapper for the persistent address, and refp then takes one of those
wrappers and the name?
<mike
--
Mike Meyer <m...@mired.org> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org