Valchemy is a high-performance, distributed key-value storage system with built-in replication support, written in Go.
- In-memory and on-disk storage engines
- Write-Ahead Logging (WAL) for data durability
- Master-Replica replication support
- Configurable network settings
- Comprehensive logging system
- Interactive CLI client
- Connection pooling with configurable limits
- Go 1.21 or higher
- Task (task runner)
- Clone the repository:
git clone https://github.com/8thgencore/valchemy.git
cd valchemy
- Install dependencies:
go mod tidy
- Start the server with default configuration:
go run cmd/server/main.go
Or with a custom config file:
go run cmd/server/main.go -config path/to/config.yaml
Connect to a running server:
go run cmd/cli/main.go
Optional flags:
-h, --host
: Server host (default: "127.0.0.1")-p, --port
: Server port (default: "3223")
The server can be configured using a YAML configuration file. Key configuration options include:
engine:
type: "in_memory" # Storage engine type (in_memory/on_disk)
network:
address: "127.0.0.1:3223" # Client-facing API endpoint
max_connections: 100 # Maximum concurrent client connections
logging:
level: "info" # Log level (debug|info|warn|error)
output: "stdout" # Output destination (stdout|file_path)
wal:
enabled: true # Enable Write-Ahead Logging
data_directory: "./data/wal"
replication:
replica_type: "master" # Node replication role (master/replica)
master_host: "127.0.0.1" # Master node API host
replication_port: "3233" # Port for replica connections
The project uses Task for managing development workflows:
# Run in development mode with hot reload
task dev
# Run linter
task lint
# Format code
task format
# Run tests
task test
# Run tests with coverage
task test:coverage
.
├── cmd/ # Application entrypoints
│ ├── cli/ # CLI client
│ └── server/ # Server implementation
├── internal/ # Private application code
│ ├── app/ # Application core
│ ├── client/ # Client implementation
│ ├── compute/ # Command processing
│ ├── config/ # Configuration handling
│ ├── replication/ # Replication logic
│ ├── server/ # Server implementation
│ ├── storage/ # Storage engines
│ └── wal/ # Write-Ahead Logging
├── pkg/ # Public libraries
└── taskfiles/ # Task runner configurations
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.