Skip to content

Latest commit

 

History

History
127 lines (91 loc) · 3.01 KB

File metadata and controls

127 lines (91 loc) · 3.01 KB

Contributing to Skein

Thank you for your interest in contributing! This document covers everything you need to get started.


Development setup

Requirements: Go 1.22+, Docker

git clone https://github.com/techgonia-devjio/skein
cd skein

# Start the dev container (Go + hot-reload via Air)
docker compose -f docker-compose.dev.yml up -d

# Run all tests
docker exec skein-dev go test ./... -count=1

# Build the binary
make build

The dev container mounts the source directory as a volume, so changes are reflected immediately without rebuilding the image.


Project layout

cmd/skein/              CLI entry points (cobra commands)
internal/
  cache/                Cache interface + Noop, Disk, Redis, Layered drivers
  config/               Config types + YAML load/save
  db/                   SQLite/Postgres/MySQL DB layer
  providers/            Provider interface + S3-compatible client + mock
  router/               Account selection, routing strategies
  server/               HTTP gateway (S3 + management API + dashboard)
  version/              Build-time version string
test/
  functional/           AWS SDK v2 S3 protocol compatibility tests
  acceptance/           Business scenario tests (Given/When/Then)
  e2e/                  Full user journey tests
  smoke/                Real provider tests (needs credentials)

Adding a routing strategy

  1. Create internal/router/strategy_yourname.go
  2. Implement the Strategy interface (see strategy_default.go for reference)
  3. Register it in an init() function:
    func init() {
        RegisterStrategy("your-name", func(cfg *config.RoutingConfig) (Strategy, error) {
            return &yourStrategy{}, nil
        })
    }
  4. Add tests in internal/router/router_test.go

Adding a provider

  1. Create internal/providers/yourprovider/ implementing providers.Provider
  2. Add the provider name to internal/providers/s3compat/ or implement directly
  3. Add it to example-config.yaml with a commented example

Running specific test suites

# Unit + integration
go test ./internal/... -count=1

# S3 protocol compatibility
go test ./test/functional/... -v

# Business scenarios
go test ./test/acceptance/... -v

# Real provider (needs env vars)
source test/smoke/.env.smoke
go test ./test/smoke/... -v -timeout 120s

Commit style

Follow conventional commits for clarity:

feat: add multi-redundancy strategy
fix: correct egress tracking on cache hit
docs: add WAL-G backup example to README
test: add auth timestamp replay tests
refactor: extract countReader to helpers

Before opening a PR

go vet ./...
go test ./... -count=1 -race

Both must pass. The CI will also check these automatically.


Forking

If you fork the repo and want to use a different module path, update go.mod and all imports:

go mod edit -module github.com/YOUR_USERNAME/skein
find . -name "*.go" | xargs sed -i 's|github.com/techgonia-devjio/skein/|github.com/YOUR_USERNAME/skein/|g'