Skip to content

Latest commit

 

History

History
54 lines (45 loc) · 990 Bytes

File metadata and controls

54 lines (45 loc) · 990 Bytes

User Guide

Building

Requires Go 1.20+.

cd minidb
go build -o minidb ./cmd/minidb

Running Verification Tests

To ensure everything is working correctly:

go test ./...

Interactive REPL

Start the database in interactive mode:

./minidb

You will see the prompt minidb>.

Example Session:

minidb> INSERT INTO users VALUES (1, 'Alice')
minidb> INSERT INTO users VALUES (2, 'Bob')
minidb> SELECT * FROM users WHERE id = 1
[1 Alice]
(1 rows)
minidb> FLUSH
MemTable flushed to SSTable
minidb> exit

TCP Server Mode

Start the database as a server:

./minidb -server -port 3000

Connect using a TCP client like nc:

nc localhost 3000
INSERT INTO users VALUES (10, 'Remote')
SELECT * FROM users

Data Persistence

Data is stored in the ./data directory within the working folder.

  • wal.log: Write-Ahead Log.
  • *.sst: Compacted data files.

To reset the database, simply delete the ./data directory.