Merge lp:~thisfred/u1db/home-on-the-range into lp:u1db
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Eric Casteleijn on 2012-06-12 | ||||
| Approved revision: | 332 | ||||
| Merged at revision: | 325 | ||||
| Proposed branch: | lp:~thisfred/u1db/home-on-the-range | ||||
| Merge into: | lp:u1db | ||||
| Prerequisite: | lp:~thisfred/u1db/c-api-improvements | ||||
| Diff against target: |
532 lines (+371/-13) 8 files modified
include/u1db/u1db.h (+13/-3) include/u1db/u1db_internal.h (+16/-3) src/u1db_query.c (+130/-1) u1db/__init__.py (+25/-6) u1db/backends/inmemory.py (+35/-0) u1db/backends/sqlite_backend.py (+50/-0) u1db/tests/c_backend_wrapper.pyx (+40/-0) u1db/tests/test_backends.py (+62/-0) |
||||
| To merge this branch: | bzr merge lp:~thisfred/u1db/home-on-the-range | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| John A Meinel (community) | 2012-06-04 | Approve on 2012-06-12 | |
|
Review via email:
|
|||
Commit Message
Implemented range queries on all backends
Description of the Change
Implemented range queries on all backends
- 328. By Eric Casteleijn on 2012-06-04
-
removed copy pasta
| John A Meinel (jameinel) wrote : | # |
| John A Meinel (jameinel) wrote : | # |
You also didn't document the public API in u1db/__init__.py. and the
inmemory one could probably use a couple comments about efficiency. (You
sort the items, but don't bisect to find the start, nor stop early. It
would be significantly more efficient to filter then sort, etc.)
Otherwise seems good to me.
John
=:->
On Jun 4, 2012 8:29 PM, "Eric Casteleijn" <email address hidden>
wrote:
> Eric Casteleijn has proposed merging lp:~thisfred/u1db/home-on-the-range
> into lp:u1db with lp:~thisfred/u1db/c-api-improvements as a prerequisite.
>
> Requested reviews:
> Ubuntu One hackers (ubuntuone-hackers)
> Related bugs:
> Bug #999585 in U1DB: "support range queries"
> https:/
>
> For more details, see:
> https:/
>
> Implemented range queries on all backends
> --
> https:/
> Your team Ubuntu One hackers is requested to review the proposed merge of
> lp:~thisfred/u1db/home-on-the-range into lp:u1db.
>
> === modified file 'include/
> --- include/u1db/u1db.h 2012-06-04 18:28:18 +0000
> +++ include/u1db/u1db.h 2012-06-04 18:28:18 +0000
> @@ -337,6 +337,20 @@
> u1db_doc_callback cb, int n_values, ...);
>
>
> +
> +/**
> + * Get documents with key values in the specified range
> + *
> + * @param query A u1query object, as created by u1db_query_init.
> + * @param context Will be returned via the document callback
> + * @param n_start_values The number of values.
> + * @param start_values An array of values. If NULL, assume an open ended
> query.
> + * @param end_values An array of values. If NULL, assume an open ended
> query.
> + */
> +int u1db_get_
> + void *context, u1db_doc_callback cb,
> + int n_values, const char **start_values,
> + const char **end_values);
> /**
> * Get keys under which documents are indexed.
> *
>
> === modified file 'include/
> --- include/
> +++ include/
> @@ -331,11 +331,10 @@
> /**
> * Format a given query.
> *
> - * @param n_fields The number of fields being passed in, (the number of
> args
> - * in argp)
> + * @param n_fields The number of fields being passed in. (The number of
> values
> + * in values)
> * @param values Array of values being passed.
> * @param buf (OUT) The character array. This will be dynamically
> allocated,
> - * print key_values
> * and callers must free() it.
> * @param wildcard (IN/OUT) Any array indicating a wildcard type for this
> * argument. A 0 indicates this is an exact match, a 1
> @@ -348,6 +347,22 @@
>
>
> /**
> + * Format a given range query.
> + *
> + * @param n_fields The number of fields being passed in. (The number of
> values
> + * in start_values and end_values)
> + * @param start_values Array of values used to define the lower bound of
> the
> + * query.
> + * @param end_value...
- 329. By Eric Casteleijn on 2012-06-04
-
fixed documentation
| Eric Casteleijn (thisfred) wrote : | # |
On 06/04/2012 04:28 PM, John A Meinel wrote:
> Quick thing. Your doc is "n_start_values" but the variable is "n_values"
Thanks, fix pushed (I started off with both n_start_values and
n_end_values, before realizing that was unnecessary.)
- 330. By Eric Casteleijn on 2012-06-04
-
added get_range_
from_index to API definition, fixed some documentation lag - 331. By Eric Casteleijn on 2012-06-04
-
added docstring to inmemory implementation stating inefficiency.
| Eric Casteleijn (thisfred) wrote : | # |
On 06/04/2012 04:38 PM, John A Meinel wrote:
> You also didn't document the public API in u1db/__init__.py. and the
> inmemory one could probably use a couple comments about efficiency. (You
> sort the items, but don't bisect to find the start, nor stop early. It
> would be significantly more efficient to filter then sort, etc.)
Both fixed (that is, I commented, rather than made the inmem
implementation faster, aside from breaking from the loop early, since to
make it fast, we'd need something other than a dictionary anyway, now
that we have ordering.)
--
eric casteleijn
https:/
| John A Meinel (jameinel) wrote : | # |
Well, you could easily get O(N + M log M) ~ O(N) rather than O(N log N + N) ~ O(N log N) (where N is all keys and M is just the subset). But meh, we can do it if it matters later.
- 332. By Eric Casteleijn on 2012-06-12
-
merged trunk and fixed conflicts

Quick thing. Your doc is "n_start_values" but the variable is "n_values"
John
=:->