Merge lp:~muffinresearch/u1db/docs-tweaks into lp:u1db

Proposed by Stuart Colville
Status: Merged
Merged at revision: 404
Proposed branch: lp:~muffinresearch/u1db/docs-tweaks
Merge into: lp:u1db
Diff against target: 578 lines (+215/-204)
4 files modified
html-docs/conf.py (+18/-7)
html-docs/conflicts.rst (+125/-124)
html-docs/high-level-api.rst (+60/-61)
html-docs/index.rst (+12/-12)
To merge this branch: bzr merge lp:~muffinresearch/u1db/docs-tweaks
Reviewer Review Type Date Requested Status
Eric Casteleijn (community) Approve
Review via email: mp+124976@code.launchpad.net

Commit message

Make conditional theme available for u1db site and fix markup output.

Description of the change

* Make theming conditional - please check docs build ok sans those paths.
* Add current year to date string in docs
* Fix some output issues in .rst files which caused markup to have unnecessary blockquotes.

To post a comment you must log in.
Revision history for this message
Eric Casteleijn (thisfred) wrote :

changes as well as resulting html look good, +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'html-docs/conf.py'
2--- html-docs/conf.py 2011-12-20 13:31:32 +0000
3+++ html-docs/conf.py 2012-09-18 16:33:23 +0000
4@@ -11,7 +11,9 @@
5 # All configuration values have a default; values that are commented out
6 # serve to show the default.
7
8-import sys, os
9+import sys
10+import os
11+import datetime
12
13 # If extensions (or modules to document with autodoc) are in another directory,
14 # add these directories to sys.path here. If the directory is relative to the
15@@ -25,7 +27,7 @@
16
17 # Add any Sphinx extension module names here, as strings. They can be extensions
18 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
19-extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.coverage',
20+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.coverage',
21 'sphinx.ext.viewcode']
22
23 # Add any paths that contain templates here, relative to this directory.
24@@ -41,8 +43,9 @@
25 master_doc = 'index'
26
27 # General information about the project.
28+now = datetime.datetime.now()
29 project = u'u1db'
30-copyright = u'2011, Ubuntu One team'
31+copyright = u'2011-%s, Ubuntu One team' % now.year
32
33 # The version info for the project you're documenting, acts as replacement for
34 # |version| and |release|, also used in various other places throughout the
35@@ -83,7 +86,7 @@
36 #show_authors = False
37
38 # The name of the Pygments (syntax highlighting) style to use.
39-pygments_style = 'sphinx'
40+pygments_style = 'colorful'
41
42 # A list of ignored prefixes for module index sorting.
43 #modindex_common_prefix = []
44@@ -93,7 +96,11 @@
45
46 # The theme to use for HTML and HTML Help pages. See the documentation for
47 # a list of builtin themes.
48-html_theme = 'default'
49+
50+if os.path.exists("../../../themes/u1db"):
51+ html_theme = "u1db"
52+else:
53+ html_theme = 'default'
54
55 # Theme options are theme-specific and customize the look and feel of a theme
56 # further. For a list of options available for each theme, see the
57@@ -101,7 +108,7 @@
58 #html_theme_options = {}
59
60 # Add any paths that contain custom themes here, relative to this directory.
61-#html_theme_path = []
62+html_theme_path = ["../../../themes/"]
63
64 # The name for this set of Sphinx documents. If None, it defaults to
65 # "<project> v<release> documentation".
66@@ -122,7 +129,11 @@
67 # Add any paths that contain custom static files (such as style sheets) here,
68 # relative to this directory. They are copied after the builtin static files,
69 # so a file named "default.css" will overwrite the builtin "default.css".
70-html_static_path = ['_static']
71+
72+if os.path.exists("../../../static"):
73+ html_static_path = ['../../../static']
74+else:
75+ html_static_path = ['_static']
76
77 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
78 # using the given strftime format.
79
80=== modified file 'html-docs/conflicts.rst'
81--- html-docs/conflicts.rst 2012-08-22 17:03:24 +0000
82+++ html-docs/conflicts.rst 2012-09-18 16:33:23 +0000
83@@ -86,50 +86,50 @@
84
85 Synchronisation between two u1db replicas consists of the following steps:
86
87- 1. The source replica asks the target replica for the information it has
88- stored about the last time these two replicas were synchronised (if
89- ever).
90-
91- 2. The source replica validates that its information regarding the last
92- synchronisation is consistent with the target's information, and
93- raises an error if not. (This could happen for instance if one of the
94- replicas was lost and restored from backup, or if a user inadvertently
95- tries to synchronise a copied database.)
96-
97- 3. The source replica generates a list of changes since the last change the
98- target replica knows of.
99-
100- 4. The source replica checks what the last change is it knows about on the
101- target replica.
102-
103- 5. If there have been no changes on either replica that the other side has
104- not seen, the synchronisation stops here.
105-
106- 6. The source replica sends the changed documents to the target, along with
107- what the latest change is that it knows about on the target replica.
108-
109- 7. The target processes the changed documents, and records the source
110- replica's latest change.
111-
112- 8. The target responds with the documents that have changes that the source
113- does not yet know about.
114-
115- 9. The source processes the changed documents, and records the target
116- replica's latest change.
117-
118- 10. If the source has seen no changes unrelated to the synchronisation
119- during this whole process, it now sends the target what its latest
120- change is, so that the next synchronisation does not have to consider
121- changes that were the result of this one.
122+1. The source replica asks the target replica for the information it has
123+ stored about the last time these two replicas were synchronised (if
124+ ever).
125+
126+2. The source replica validates that its information regarding the last
127+ synchronisation is consistent with the target's information, and
128+ raises an error if not. (This could happen for instance if one of the
129+ replicas was lost and restored from backup, or if a user inadvertently
130+ tries to synchronise a copied database.)
131+
132+3. The source replica generates a list of changes since the last change the
133+ target replica knows of.
134+
135+4. The source replica checks what the last change is it knows about on the
136+ target replica.
137+
138+5. If there have been no changes on either replica that the other side has
139+ not seen, the synchronisation stops here.
140+
141+6. The source replica sends the changed documents to the target, along with
142+ what the latest change is that it knows about on the target replica.
143+
144+7. The target processes the changed documents, and records the source
145+ replica's latest change.
146+
147+8. The target responds with the documents that have changes that the source
148+ does not yet know about.
149+
150+9. The source processes the changed documents, and records the target
151+ replica's latest change.
152+
153+10. If the source has seen no changes unrelated to the synchronisation
154+ during this whole process, it now sends the target what its latest
155+ change is, so that the next synchronisation does not have to consider
156+ changes that were the result of this one.
157
158 The synchronisation information stored by the replica for each other replica it
159 has ever synchronised with consists of:
160
161- * The replica id of the other replica. (Which should be globally unique
162- identifier to distinguish database replicas from one another.)
163- * The last known generation and transaction id of the other replica.
164- * The generation and transaction id of *this* replica at the time of the
165- most recent succesfully completed synchronisation with the other replica.
166+* The replica id of the other replica. (Which should be globally unique
167+ identifier to distinguish database replicas from one another.)
168+* The last known generation and transaction id of the other replica.
169+* The generation and transaction id of *this* replica at the time of the
170+ most recent succesfully completed synchronisation with the other replica.
171
172 Any change to any document in a database constitutes a transaction. Each
173 transaction increases the database generation by 1, and u1db implementations
174@@ -151,93 +151,94 @@
175 Synchronisation over HTTP is tuned to minimize the number of request/response
176 round trips. The anatomy of a full synchronisation over HTTP is as follows:
177
178- 1. The application wishing to synchronise sends the following GET request
179- to the server::
180-
181- GET /thedb/sync-from/my_replica_uid
182-
183- Where ``thedb`` is the name of the database to be synchronised, and
184- ``my_replica_uid`` is the replica id of the application's (i.e. the
185- local, or synchronisation source) database.
186-
187- 2. The target responds with a JSON document that looks like this::
188-
189- {
190- "target_replica_uid": "other_replica_uid",
191- "target_replica_generation": 12,
192- "target_replica_transaction_id": "T-sdkfj92292j",
193- "source_replica_uid": "my_replica_uid",
194- "source_replica_generation": 23,
195- "source_transaction_id": "T-39299sdsfla8"
196- }
197-
198- With all the information it has stored for the most recent
199- synchronisation between itself and this particular source replica. In
200- this case it tells us that the synchronisation target believes that when
201- it and the source were last synchronised, the target was at generation
202- 12 and the source at generation 23.
203-
204- 3. If source and target agree on the above information, the source now
205- starts a streaming POST request to the same URL::
206-
207- POST /thedb/sync-from/my_replica_uid
208-
209- The request is of MIME type ``application/x-u1db-sync-stream``, which is
210- a subset of JSON. The format is a JSON array with a JSON object on each
211- line, followed by a comma and a carriage return and a newline, like
212- this::
213-
214- [\r\n
215- {json_object},\r\n
216- ...
217- ]
218-
219- The first object contains the following information::
220-
221- {"last_known_generation": 12, "last_known_trans_id": "T-39299sdsfla8"},\r\n
222-
223- and then for each document that it has changes for that are more recent
224- than generation 23, ordered by generation in ascending order, it sends,
225- on a single line, followed by a comma and a newline character, the
226- following JSON object::
227-
228- {"id": "mydocid", "rev": "my_replica_uid:4", "content": "{}", "generation": 48, "trans_id": "T-88djlahhhd"},\r\n
229-
230+1. The application wishing to synchronise sends the following GET request
231+ to the server::
232+
233+ GET /thedb/sync-from/my_replica_uid
234+
235+ Where ``thedb`` is the name of the database to be synchronised, and
236+ ``my_replica_uid`` is the replica id of the application's (i.e. the
237+ local, or synchronisation source) database.
238+
239+2. The target responds with a JSON document that looks like this::
240+
241+ {
242+ "target_replica_uid": "other_replica_uid",
243+ "target_replica_generation": 12,
244+ "target_replica_transaction_id": "T-sdkfj92292j",
245+ "source_replica_uid": "my_replica_uid",
246+ "source_replica_generation": 23,
247+ "source_transaction_id": "T-39299sdsfla8"
248+ }
249+
250+ With all the information it has stored for the most recent
251+ synchronisation between itself and this particular source replica. In
252+ this case it tells us that the synchronisation target believes that when
253+ it and the source were last synchronised, the target was at generation
254+ 12 and the source at generation 23.
255+
256+3. If source and target agree on the above information, the source now
257+ starts a streaming POST request to the same URL::
258+
259+ POST /thedb/sync-from/my_replica_uid
260+
261+ The request is of MIME type ``application/x-u1db-sync-stream``, which is
262+ a subset of JSON. The format is a JSON array with a JSON object on each
263+ line, followed by a comma and a carriage return and a newline, like
264+ this::
265+
266+ [\r\n
267+ {json_object},\r\n
268+ ...
269+ ]
270+
271+ The first object contains the following information::
272+
273+ {"last_known_generation": 12, "last_known_trans_id": "T-39299sdsfla8"},\r\n
274+
275+ and then for each document that it has changes for that are more recent
276+ than generation 23, ordered by generation in ascending order, it sends,
277+ on a single line, followed by a comma and a newline character, the
278+ following JSON object::
279+
280+ {"id": "mydocid", "rev": "my_replica_uid:4", "content": "{}", "generation": 48, "trans_id": "T-88djlahhhd"},\r\n
281+
282+ .. note::
283 Note that content contains a JSON encoded representation of the
284 document's content (which in this case is empty).
285
286- The server reads and processes these lines one by one. Note that each
287- such JSON document includes the generation and transaction id of the
288- change. This means that when the synchronisation is ever interrupted,
289- the source can resume by starting at the last generation that was
290- successfully synchronised.
291-
292- 4. After it gets to the end of the request, the server responds with a
293- status 200 and starts streaming a response, also of MIME type
294- ``application/x-u1db-sync-stream``, which starts as follows::
295-
296- [\r\n
297- {"new_generation": 15, "new_transaction_id": "T-999j3jjsfl"},\r\n
298-
299- which tells the source what the target's new generation and transaction
300- id are, now that it processed the changes it received from the source.
301- Then it starts streaming *its* changes since its last generation that
302- was synced (12 in this case), in exactly the same format (and order) as
303- the source did in step 3.
304-
305- 5. When the source has processed all the changes it received from the
306- target, *and* it detects that there have been no changes to its database
307- since the start of the synchronisation that were not a direct result
308- *of* the synchronisation, it now performs a final PUT request, to inform
309- the target of its new generation and transaction id, so that the next
310- synchronisation can start there, rather than with the generation the
311- source was at when this synchronisation started::
312-
313- PUT /thedb/sync-from/my_replica_uid
314-
315- With the content::
316-
317- {"generation": 53, "transaction_id": "T-camcmls92"}
318+ The server reads and processes these lines one by one. Note that each
319+ such JSON document includes the generation and transaction id of the
320+ change. This means that when the synchronisation is ever interrupted,
321+ the source can resume by starting at the last generation that was
322+ successfully synchronised.
323+
324+4. After it gets to the end of the request, the server responds with a
325+ status 200 and starts streaming a response, also of MIME type
326+ ``application/x-u1db-sync-stream``, which starts as follows::
327+
328+ [\r\n
329+ {"new_generation": 15, "new_transaction_id": "T-999j3jjsfl"},\r\n
330+
331+ which tells the source what the target's new generation and transaction
332+ id are, now that it processed the changes it received from the source.
333+ Then it starts streaming *its* changes since its last generation that
334+ was synced (12 in this case), in exactly the same format (and order) as
335+ the source did in step 3.
336+
337+5. When the source has processed all the changes it received from the
338+ target, *and* it detects that there have been no changes to its database
339+ since the start of the synchronisation that were not a direct result
340+ *of* the synchronisation, it now performs a final PUT request, to inform
341+ the target of its new generation and transaction id, so that the next
342+ synchronisation can start there, rather than with the generation the
343+ source was at when this synchronisation started::
344+
345+ PUT /thedb/sync-from/my_replica_uid
346+
347+ With the content::
348+
349+ {"generation": 53, "transaction_id": "T-camcmls92"}
350
351
352 Revisions
353
354=== modified file 'html-docs/high-level-api.rst'
355--- html-docs/high-level-api.rst 2012-08-22 17:03:24 +0000
356+++ html-docs/high-level-api.rst 2012-09-18 16:33:23 +0000
357@@ -122,18 +122,17 @@
358 >>> doc = db.get_doc(doc.doc_id, include_deleted=True)
359 >>> doc.content
360
361-
362 Document functions
363 ^^^^^^^^^^^^^^^^^^
364
365- * :py:meth:`~u1db.Database.create_doc`
366- * :py:meth:`~u1db.Database.create_doc_from_json`
367- * :py:meth:`~u1db.Database.put_doc`
368- * :py:meth:`~u1db.Database.get_doc`
369- * :py:meth:`~u1db.Database.get_docs`
370- * :py:meth:`~u1db.Database.get_all_docs`
371- * :py:meth:`~u1db.Database.delete_doc`
372- * :py:meth:`~u1db.Database.whats_changed`
373+* :py:meth:`~u1db.Database.create_doc`
374+* :py:meth:`~u1db.Database.create_doc_from_json`
375+* :py:meth:`~u1db.Database.put_doc`
376+* :py:meth:`~u1db.Database.get_doc`
377+* :py:meth:`~u1db.Database.get_docs`
378+* :py:meth:`~u1db.Database.get_all_docs`
379+* :py:meth:`~u1db.Database.delete_doc`
380+* :py:meth:`~u1db.Database.whats_changed`
381
382 Querying
383 --------
384@@ -161,14 +160,14 @@
385 an index expression of ``"firstname"`` will create an index that looks
386 (conceptually) like this
387
388- ====================== ========
389- index expression value document
390- ====================== ========
391- Alan ah
392- Jan jm
393- John jb
394- John jw
395- ====================== ========
396+====================== ========
397+index expression value document
398+====================== ========
399+Alan ah
400+Jan jm
401+John jb
402+John jw
403+====================== ========
404
405 and that index is created with:
406
407@@ -204,11 +203,11 @@
408
409 gives the index key "hello", and therefore an entry in the index of
410
411- ========= ====
412- Index key doc
413- ========= ====
414- hello doc1
415- ========= ====
416+========= ====
417+Index key doc
418+========= ====
419+hello doc1
420+========= ====
421
422 **Name a list.** If an index expression names a field whose contents is a list
423 of strings, the document will have multiple entries in the index, one per entry
424@@ -226,13 +225,13 @@
425
426 gives index entries
427
428- ========= ====
429- Index key doc
430- ========= ====
431- tag1 doc2
432- tag2 doc2
433- tag3 doc2
434- ========= ====
435+========= ====
436+Index key doc
437+========= ====
438+tag1 doc2
439+tag2 doc2
440+tag3 doc2
441+========= ====
442
443 **Subfields of objects in a list.** If an index expression points at subfields
444 of objects in a list, the document will have multiple entries in the index, one
445@@ -257,12 +256,12 @@
446
447 would give index entries:
448
449- ========= ====
450- Index key doc
451- ========= ====
452- 12345 doc3
453- 54321 doc3
454- ========= ====
455+========= ====
456+Index key doc
457+========= ====
458+12345 doc3
459+54321 doc3
460+========= ====
461
462 **Transformation functions.** An index expression may be wrapped in any number
463 of transformation functions. A function transforms the result of the contained
464@@ -272,16 +271,16 @@
465
466 Available transformation functions are:
467
468- * ``lower(index_expression)`` - lowercase the value
469- * ``split_words(index_expression)`` - split the value on whitespace; will act
470- like a list and add multiple entries to the index
471- * ``number(index_expression, width)`` - takes an integer value, and turns it
472- into a string, left padded with zeroes, to make it at least as wide as
473- width; or nothing if the field type is not an integer.
474- * ``bool(index_expression)`` - takes a boolean value and turns it into '0' if
475- false and '1' if true, or nothing if the field type is not boolean.
476- * ``combine(index_expression1, index_expression2, ...)`` - Combine the values
477- of an arbitrary number of sub expressions into a single index.
478+* ``lower(index_expression)`` - lowercase the value
479+* ``split_words(index_expression)`` - split the value on whitespace; will act
480+ like a list and add multiple entries to the index
481+* ``number(index_expression, width)`` - takes an integer value, and turns it
482+ into a string, left padded with zeroes, to make it at least as wide as
483+ width; or nothing if the field type is not an integer.
484+* ``bool(index_expression)`` - takes a boolean value and turns it into '0' if
485+ false and '1' if true, or nothing if the field type is not boolean.
486+* ``combine(index_expression1, index_expression2, ...)`` - Combine the values
487+ of an arbitrary number of sub expressions into a single index.
488
489 So, the index expression ``splitwords(lower(field.name))`` applied to
490 a document with content:
491@@ -297,13 +296,13 @@
492
493 gives index entries
494
495- ========== ====
496- Index key doc
497- ========== ====
498- bruce doc3
499- david doc3
500- grobbelaar doc3
501- ========== ====
502+========== ====
503+Index key doc
504+========== ====
505+bruce doc3
506+david doc3
507+grobbelaar doc3
508+========== ====
509
510
511 Querying an index
512@@ -336,12 +335,12 @@
513 Index functions
514 ^^^^^^^^^^^^^^^
515
516- * :py:meth:`~u1db.Database.create_index`
517- * :py:meth:`~u1db.Database.delete_index`
518- * :py:meth:`~u1db.Database.get_from_index`
519- * :py:meth:`~u1db.Database.get_range_from_index`
520- * :py:meth:`~u1db.Database.get_index_keys`
521- * :py:meth:`~u1db.Database.list_indexes`
522+* :py:meth:`~u1db.Database.create_index`
523+* :py:meth:`~u1db.Database.delete_index`
524+* :py:meth:`~u1db.Database.get_from_index`
525+* :py:meth:`~u1db.Database.get_range_from_index`
526+* :py:meth:`~u1db.Database.get_index_keys`
527+* :py:meth:`~u1db.Database.list_indexes`
528
529 Synchronising
530 -------------
531@@ -377,9 +376,9 @@
532 Synchronising Functions
533 ^^^^^^^^^^^^^^^^^^^^^^^
534
535- * :py:meth:`~u1db.Database.sync`
536- * :py:meth:`~u1db.Database.get_doc_conflicts`
537- * :py:meth:`~u1db.Database.resolve_doc`
538+* :py:meth:`~u1db.Database.sync`
539+* :py:meth:`~u1db.Database.get_doc_conflicts`
540+* :py:meth:`~u1db.Database.resolve_doc`
541
542 .. rubric:: footnotes
543
544
545=== modified file 'html-docs/index.rst'
546--- html-docs/index.rst 2012-08-21 16:00:44 +0000
547+++ html-docs/index.rst 2012-09-18 16:33:23 +0000
548@@ -39,18 +39,18 @@
549
550 Choose the implementation you need and get hacking!
551
552- ===================== =========== ================= ==============
553- Platform(s) Language Back end database link
554- ===================== =========== ================= ==============
555- Ubuntu, Windows, OS X Python SQLite :ref:`reference-implementation`
556- Ubuntu Vala SQLite `lp:shardbridge <http://launchpad.net/shardbridge/>`_
557- Ubuntu, Windows, OS X C SQLite part of `lp:u1db <http://launchpad.net/u1db/>`_
558- Ubuntu, Windows, OS X Go LevelDB and/or `lp:gouda <http://launchpad.net/gouda/>`_ (in progress)
559- MongoDB
560- Web JavaScript localStorage planned
561- Android Java SQLite planned
562- iOS Objective C SQLite planned
563- ===================== =========== ================= ==============
564+===================== =========== ================= ==============
565+Platform(s) Language Back end database link
566+===================== =========== ================= ==============
567+Ubuntu, Windows, OS X Python SQLite :ref:`reference-implementation`
568+Ubuntu Vala SQLite `lp:shardbridge <http://launchpad.net/shardbridge/>`_
569+Ubuntu, Windows, OS X C SQLite part of `lp:u1db <http://launchpad.net/u1db/>`_
570+Ubuntu, Windows, OS X Go LevelDB and/or `lp:gouda <http://launchpad.net/gouda/>`_ (in progress)
571+ MongoDB
572+Web JavaScript localStorage planned
573+Android Java SQLite planned
574+iOS Objective C SQLite planned
575+===================== =========== ================= ==============
576
577
578 Indices and tables

Subscribers

People subscribed via source and target branches