[docs/backend][s]: tidy up and factor out backend list to include file.

This commit is contained in:
Rufus Pollock 2012-10-22 16:30:15 +01:00
parent c9208f1a08
commit 68d2f66f66
5 changed files with 33 additions and 33 deletions

View File

@ -0,0 +1,8 @@
<ul>
<li><a href="{{page.root}}/docs/src/backend.gdocs.html">gdocs: Google Docs (Spreadsheet)</a></li>
<li><a href="{{page.root}}/docs/src/backend.csv.html">csv: CSV files</a></li>
<li><a href="{{page.root}}/docs/src/backend.dataproxy.html">dataproxy: DataProxy (CSV and XLS on the Web)</a></li>
<li><a href="{{page.root}}/docs/src/backend.elasticsearch.html">elasticsearch: ElasticSearch</a></li>
<li><a href="{{page.root}}/docs/src/backend.couchdb.html">couchdb: CouchDB</a></li>
<li><a href="{{page.root}}/docs/src/backend.memory.html">memory: Memory (local data)</a></li>
</ul>

View File

@ -3,8 +3,8 @@
var dataset = new recline.Model.Dataset({
url: '{{page.root}}/demos/data/sample.csv',
backend: 'csv',
// separator: ',',
// delimiter: '"',
// delimiter: ',',
// quotechar: '"',
// encoding: 'utf8'
});
@ -13,7 +13,7 @@ var dataset = new recline.Model.Dataset({
dataset.fetch();
// show the data for illustrations sake
var grid = new recline.View.Grid({
var grid = new recline.View.SlickGrid({
model: dataset
});
$('#my-online-csv').append(grid.el);

View File

@ -16,11 +16,21 @@ 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.
<div class="alert alert-info">Looking for quickstart tutorial rather than reference documentation? See the <a href="tutorial-backends.html">Backends Tutorial</a>.</div>
Backends come in 2 flavours:
1. Loader backends - only implement fetch method. The data is then cached in a Memory.Store on the Dataset and interacted with there. This is best for sources which just allow you to load data or where you want to load the data once and work with it locally.
2. Store backends - these support fetch, query and, if write-enabled, save. These are suitable where the backend contains a lot of data (infeasible to load locally - for examples a million rows) or where the backend has capabilities you want to take advantage of.
# List of Backends Shipped with Recline
{% include backend-list.html %}
NB: examples of the 2 types of backends are provided by the Google docs backend (a "Loader" backend) and the ElasticSearch backend (a Store backend).
It's easy to write your own backend - you just need to implement the API as described below.
# Backend API

View File

@ -54,14 +54,7 @@ root: ../
</div>
<div class="span4">
<h4>Backends</h4>
<ul>
<li><a href="src/backend.elasticsearch.html">elasticsearch: ElasticSearch</a></li>
<li><a href="src/backend.gdocs.html">gdocs: Google Docs (Spreadsheet)</a></li>
<li><a href="src/backend.csv.html">csv: CSV files</a></li>
<li><a href="src/backend.couchdb.html">couchdb: CouchDB</a></li>
<li><a href="src/backend.dataproxy.html">dataproxy: DataProxy (CSV and XLS on the Web)</a></li>
<li><a href="src/backend.memory.html">memory: Memory (local data)</a></li>
</ul>
{% include backend-list.html %}
</div>
<div class="span4">
<h4>Dataset Views and Widgets</h4>

View File

@ -1,6 +1,6 @@
---
layout: container
title: Tutorial - Backends - Loading data from different sources using Backends
title: Loading data from different sources using Backends - Tutorial
recline-deps: true
root: ../
---
@ -53,23 +53,18 @@ var dataset = recline.Model.Dataset({
{% endhighlight %}
<div class="alert alert-info">
<strong>Backend identifiers</strong>
<p><strong>Backend identifiers</strong>
How do you know the backend identifier for a given Backend? It's just the name
of the 'class' in recline.Backend module (but case-insensitive). E.g.
recline.Backend.ElasticSearch can be identified as 'ElasticSearch' or
'elasticsearch'.
'elasticsearch'.</p>
<p><strong>What Backends are available from Recline?</strong>
{% include backend-list.html %}
</p>
<p><strong>Backend you'd like to see not available?</strong> It's easy to write your own &ndash; see the <a href="backends.html">Backend reference docs</a> for details of the required API.
</p>
</div>
### Included Backends
* [gdocs: Google Docs (Spreadsheet)](src/backend.gdocs.html)
* [csv: CSV files](src/backend.csv.html)
* [elasticsearch: ElasticSearch](src/backend.elasticsearch.html) - this also covers the DataHub as it has an ElasticSearch compatible API
* [dataproxy: DataProxy (CSV and XLS on the Web)](src/backend.dataproxy.html)
* [couchdb: CouchDB](src/backend.couchdb.html)
Backend not on this list that you would like to see? It's very easy to write a
new backend -- see below for more details.
## Preparing your app
@ -82,7 +77,7 @@ much more limited if you are just using a Backend. Specifically:
<script type="text/javascript" src="vendor/underscore/1.1.6/underscore.js"></script>
<script type="text/javascript" src="vendor/backbone/0.5.1/backbone.js"></script>
<!-- include the backend code you need e.g. here for gdocs -->
<script type="text/javascript" src="src/backend/gdocs.js"></script>
<script type="text/javascript" src="src/backend.gdocs.js"></script>
<!-- Or you can just include all of recline. -->
<script type="text/javascript" src="dist/recline.js"></script>
@ -98,7 +93,7 @@ For Recline to be able to access a Google Spreadsheet it **must** have been
<div class="alert alert-info">
<strong>Want a real world example?</strong> This <a
href="http://okfnlabs.org/opendatacensus">Open Data Census micro-app</a> loads
href="http://dashboard.opengovernmentdata.org/census/">Open Data Census micro-app</a> loads
data from Google Docs and then displays it on a specialist interface combining
a bespoke chooser and a Kartograph (svg-only) map.
</div>
@ -137,7 +132,7 @@ Recline supports ElasticSearch as a full read/write/query backend. It also means
For loading data from CSV files there are 3 cases:
1. CSV is online but on same domain -- we can then load using AJAX (as no problems with same origin policy)
1. CSV is online but on same domain or supporting CORS (S3 and Google Storage support CORS!) -- we can then load using AJAX (as no problems with same origin policy)
2. CSV is on local disk -- if your browser supports HTML5 File API we can load the CSV file off disk
3. CSV is online but not on same domain -- use DataProxy (see below)
@ -211,9 +206,3 @@ You can customize the length of this timeout by setting the following constant:
recline.Backend.DataProxy.timeout = 10000;
{% endhighlight %}
## Writing your own backend
Writing your own backend is easy to do. Details of the required API are in the
[Backend documentation](backends.html).