当前位置:网站首页>golang写的存储引擎,基于b+树,mmap
golang写的存储引擎,基于b+树,mmap
2022-08-03 22:16:00 【InfoQ】
mydb
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)))
}
边栏推荐
- HCIP第十四天
- Go开发工具GoLand V2022.2 来了——Go 工作区重大升级
- Bytebase database schema change management tool
- 距LiveVideoStackCon 2022 上海站开幕还有3天!
- Cisco ike2 IPSec configuration
- Research status of target detection at home and abroad
- 优化查询(工作中)
- JPA Native Query(本地查询)及查询结果转换
- 466. Count The Repetitions
- IO thread process -> thread synchronization mutual exclusion mechanism -> day6
猜你喜欢
node连接mysql数据库报错:Client does not support authentication protocol requested by server
Embedded Systems: Clocks
嵌入式系统:时钟
CAS:1192802-98-4_UV 裂解的生物素-PEG2-叠氮
全球观之地理部分
LabVIEW code generation error 61056
encapsulation, package, access modifier, static variable
如何设计 DAO 的 PoW 评判标准 并平衡不可能三角
What is Adobe?
Go开发工具GoLand V2022.2 来了——Go 工作区重大升级
随机推荐
pikachu Over permission 越权
start with connect by implements recursive query
Diazo Biotin-PEG3-DBCO | Diazo Compound Modified Biotin-Tripolyethylene Glycol-Dibenzocyclooctyne
21天打卡挑战学习MySQL——《MySQL工具的使用》第一周 第二篇
CAS:153162-70-0_N-BOC-6-生物素酰氨基己胺
【day1】
Golang Chapter 2: Program Structure
L2-041 插松枝
HCIP第十五天
【bug】汇总Elipse项目中代码中文乱码解决方法!
E-commerce data warehouse ODS layer-----log data loading
超级实用网站+公众号合集
Makefile
IO thread process -> thread synchronization mutual exclusion mechanism -> day6
深度学习和机器学习有什么区别?
CAS:122567-66-2_DSPE-Biotin_DSPE-Biotin
DO280管理和监控OpenShift平台--资源限制
HDU 5655 CA Loves Stick
CAS: 1192802-98-4 _uv cracking of biotin - PEG2 - azide
『百日百题 · 基础篇』备战面试,坚持刷题 第四话——循环语句!