Post-1.0 TouchDB commits

68 views
Skip to first unread message

Jens Alfke

unread,
Nov 5, 2012, 4:11:57 PM11/5/12
to mobile-c...@googlegroups.com
Here’s a summary of what’s gone into TouchDB’s ‘master’ [unstable] branch over the pst two weeks since b8:

• Yet another fix for pull replications — in fact, bringing back TDSocketChangeTracker. Reading the _changes feed has been a tale of woe, and mysteriously far more complex than it ought to be; this latest change should resolve problem when either (a) running five or more pull replications from the same server at once, or (b) pulling from a URL with a numeric IP address. This also allowed me to bump the number of parallel connections used by the puller, which significantly improves performance.

• An optimization for grouped/reduced view queries. TouchDB can now avoid having to parse the JSON of every key & value if the reduce function doesn’t use them, i.e. doesn’t access the items of either the ‘keys’ or the ‘values’ arrays.

• Converted the source code to ARC. This shouldn’t affect clients at all, but it’ll make development easier in the future.

These are all 1.0.1-type changes; nothing major, though they do need testing.

The big change coming up is that I’m merging CouchCocoa into TouchDB. This will make the combined code smaller, faster and simpler. Currently, CouchCocoa talks to TouchDB through a REST API, so everything has to get translated into an NSURLRequest and routed through CFNetwork and then parsed again:
app –> CouchDocument –> NSURLRequest –> CFNetwork –> TDURLProtocol –> TDRouter –> TDDatabase –> SQLite
After the merge there are a lot fewer layers:
app –> CouchDocument –> TDDatabase –> SQLite
I’m also changing the API to make it mostly synchronous. TouchDB is fast enough that it isn’t necessary to use an asynchronous programming model to work with it, just as you don’t typically use asynchronous code to read and write files. This makes the API simpler and shaves off more code size and complexity.

The gotcha is that the API isn’t exactly CouchCocoa anymore. For one thing, some method signatures have changed because they’re now synchronous. For another thing, its functionality is different because it no longer talks to remote CouchDB servers. I’ve thus renamed the classes: the prefix is now “Touch” instead of “Couch”, e.g. TouchDocument instead of CouchDocument. This will allow anyone who still needs remote-CouchDB functionality to link in the existing CouchCocoa as well without running into name conflicts.

I’ve been working on this off and on for a few months, and it’s not quite ready to see the light of day yet, but I hope to make it available really soon.

—Jens

Pit Garbe

unread,
Nov 6, 2012, 12:37:44 PM11/6/12
to mobile-c...@googlegroups.com
I agree with getting rid of those extra conversion steps and asynchronous calls (in case its still needed one could easily wrap it into GCD driven async methods).
I want to voice my concern with the naming scheme of Couch* as Touch*, though. It just sounds very ambiguous and non-descriptive to me, and should be reconsidered. Maybe TouchDB* (but that seems a bit on the long side), or TDB, or something else entirely. Couch* was pretty clear, I think, but I understand why you want to rename it.

Jens Alfke

unread,
Nov 6, 2012, 12:48:37 PM11/6/12
to mobile-c...@googlegroups.com

On Nov 6, 2012, at 9:37 AM, Pit Garbe <leberwu...@googlemail.com> wrote:

I want to voice my concern with the naming scheme of Couch* as Touch*, though. It just sounds very ambiguous and non-descriptive to me, and should be reconsidered. Maybe TouchDB* (but that seems a bit on the long side), or TDB, or something else entirely. Couch* was pretty clear, I think, but I understand why you want to rename it.

I’m not entirely happy with the naming either. I would have used the prefix “TD”, except that all of the internal/private classes in TouchDB already use this prefix, so for example there are already TDDatabase and TDRevision classes. Renaming those to make the names available for the new public classes would be a tedious job, even with Xcode’s refactor tool. But maybe I should just bite the bullet and do it anyway. (Damn, where are the unpaid summer interns when you really need them?)

—Jens

Sjoerd

unread,
Nov 7, 2012, 2:12:25 PM11/7/12
to mobile-c...@googlegroups.com
Hello Jens,

Thanks for all your great work and cheers on releasing 1.0!

I have a worry about your hint removing CouchCocoa. We really rely on the http interface currently exposed by TouchDB, reason is we use TouchDB from PhoneGap. Developing TouchDB together with JS is imho a really powerful combo. I think it matches with the current move to HTML5 everywhere.

Will you expose a second API along the current stack, or remove the layers and only have the new API?

Thanks again, kind regards,
 Sjoerd

Jens Alfke

unread,
Nov 7, 2012, 3:25:47 PM11/7/12
to mobile-c...@googlegroups.com

On Nov 7, 2012, at 11:12 AM, Sjoerd <theyoung...@gmail.com> wrote:

I have a worry about your hint removing CouchCocoa. We really rely on the http interface currently exposed by TouchDB, reason is we use TouchDB from PhoneGap.

That will still be available, it’s just moving into the TouchDBListener library. So the REST API handlers won’t take up space in apps that don’t need them, but are available to apps that do.

—Jens

Sjoerd

unread,
Nov 8, 2012, 4:56:46 AM11/8/12
to mobile-c...@googlegroups.com
That's great to hear, thanks!

Op woensdag 7 november 2012 21:25:50 UTC+1 schreef Jens Alfke het volgende:
Reply all
Reply to author
Forward
0 new messages