Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

jdockerty/log-structured-db-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

10 Commits

Repository files navigation

Log Structured Database Engine

A toy implementation of a log structured database engine, inspired from Designing Data Intensive Applications (DDIA) book by Martin Kleppmann.

Martin shows that you can create the world's simplest database using the follow lines of bash

db_set() {
 echo "1ドル,2ドル" >> database
}
db_get() {
 grep "^1ドル," database | sed -e "s/^1ドル,//" | tail -n 1
}

This is my own not-so-concise implementation in Go, used to solidify the concepts that Martin portrays. Comments are provided for explanation and understanding.

Example

Build using go build cmd/db.go and then run

./db --set "1, foo"
./db --set "2, bar"
./db --get "1" # outputs 'foo'
./db --set "1, bar" # updates ID 1 to bar
./db --get "1" # outputs 'bar'
./db --disable-index --get "1" # also outputs 'bar', but with a full scan returning the latest record

About

Toy implementation of a Log Structured Database Engine, inspired by DDIA.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

AltStyle によって変換されたページ (->オリジナル) /