قالب وردپرس درنا توس
Home / IOS Development / Reag Data Layer – Part 8: Where To Go From Here

Reag Data Layer – Part 8: Where To Go From Here



This post is the last part of an 8-part series that delves deep into how to build a robust, real-world frontend app data layer. See the previous sections here:

In this series we have managed to build a fairly robust data layer. It will give you the knowledge and patterns to build good always-online or cached apps.

But when it comes to caching, note that we have only dealt with the case where we add new records. We haven't entered updates or deletions because it's an extra level of complexity. At that time, you may not necessarily just keep a queue of records – you really hold a queue at operations . Also, when data can be edited, you can run into conflicts where two conflicting operations are performed simultaneously. Solving conflicts is not easy; You must either present users with a user interface to resolve the conflicts, or use an algorithm to resolve the conflicts, or use a special data type called a conflict-free replication data type (CRDT) designed to have no conflict. To learn more about these options, check out a conference call from Jonthan Martin.

At that time, you are starting to abandon the realm of building software for your business, and you are starting to build a significant data synchronization system. That's the point where it might be best to reach out for an off-the-shelf system. Here are some options.

Path

Orbit.js is a framework for declared synchronization of data between sources, including in-memory, local storage and REST web service. By "declarative" I mean that instead of implementing all the features we have done in this tutorial, you can easily configure each of them. It is maintained by one of the primary editors of the JSON: API specification, so it is closely matched to the specification. The path represents data internally in JSON: API format, and it has built-in support for connection with JSON: API servers. There is a third party reaction orbit library that provides React bindings, although it has even less adoption. Nevertheless, setting up data streams in a JSON: API context gives a high level of sophistication. If you want to access data from a REST server without a network and you don't want to integrate with an expensive commercial solution, Orbit is probably your best bet.

Here is an example of the declarative configuration that replicates what we have built in this tutorial:

  import    {   Schedule  }    from    & # 39; @ orbit / data & # 39; ; 
import Store from [19659013] & # 39; @ lane / storage & # 39; ;
import JSONAPISource from & # 39; @ lane / jsonapi & # 39; ;
import IndexedDBSource from [19659013] & # 39; @ orbit / IndexedDB & # 39; ;
import coordinator { RequestStrategy SyncStrategy } from [19659013] @ lane / coordinator & # 39; ;

art scheduleDefinition = {
models : {
games : {
attributes : ]
Title : type : : & # 39; string & # 39; },
},
},
}, [19659064]};
art schema = new Schema ( schedule Definition );
art store = [19659068] new Store ({ schema });

art JSONAPISource ({
schedule


Source link