extmod/modbtree: Use buffer protocol for keys/values.
This changes the btree implementation to use the buffer protocol for reading key/values in all methods. `str` and `bytes` objects are not the only bytes-like objects that could be used. Documentation and tests are also updated. Addresses issue #8748. Signed-off-by: David Lechner <david@pybricks.com>
This commit is contained in:
committed by
Damien George
parent
c118b5d0e4
commit
a565811f23
@@ -11,8 +11,9 @@ value, a database also supports efficient ordered range scans (retrieval
|
||||
of values with the keys in a given range). On the application interface
|
||||
side, BTree database work as close a possible to a way standard `dict`
|
||||
type works, one notable difference is that both keys and values must
|
||||
be `bytes` objects (so, if you want to store objects of other types, you
|
||||
need to serialize them to `bytes` first).
|
||||
be `bytes`-like objects (so, if you want to store objects of other types, you
|
||||
need to first serialize them to `str` or `bytes` or another type that supports
|
||||
the buffer protocol).
|
||||
|
||||
The module is based on the well-known BerkelyDB library, version 1.xx.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user