百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
B

bplustree

> 编程语言
开源

用于 Python 的磁盘 B+ 树 3

768 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

用于 Python 的磁盘 B+ 树 3

Bplustree ============ .. image:: https://travis-ci.org/NicolasLM/bplustree.svg?branch=master :target: https://travis-ci.org/NicolasLM/bplustree .. image:: https://coveralls.io/repos/github/NicolasLM/bplustree/badge.svg?branch=master :target: https://coveralls.io/github/NicolasLM/bplustree?branch=master 一个存储在磁盘上的 B+ 树,用于 Python 3。它感觉像一个字典,但存储在磁盘上。何时使用它? - 当要存储的数据不适合内存 - 当数据需要持久化 - 当保持键的顺序很重要 此项目正在开发中:文件的格式可能在不同的版本之间发生变化。请不要将其作为主要数据源使用。 快速入门 ---------- 使用 pip 安装 Bplustree: pip install bplustree 创建一个存储在文件上的 B+ 树索引,并使用它: .. code:: Python

从 bplustree 中导入 BPlusTree tree = BPlusTree('/tmp/bplustree.db', order=50) tree[1] = b'foo' tree[2] = b'bar' tree[1] b'foo' tree.get(3) tree.close() 键和值


键必须具有自然顺序,并且必须可序列化为字节。某些默认键 提供了用于最常见类型的序列化器。例如,用于索引 UUID: .. 代码:: Python

导入 uuid 从 bplustree 中导入 BPlusTree 和 UUIDSerializer tree = BPlusTree('/tmp/bplustree.db', serializer=UUIDSerializer(), key_size=16) tree.insert(uuid.uuid1(), b'foo') list(tree.keys())

另一方面,值总是以字节为单位。它们可以具有任意长度,参数 value_size=128 定义了可以存储在树中本身的值大小的上限。超过此限值的值将存储在溢出页中。每个溢出的值至少占用一整页。

[UUID('48f2553c-de23-4d20-95bf-6972a89f3bc0')] 1 2

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Pythonbplustreebtreebtree-indexespython

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言