From f770c0dc541b2eeeff82abb3955a72c2261060f0 Mon Sep 17 00:00:00 2001
From: Rufus Pollock Recline has a simple structure layered on top of the basic Model/View
- distinction inherent in Backbone. There are the following three domain objects (all Backbone Models):Documentation
There are then various Views (you can easily write your own). Each view holds a pointer to a Dataset:
+ +Backends (more info below) then connect Dataset and Documents to data + from a specific 'Backend' data source. They provide methods for loading and + saving Datasets and individuals Documents as well as for bulk loading via a + query API and doing bulk transforms on the backend.
+ +Complementing the model are various Views (you can easily write your own). Each view holds a pointer to a Dataset:
Backends are connectors to backend data sources from which data can be retrieved.
+ +Backends are implemented as Backbone models but this is just a convenience +(they do not save or load themselves from any remote source). You can see +detailed examples of backend implementation in the source documentation +below.
+ +A backend must implement two methods:
++sync(method, model, options) +query(dataset, queryObj) ++ +
This is an implemntation of Backbone.sync and is used to override +Backbone.sync on operations for Datasets and Documents which are using this +backend.
+ +For read-only implementations you will need only to implement read method +for Dataset models (and even this can be a null operation). The read method +should return relevant metadata for the Dataset. We do not require read support +for Documents because they are loaded in bulk by the query method.
+ +For backends supporting write operations you must implement update and +delete support for Document objects.
+ +All code paths should return an object conforming to the jquery promise +API.
+ +Query the backend for documents returning them in bulk. This method will be +used by the Dataset.query method to search the backend for documents, +retrieving the results in bulk. This method should also set the docCount +attribute on the dataset.
+ +queryObj should be either a recline.Model.Query object or a +Hash. The structure of data in the Query object or Hash should follow that +defined in issue 34. (That said, if you are writing your own backend and have +control over the query object you can obviously use whatever structure you +like).