<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jan 21, 2014 at 2:45 PM, Lucas Holmquist <span dir="ltr"><<a href="mailto:lholmqui@redhat.com" target="_blank">lholmqui@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">anyone have any thoughts on this?</div>
</blockquote><div><br></div><div>yes, sorry for the delay; pretty much aligned w/ the 'primitive' iOS API that we currently have (which was 'inspired' by your initial JS tests, on Dan's Server).</div>
<div><br></div><div>Currently we are pretty much all (almost all) on the CouchDB design (including Erik Jan's server (not yet tested)). I guess so far this all makes sense.</div><div>Next interesting item would be a 'pushed' sync, using something like WebSocket/SockJS (not only on the JS side of things)</div>
<div><br></div><div>@JsonDiffPatch: pretty interesting library, looks like does what we need on the (JS) client side</div><div><br></div><div>-Matthias </div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><div class="h5"><br><div><div>On Jan 15, 2014, at 3:31 PM, Lucas Holmquist <<a href="mailto:lholmqui@redhat.com" target="_blank">lholmqui@redhat.com</a>> wrote:</div><br><blockquote type="cite">
<div style="word-wrap:break-word">well, i've hacked something together for js here in this branch: <a href="https://github.com/lholmquist/aerogear-js/tree/AGJS-124" target="_blank">https://github.com/lholmquist/aerogear-js/tree/AGJS-124</a><div>
<br></div><div>it is in no way complete, just some idea's.</div><div><br></div><div>to run the tests here, you need to have dan's server running.</div><div><br></div><div>i'm currently trying out <a href="https://github.com/benjamine/JsonDiffPatch" target="_blank">https://github.com/benjamine/JsonDiffPatch</a> to do the diff/patching during an update conflict, </div>
<div><br></div><div>Here is a quick and dirty API that i was thinking could be a start, for JS at least</div><div><br></div><div><pre style="line-height:16px;width:1246px;font-size:12px;margin-bottom:0px;font-family:Consolas,'Liberation Mono',Courier,monospace;margin-top:0px;padding:0px">
<div><span style="color:rgb(153,153,136);font-style:italic">// Create a New Data Sync Object</span></div><div> </div><div><span style="font-weight:bold">var</span> <span>dataSync</span> <span style="font-weight:bold">=</span> <span>AeroGear</span><span>.</span><span>DataSync</span><span>(</span> <span>{</span> <span>syncServerUrl</span><span style="font-weight:bold">:</span> <span style="color:rgb(221,17,68)">"<a href="http://localhost:8080/" target="_blank">http://localhost:8080</a>"</span> <span>}</span> <span>);</span></div>
<div> </div><div><span style="color:rgb(153,153,136);font-style:italic">/* possibly more options here, like "auto-merge"</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> options = {</span></div>
<div><span style="color:rgb(153,153,136);font-style:italic"> syncServerUrl: "link_to_sync_server",</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> autoMerge: false, //optional, defaults to false? Not sure this is the right spot for this, maybe should be in the update call</span></div>
<div><span style="color:rgb(153,153,136);font-style:italic"> otheroptions: ....</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> }</span></div><div><span style="color:rgb(153,153,136);font-style:italic">*/</span></div>
<div> </div><div><span style="color:rgb(153,153,136);font-style:italic">// Probably have 3 Methods: read, save( Update ), remove</span></div><div><span style="color:rgb(153,153,136);font-style:italic">// each one has 2 parameters, the "document" and the settings</span></div>
<div> </div><div><span style="color:rgb(153,153,136);font-style:italic">/*</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> The document here is an object defined like in qmx's sync thought dump</span></div>
<div><span style="color:rgb(153,153,136);font-style:italic"> var document = {</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> id: "123sjf2-i",</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> content: {</span></div>
<div><span style="color:rgb(153,153,136);font-style:italic"> // Some Arbitrary JSON or an array or something serializable into JSON</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> },</span></div>
<div><span style="color:rgb(153,153,136);font-style:italic"> rev: "SOME_REVISION_ID" // or rev_id or revision or revision_id, we can argue over names later</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> }</span></div>
<div><span style="color:rgb(153,153,136);font-style:italic">*/</span></div><div> </div><div><span>dataSync</span><span>.</span><span>read</span><span>(</span> <span style="color:rgb(0,134,179)">document</span><span>,</span> <span>settings</span> <span>);</span></div>
<div> </div><div><span style="color:rgb(153,153,136);font-style:italic">/*</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> --READ--</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> </span></div>
<div><span style="color:rgb(153,153,136);font-style:italic"> var settings = {</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> success: function( document ){}, // GET the document</span></div>
<div><span style="color:rgb(153,153,136);font-style:italic"> error: function( error ){} // an error happened GETting the document, like it can't be found or something</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> }</span></div>
<div><span style="color:rgb(153,153,136);font-style:italic">*/</span></div><div> </div><div><span>dataSync</span><span>.</span><span>save</span><span>(</span> <span style="color:rgb(0,134,179)">document</span><span>,</span> <span>settings</span> <span>);</span></div>
<div> </div><div><span style="color:rgb(153,153,136);font-style:italic">/*</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> --Save--</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> document can be either an array or an object</span></div>
<div><span style="color:rgb(153,153,136);font-style:italic"> if whatever is passed is in the form of the document specifed above, then save works as an "update"</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> var settings: {</span></div>
<div><span style="color:rgb(153,153,136);font-style:italic"> autoMerge: // not sure if this should be here or in the constructor</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> success: function( document ){} // successful PUT to create the document or update the document,</span></div>
<div><span style="color:rgb(153,153,136);font-style:italic"> conflict: function( error, current_model_from_server, delta_of_current_server_model_and_local_document ) // this delta thing should be nice and user friendly or something</span></div>
<div><span style="color:rgb(153,153,136);font-style:italic"> SOME_OTHER_SPECIFIC_CALLBACK: function(){}, // Maybe other callbacks for specific events</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> error: function( error ){} // an error happened, catch-all ?</span></div>
<div><span style="color:rgb(153,153,136);font-style:italic"> }</span></div><div><span style="color:rgb(153,153,136);font-style:italic">*/</span></div><div> </div><div><span>dataSync</span><span>.</span><span>remove</span><span>(</span> <span style="color:rgb(0,134,179)">document</span><span>,</span> <span>settings</span> <span>);</span></div>
<div> </div><div><span style="color:rgb(153,153,136);font-style:italic">/*</span></div><div><span style="color:rgb(153,153,136);font-style:italic"> TBD</span></div><div><span style="color:rgb(153,153,136);font-style:italic">*/</span></div>
</pre><div><br></div></div><div><br></div><div> <br><div><div>On Jan 13, 2014, at 11:56 AM, Matthias Wessendorf <<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>> wrote:</div><br><blockquote type="cite">
<div dir="ltr"><div>Hi,<br></div><div><br></div><div>based on the <a href="http://ag.org/" target="_blank">ag.org</a> "sync-branch" (see [1]), I created a SIMPLE first iOS hack of a "document" API with a HTTP client that talks to Dan's Server. </div>
<div><br></div><div>The model ([2]) is quite easy/simple and the HTTP client supports CREATE/READ/REMOVE ([3]), based on the protocol defined on the README of the server.</div><div><br></div><div>The usage is covered in a test (like [4]).</div>
<div><br></div><div>Next: I guess next (if we continue using Dan's Server) is to see how this project can we weaved into the exisiting stores - but first I really wanted to get some client (like Luke's JS client) which executes against our current server draft/implementation.</div>
<div><br></div><div>BTW. the lib is based on AFN2.x (not sure we should use AFN 2.x at THIS point - switching to 1.x should not be that hard)</div><div><br></div><div>-Matthias</div><div><br></div><div>[1] <a href="https://github.com/aerogear/aerogear.org/pull/230" target="_blank">https://github.com/aerogear/aerogear.org/pull/230</a></div>
<div>[2] <a href="https://github.com/matzew/AGSyncKit/blob/master/SyncKit/AGDocument.h" target="_blank">https://github.com/matzew/AGSyncKit/blob/master/SyncKit/AGDocument.h</a></div><div>[3] <a href="https://github.com/matzew/AGSyncKit/blob/master/SyncKit/AGSyncClient.h" target="_blank">https://github.com/matzew/AGSyncKit/blob/master/SyncKit/AGSyncClient.h</a></div>
<div>[4] <a href="https://github.com/matzew/AGSyncKit/blob/master/SyncKitTests/SyncKitTests.m#L37-L61" target="_blank">https://github.com/matzew/AGSyncKit/blob/master/SyncKitTests/SyncKitTests.m#L37-L61</a></div><div><br>
</div>-- <br>Matthias Wessendorf <br>
<br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div>
_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></blockquote>
</div><br></div></div>_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></blockquote>
</div><br></div></div></div><br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br>
<br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div></div>