Coder Social home page Coder Social logo

golsm's Introduction

golsm: 基于 go 语言实现的 lsm tree

📚 前言

笔者在学习 lsm tree 实现方案的过程中,在很大程度上借鉴了 simple-raft 项目,在此特别致敬一下作者. 附上传送门:https://github.com/nananatsu/simple-raft/tree/master/pkg/lsm

📖 简介

100% 纯度 go 语言实现的 lsm tree 框架,能够更好地应对组织写密集型 kv 存储结构.

💡 lsm tree 技术原理及源码实现

原理篇:初探 rocksDB 之 lsm tree

实现篇一:基于go实现lsm tree 之主干框架

实现篇二:基于go实现lsm tree之memtable结构

实现篇三:基于go实现lsm tree之sstable结构

实现篇四:基于go实现lsm tree之level sorted merge流程

🖥 使用示例

func Test_LSM_UseCase(t *testing.T) {
	// 1 构造配置文件
	conf, _ := NewConfig("./lsm", // lsm sstable 文件的存放目录
		WithMaxLevel(7),           // 7层 lsm tree
		WithSSTSize(1024*1024),       // level 0 层,每个 sstable 的大小为 1M
		WithSSTDataBlockSize(16*1024), // sstable 中,每个 block 大小为 16KB
		WithSSTNumPerLevel(10),     // 每个 level 存放 10 个 sstable 文件
	)

	// 2 创建一个 lsm tree 实例
	lsmTree, _ := NewTree(conf)
	defer lsmTree.Close()

	// 3 写入数据
	_ = lsmTree.Put([]byte{1}, []byte{2})

	// 4 读取数据
	v, _, _ := lsmTree.Get([]byte{1})

	t.Log(v)
}

golsm's People

Contributors

xiaoxuxiansheng avatar

Stargazers

阿冰 avatar 闵振 avatar  avatar bo avatar  avatar zxc avatar yangyi avatar YiD11 avatar  avatar  avatar  avatar stars avatar Elbert Chan avatar yesAnd avatar FF avatar 长大了 avatar brunowang avatar HyGao avatar Quanee avatar liukai avatar howd avatar rylynn avatar  avatar amliu avatar  avatar Gilbert avatar  avatar Gavin avatar TopMagic avatar ly avatar  avatar a39 avatar Linwood Bavelas avatar alwayrun avatar  avatar 王听正 avatar  avatar  avatar 上杉夏香 avatar  avatar

Watchers

 avatar

golsm's Issues

布隆过滤器单测失败

结果如下:
=== RUN Test_BloomFilter_Add_Exist
bloom_filter_test.go:25: key: a, expect: true, got: false
bloom_filter_test.go:29: key: b, expect: true, got: false
bloom_filter_test.go:33: key: c, expect: true, got: false
bloom_filter_test.go:37: key: d, expect: true, got: false
--- FAIL: Test_BloomFilter_Add_Exist (0.00s)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.