Merge lp:~jameinel/u1db/get-all-docs into lp:u1db
Status: | Work in progress |
---|---|
Proposed branch: | lp:~jameinel/u1db/get-all-docs |
Merge into: | lp:u1db |
Diff against target: |
98 lines (+48/-0) 4 files modified
u1db/__init__.py (+11/-0) u1db/backends/inmemory.py (+6/-0) u1db/backends/sqlite_backend.py (+16/-0) u1db/tests/test_backends.py (+15/-0) |
To merge this branch: | bzr merge lp:~jameinel/u1db/get-all-docs |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Samuele Pedroni | Approve | ||
Review via email: mp+80939@code.launchpad.net |
Description of the change
I'm not 100% sure if we want to add this api or not, but it was easy to implement.
John Lenton was working on a generic u1db introspection tool, and noted that he wanted a way to describe all the documents.
This adds a direct DB.get_
However, I realized that you can do "DB.whats_
We can leave this on the side until we decide if we want to expose it or not.
Unmerged revisions
- 98. By John A Meinel
-
Have get_all_doc_ids return the current db_generation just like whats_changed.
So now the only real difference between the two is that get_all_doc_ids doesn't return
the ids for deleted documents. - 97. By John A Meinel
-
get_all_doc_ids now only returns documents that aren't marked deleted.
- 96. By John A Meinel
-
Merge trunk to get all the new goodness.
- 95. By John A Meinel
-
Document and implement a get_all_doc_ids function.
the implementations don't filter out deleted documents, I would expect it to do that, or to have the option to at least. corresponding test:
=== modified file 'u1db/tests/ test_backends. py' test_backends. py 2011-11-01 19:03:05 +0000 test_backends. py 2011-11-02 13:49:10 +0000
--- u1db/tests/
+++ u1db/tests/
@@ -51,11 +51,14 @@
def test_get_ all_doc_ ids(self) :
self. assertEqual( [], self.db. get_all_ doc_ids( )) create_ doc(simple_ doc) create_ doc(simple_ doc)
self. assertEqual( [doc1_id] , self.db. get_all_ doc_ids( )) create_ doc(nested_ doc)
self. assertEqual( sorted( [doc1_id, doc2_id]),
sorted( self.db. get_all_ doc_ids( ))) delete_ doc(doc1_ id, doc1_rev) l(sorted( [doc2_id] ), self.db. get_all_ doc_ids( )))
- doc1_id, _ = self.db.
+ doc1_id, doc1_rev = self.db.
doc2_id, _ = self.db.
+ self.db.
+ self.assertEqua
+ sorted(
def test_get_ docs(self) : create_ doc(simple_ doc)
doc1_id, doc1_rev = self.db.