Git Product home page Git Product logo

tiny-bitcask's Introduction

tiny-bitcask

tiny-bitcask是对bitcask论文的简单实现,旨在提供用Go实现简单kv存储引擎的参考。后来我想把这个项目作为实现我各种想法的试验田。所以会持续迭代这个项目,迭代的结果就是master分支的代码。如果想看简单版本的实现可以通过以下方式拉取代码,并且切换到demo分支。

git clone [email protected]:elliotchenzichang/tiny-bitcask.git
cd tiny-bitcask
git chckout demo

另外我想实现做的实验和实现的想法会记录在项目TODO中。并切换分支进行相关迭代,有效果的部分会合并进入master分支。实践的相关文章会列在文章列表上。感谢各位的关注,希望各位都能从中学到一些东西。欢迎star,欢迎提PR。

Todo

  • 实现HintFile
  • 探究对map的优化
  • 实现version control

文章list

  1. 基于Bitcask实现简单的kv存储详细讲解

个人

下面是本人微信公众号,欢迎关注

image

tiny-bitcask's People

Contributors

elliotchenzichang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tiny-bitcask's Issues

关于demo分支一个小细节的疑问

tiny-bitcask仓库的demo分支:stroage.go:121, path := fmt.Sprintf("%s/%d", s.dir, fid)是否少了文件后缀名,之后调用os.OpenFile应该会失败吧。

merge 的时候是不是要跳过一些无效的 entry?

这里读到 entry 之后是不是检查一下是否删除状态,以及和内存中的 index 相比是不是老数据,如果是老数据的话应该就不用写入了?
好像没看到相关的判断逻辑。

https://github.com/elliotchenzichang/tiny-bitcask/blob/master/db.go#L104-L114

entry, err := db.s.readEntry(fid, off)
if err == nil {
	off += int64(entry.Size())
	oldIndex := db.kd.index[string(entry.key)]
	if oldIndex.fid == fid && oldIndex.off == off {
    	newIndex, err := db.s.writeAt(entry.Encode())
    	if err != nil {
        	return err
    	}
    	db.kd.index[string(entry.key)] = newIndex
	}
}

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.