> On May 25, 2015, at 12:50 AM, [email protected] wrote:
> 
> So basically we want to do sync in native and read via JS/REST APIs from with 
> in the WebView concurrently.  However while the native code is doing write ; 
> we were not able to read via the REST API/JS via Cordova plugin.

SQLite (at least in the way we’re using it) doesn’t support concurrent writes 
and reads: an active write transaction blocks reads. But writes and reads can 
interleave. You may be having problems because you’re creating one very long 
transaction and doing all the work in it. If you need to support reads at the 
same time, try using shorter transactions.

(The iOS 1.1 release, coming in a few days, supports a new storage engine 
called ForestDB that doesn’t have this limitation. It allows concurrent reads 
and writes. Details are here 
<https://github.com/couchbase/couchbase-lite-ios/wiki/ForestDB>.)

>  -  How to do concurrent read and write with in WebView via REST APIs/JS ?  
> Is it supported ? So basically if the concurrent native sync and read via web 
> view does not work than we would want to have concurrent read and write using 
> JS only ?  

Since XHRs are async, you can start as many as you want. The underlying 
database has the same concurrency limitations as I described above, but the 
REST API doesn’t allow you to create arbitrarily long transactions so that 
should be less of a problem.

—Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/BD03B57F-9857-472B-9377-FDBBE9603946%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to