当前位置:网站首页>golang写的存储引擎,基于b+树,mmap
golang写的存储引擎,基于b+树,mmap
2022-08-03 22:16:00 【InfoQ】
mydb
mydb是一个golang写的键值存储引擎,基于b+树,mmap
怎样使用:
package main
import (
"fmt"
"github.com/alberliu/mydb"
"strconv"
)
func toBytes(i int) []byte {
return []byte(strconv.Itoa(i))
}
func main() {
db, err := mydb.Open("data")
if err != nil {
panic(err)
}
fmt.Println("init: ", db.Range(mydb.Infinity, mydb.Infinity))
for i := 1; i <= 5; i++ {
db.Add(toBytes(i), toBytes(i))
}
fmt.Println("add: ", db.Range(mydb.Infinity, mydb.Infinity))
db.Update(toBytes(1), toBytes(4))
fmt.Println("update", db.Range(mydb.Infinity, mydb.Infinity))
db.Delete(toBytes(1))
fmt.Println("delete", db.Range(mydb.Infinity, mydb.Infinity))
fmt.Println("range ", db.Range(toBytes(3), toBytes(4)))
}
github地址:
https://github.com/alberliu/mydb
边栏推荐
猜你喜欢
随机推荐
如何基于WPF写一款数据库文档管理工具(二)
Cisco ike2 IPSec配置
CAS:1797415-74-7_TAMRA-Azide-PEG-Biotin
超级实用网站+公众号合集
488. Zuma Game
[MySQL Advanced] Creation and Management of Databases and Tables
UVa 1025 - A Spy in the Metro (White Book)
376. Wiggle Subsequence
VLAN实验
YOLO之父宣布退出CV界,坦言无法忽视自己工作带来的负面影响
HCIP第十六天
How to write a database document management tool based on WPF (2)
函数,递归以及dom简单操作
Pay from 0 to 1
Embedded systems: overview
for循环练习题
Go开发工具GoLand V2022.2 来了——Go 工作区重大升级
嵌入式系统:概述
CAS:1260586-88-6_Biotin-C5-Azide_Biotin-C5-Azide
投资性大于游戏性 NFT游戏到底是不是门好生意








