rosedb 的 mini 版本,帮助理解 bitcask 存储模型以及 rosedb 项目。

minidb

rosedb 的 mini 版本,帮助理解 bitcask 存储模型以及 rosedb 项目。

需要说明的是,minidb 没有实现 bitcask 模型的多个数据文件的机制,为了简单,我只使用了一个数据文件进行读写。但这并不妨碍你理解 bitcask 模型。

我写了一篇文章对 minidb 进行讲解:从零实现一个 k-v 存储引擎

相信结合文章及 minidb 的简单的代码,你能够快速上手了。

当然,你可以阅读 bitcask 模型的论文原文:https://riak.com/assets/bitcask-intro.pdf

以及 rosedb 项目:rosedb

Owner
roseduan
微信公众号:roseduan写字的地方,回复 Go,你懂的。
roseduan
Similar Resources

Mini is a small text editor, inspred by antirez's kilo editor.

Mini is a small text editor, inspred by antirez's kilo editor.

mini Mini is a small text editor, inspred by antirez's kilo editor. It aims to Keep it simple, stupid.

Dec 23, 2022

Mini lisp interpreter written in Go.

Mini Go Lisp Mini lisp interpreter written in Go. It is implemented with reference to the d-tsuji/SDLisp repository written in Java. Support System Fu

Nov 25, 2022

Professional lightweight testing mini-framework for Go.

Professional lightweight testing mini-framework for Go.

is Professional lightweight testing mini-framework for Go. Easy to write and read Beautifully simple API with everything you need: is.Equal, is.True,

Dec 28, 2022

Clash.Mini

Clash.Mini A simple GUI for Clash. Why this repo Provide a simple GUI for clash on windows platform. Based on project TrayedClash by imgk Features Sim

Jan 3, 2023

mini tools handling migrasion database from cli

mini tools handling migrasion database from cli

Dec 13, 2021

Example mini project golang scanner application

Example mini project golang scanner application

Golang Scanner Contoh pembuatan aplikasi Java menggunakan BlueJ cek disini, tetapi berikut ini adalah versi rebuild dari Java ke Golang, dengan menggu

Nov 19, 2022

Example Golang API backend rest implementation mini project Point Of Sale using Gin Framework and Gorm ORM Database.

Example Golang API backend rest implementation mini project Point Of Sale using Gin Framework and Gorm ORM Database.

Dec 23, 2022

This vitual os application consist of 3 mini applications embedded in it like weather app , text editor and calculator .

Virtual-Operating-System This vitual os application consist of 3 mini applications embedded in it like weather app , text editor and calculator . APPS

Nov 11, 2021

mini json response for rest api

You will avoid commands below defining every time in services. resp := Response{ Code: responseCode, Message: msg, Data: data, } http.ResponseWriter.W

Dec 7, 2021

Umeshu is a mini web framework written by Golang.

Umeshu Umeshu is a mini web framework written by Golang. Purpose Why do I reinvent the wheel? Just for learning. 😊 Building a mini web framework from

Jul 2, 2022

Like Komodor, just mini [••]

Minikom - like Komodor, just mini [••] Congratulations for receiving Komodor home assignment! If you made it this far, it means we're curious, and wou

Dec 20, 2021

🥝 Mini ECS CLI Command 🥝

miniecs 🥝 miniecs is a CLI tool for AWS ECS. 🥝 Requirement go 1.17.x or later �Installation go install github.com/jedipunkz/miniecs@latest Usage $ m

Oct 26, 2022

A mini Web SSH server.

MiniWebSSHServer A mini Web SSH server. Build go build . Run miniwebsshserver -bind ip_addr:port Open a term from url http://ip_addr:port/term?h

Sep 16, 2022

Collection of mini-programs demonstrating Kubernetes client-go usage.

Kubernetes client-go examples Collection of mini-programs covering various client-go use cases. The intention (at least so far) is to test (more or le

Jan 3, 2023

Mini Blockchain Implementation In Golang Inspired by Go-Ethereum🚀

JP Blockchain 🚀 🚀 Mini Blockchain Implementation In Golang Inspired by Go Ethereum & BlockChain Bar by Lukas (Web3Coach) Features Working Core Compo

Aug 8, 2022

Mini-framework for multiple authentication and authorization schemes

Mini-framework for multiple authentication and authorization schemes

Go authorization pattern This repository demonstrates an authorization pattern that allows multiple schemes. Demo To start the demo run the following

Dec 30, 2021

mini file transfer tool, use it just curl o wget

miniTransfer mini file transfer tool, use it just curl o wget How to use upload file curl -T localFileName 127.0.0.1:1234 # default save as localFileN

Jan 12, 2022

Based on the electron Cross-platform Mini browser

Based on the electron Cross-platform Mini browser

May 1, 2022
Comments
  • Merge的小疑问

    Merge的小疑问

    https://github.com/roseduan/minidb/blob/ab5768a129eb3d670d70d2a3ff0274c916cf53a3/db.go#L104

    不应该更新dbFile这个对象吗,还用临时文件对象?

    	newdbFile, _ := NewDBFile(db.dirPath)
    	db.dbFile = newdbFile
    
  • 如何保障内存hash和磁盘文件索引的一致性?

    如何保障内存hash和磁盘文件索引的一致性?

    大佬你好,我是从公众号的文章过来的,目前暂时还没有仔细阅读您的代码,不过通过文章阅读了解到,miniDB使用bitcase模型大致的思路是从内存的hash中取出index,再从数据文件中读取对应index的结果(value),不禁思索,这两个操作应具备事务性,否则会出现数据不一致的情况,这里就是单纯讨论(后续我看完代码后如果发现了相关的内容会补充到issue的下方)

  • 你好,这里有个小bug,此处文件已经close,后面便无法读取了

    你好,这里有个小bug,此处文件已经close,后面便无法读取了

    		// 获取文件名
    		mergeDBFileName := mergeDBFile.File.Name()
    		// 关闭文件
    		mergeDBFile.File.Close()
    		// 临时文件变更为新的数据文件
    		os.Rename(mergeDBFileName, db.dirPath+string(os.PathSeparator)+FileName)
                    // x 此处文件已经关闭了,应该重新打开
    		db.dbFile = mergeDBFile
    
          ->
    		db.dbFile =  NewDBFile(db.dirPath)
    
simple kv store engine inspired by bitcask

tiny-bitcask simple kv store engine inspired by bitcask Inspired By BitCask BitCask System Design DB启动时,系统内存储着merged-data-file 与 hint-file 系统通过读取hint-

Nov 14, 2021
rosedb is a fast, stable and embedded key-value (k-v) storage engine based on bitcask.
rosedb is a fast, stable and embedded key-value (k-v) storage engine based on bitcask.

rosedb is a fast, stable and embedded key-value (k-v) storage engine based on bitcask. Its on-disk files are organized as WAL(Write Ahead Log) in LSM trees, optimizing for write throughput.

Dec 28, 2022
trojan-go trojan(mini) mini auth trojan golang go

trojan forked from https://github.com/p4gefau1t/trojan-go Usage build: go build -tags "full" client: ./trojan-go -client -remote xxx.com:443 -local

Feb 2, 2022
🔑A high performance Key/Value store written in Go with a predictable read/write performance and high throughput. Uses a Bitcask on-disk layout (LSM+WAL) similar to Riak.

bitcask A high performance Key/Value store written in Go with a predictable read/write performance and high throughput. Uses a Bitcask on-disk layout

Sep 26, 2022
simple kv store engine inspired by bitcask

tiny-bitcask simple kv store engine inspired by bitcask Inspired By BitCask BitCask System Design DB启动时,系统内存储着merged-data-file 与 hint-file 系统通过读取hint-

Nov 14, 2021
rosedb is an embedded and fast k-v database based on LSM + WAL
rosedb is an embedded and fast k-v database based on LSM + WAL

A simple k-v database in pure Golang, supports string, list, hash, set, sorted set.

Dec 30, 2022
Mini audio library

malgo Go bindings for miniaudio library. Requires cgo but does not require linking to anything on the Windows/macOS and it links only -ldl on Linux/BS

Dec 31, 2022
DEPRECATED. Embeds mruby (mini Ruby) VM into Go.

GoMRuby Package gomruby embeds mruby (mini Ruby) VM into Go. Documentation. Installation It's slightly more than just go get: go get -d github.com/Ale

May 17, 2022
Goldorak GO is a mini framework for the Go programming language. (unfinished dead code)

Goldorak Go =========== > Goldorak GO ! Rétrolaser en action > Goldorak GO !! Va accomplir ta mission > Dans l'infini > Des galaxies > Poursuis ta lu

Apr 29, 2021
Getting better at Linux with 10 mini-projects.

10 things Linux How do you advance your Linux skills when you are already comfortable with the basics? My solution was to come up with 10 subjects to

Dec 25, 2022