Skip to content

Latest commit

 

History

History
146 lines (111 loc) · 2.51 KB

File metadata and controls

146 lines (111 loc) · 2.51 KB

TinkerDB Setup Guide

Quick setup guide for getting TinkerDB up and running. Please note that these steps set up the database to work as I intended it to. If you wish to tinker with the code (pun intended) then feel free to set the project up as per your requirements.

Prerequisites

1. Install Go

Verify:

go version  # Should show Go 1.21 or later

2. Install Protocol Buffers Compiler

Verify:

protoc --version  # Should show libprotoc 3.x or later

Setup Steps

1. Navigate to Project Directory

cd TinkerDB

2. Install Go Tools and Dependencies

make deps

This installs:

  • protoc-gen-go - Protocol Buffers Go plugin
  • protoc-gen-go-grpc - gRPC Go plugin
  • All Go dependencies from go.mod

3. Generate Protocol Buffers Code

make proto

This generates:

  • proto/kvstore/kvstore.pb.go - Protocol Buffers messages
  • proto/kvstore/kvstore_grpc.pb.go - gRPC service code

4. Run Tests (Optional but Recommended)

make test

Expected output: All tests pass with coverage report.

5. Build the Server

make build

This creates: bin/tinkerdb-server

Running TinkerDB

Start the Server

Option 1: Using Make

make server

Option 2: Using Go

go run cmd/server/main.go

To use a custom Port:

TINKERDB_PORT=<port number> make server

Expected Output

TinkerDB server starting on port 50051...
Server is ready to accept connections

Troubleshooting

Problem: protoc: command not found

Solution: Install Protocol Buffers compiler (see Prerequisites)

Problem: cannot find package "google.golang.org/grpc"

Solution:

go mod download
go mod tidy

Problem: *.pb.go files not found

Solution:

make proto

Problem: Server port already in use

Solution:

# Find and kill process using port 50051
lsof -ti:50051 | xargs kill -9

# Or use a different port
TINKERDB_PORT=8080 make server

System Requirements

  • Go: 1.21 or later
  • Protocol Buffers: 3.x or later
  • OS: macOS, Linux, or Windows
  • Memory: 100MB minimum
  • Disk: 50MB for dependencies and build artifacts

Testing

Running Tests

All tests:

make test

With coverage report:

make test-coverage
open coverage.html

Specific package:

go test -v ./internal/storage/
go test -v ./internal/server/
go test -v ./test/

Run benchmarks:

go test -bench=. -benchmem ./...