Damien George
204ded848e
extmod: Update for changes to mp_obj_str_get_data.
2017-03-29 12:56:45 +11:00
Damien George
ae8d867586
py: Add iter_buf to getiter type method.
...
Allows to iterate over the following without allocating on the heap:
- tuple
- list
- string, bytes
- bytearray, array
- dict (not dict.keys, dict.values, dict.items)
- set, frozenset
Allows to call the following without heap memory:
- all, any, min, max, sum
TODO: still need to allocate stack memory in bytecode for iter_buf.
2017-02-16 18:38:06 +11:00
Paul Sokolovsky
4463d8a910
extmod/modbtree: Rename "sync" method to "flush" for consistency.
...
Rename recently introduced "sync" method to "flush" for consistency with
usual files.
2016-12-05 01:50:55 +03:00
w4kpm
ec22d1739d
extmod/modbtree: Add method to sync the database.
...
If you have longish operations on the db (such as logging data) it may
be desirable to periodically sync the database to the disk. The added
btree.sync() method merely exposes the berkley __bt_sync function to the
user.
2016-12-02 17:30:53 +11:00
Damien George
75af908c0e
extmod: Use mp_raise_OSError helper function.
2016-10-07 13:52:14 +11:00
Damien George
93c4a6a3f7
all: Remove 'name' member from mp_obj_module_t struct.
...
One can instead lookup __name__ in the modules dict to get the value.
2016-09-22 00:23:16 +10:00
Krzysztof Blazewicz
5a5449d4eb
extmod/modbtree: do CHECK_ERROR after __bt_seq()
...
In `btree_seq()`, when `__bt_seq()` gets called with invalid
`flags` argument it will return `RET_ERROR` and it won't
initialize `val`. If field `data` of uninitialized `val`
is passed to `mp_obj_new_bytes()` it causes a segfault.
2016-08-24 01:31:16 +03:00
Paul Sokolovsky
d79342d33e
extmod/modbtree: open(): Add option kwargs.
...
Namely: flags, cachesize, pagesize, minkeypage.
2016-08-06 00:10:22 +03:00
Paul Sokolovsky
3eb532e974
extmod/modbtree: Implement __contains__ operation.
2016-08-02 00:24:59 +03:00
Paul Sokolovsky
99061d1dcb
extmod/modbtree: Switch to accepting stream object instead of filename.
...
Requires "embedded" BerkeleyDB BTree implementation.
2016-07-31 00:40:35 +03:00
Paul Sokolovsky
25df419c67
extmod/modbtree: Check __bt_open() return value for error.
2016-07-24 00:29:32 +03:00
Paul Sokolovsky
417dc0c05d
extmod/modbtree: Fixes for nanbox build.
2016-07-02 15:58:13 +03:00
Paul Sokolovsky
b09cd0e1ec
extmod/modbtree: Fix unused argument warning.
2016-07-02 15:21:54 +03:00
Paul Sokolovsky
2f7ebf16de
extmod/modbtree: Cleverly implement "for key in btree:" syntax.
...
I.e. make it work like btree.keys(), while still not using a separate
iterator type.
2016-06-23 20:08:37 +03:00
Paul Sokolovsky
6b088a671a
extmod/modbtree: Implement keys(), values(), items() iterators.
...
Each takes optional args of starting key, ending key, and flags (ending
key inclusive, reverse order).
2016-06-20 15:50:31 +03:00
Paul Sokolovsky
080137961d
extmod/modbtree: open(): Support "in-memory" database with filename=None.
...
It's not really in-memory though, just uses anonymous temporary file on
disk.
2016-06-18 01:31:57 +03:00
Paul Sokolovsky
e9739e3315
extmod/modbtree: __getitem__() should raise KeyError for non-existing key.
2016-06-18 01:30:49 +03:00
Paul Sokolovsky
e6e7e0e9c5
extmod/modbtree: items(): Implement DESC flag.
2016-06-18 00:47:26 +03:00
Paul Sokolovsky
332545baa3
extmod/modbtree: items(): Implement "end key inclusive" flag.
2016-06-17 00:08:55 +03:00
Paul Sokolovsky
d0416ff915
extmod/modbtree: Actually implement end key support for .items().
2016-06-16 18:16:33 +03:00
Paul Sokolovsky
1babeb47a4
extmod/modbtree: Implement .items() iterator.
2016-06-16 17:31:24 +03:00
Paul Sokolovsky
422396cece
extmod/modbtree: Handle default value and error check.
2016-06-15 04:18:44 +03:00
Paul Sokolovsky
8072162170
extmod/modbtree: Initial implementation of "btree" module based on BerkeleyDB.
...
This implements basic wrapping of native get/put/seq API, and then dictionary
access protocol. Native API is intended to be superceded going forward.
2016-06-14 21:51:59 +03:00