Skip to content

Commit c81a342

Browse files
authored
Merge pull request #109 from hyp3rd/feat/dist-mem-cache
feat(dist): Phase B production-readiness — SWIM indirect probes, hint-queue retry, wire compression, and queueHint race fix
2 parents 2347c33 + d69acf4 commit c81a342

33 files changed

Lines changed: 3698 additions & 95 deletions

.dockerignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Keep the build context tight: skip everything that doesn't affect
2+
# the Go build. Big wins are .git and the __examples directory.
3+
.git
4+
.github
5+
.vscode
6+
.idea
7+
.DS_Store
8+
*.log
9+
*.tmp
10+
11+
# Example projects — separate go.mod files, not built into the
12+
# server binary.
13+
__examples
14+
15+
# Test artifacts.
16+
*.test
17+
*.out
18+
*.prof
19+
coverage.txt
20+
bench-*.txt
21+
22+
# Local dev helpers.
23+
docker-compose.yml
24+
docker-compose.*.yml
25+
!docker-compose.cluster.yml
26+
27+
# Docs that don't affect the binary.
28+
*.md
29+
docs

.github/workflows/cluster.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
name: cluster
3+
4+
# Cross-process cluster smoke. Boots the 5-node docker-compose
5+
# stack defined at docker-compose.cluster.yml, waits for every
6+
# node's /healthz to flip to 200, then runs the assertion script
7+
# under scripts/tests/. Catches the class of bugs that unit
8+
# tests miss because they only exercise in-process behavior:
9+
# * config not flowing from HyperCache wrapper to DistMemory
10+
# * seed lists with empty node IDs producing broken rings
11+
# * wire-encoding asymmetries between writer and replica
12+
#
13+
# Container logs are dumped on failure so a CI failure is
14+
# debuggable without re-running locally.
15+
16+
on:
17+
pull_request:
18+
push:
19+
branches: [main]
20+
21+
permissions:
22+
contents: read
23+
24+
jobs:
25+
smoke:
26+
name: 5-node smoke
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 10
29+
30+
steps:
31+
- uses: actions/checkout@v6
32+
33+
- name: Build cluster image
34+
run: |
35+
docker compose -f docker-compose.cluster.yml build
36+
37+
- name: Bring cluster up
38+
run: |
39+
docker compose -f docker-compose.cluster.yml up -d
40+
41+
- name: Wait for cluster /healthz
42+
run: bash scripts/tests/wait-for-cluster.sh
43+
44+
- name: Run cross-node smoke
45+
run: bash scripts/tests/10-test-cluster-api.sh
46+
47+
- name: Dump container logs (on failure)
48+
if: failure()
49+
run: |
50+
for c in hypercache-1 hypercache-2 hypercache-3 hypercache-4 hypercache-5; do
51+
echo "::group::$c"
52+
docker logs --tail 200 "$c" || true
53+
echo "::endgroup::"
54+
done
55+
56+
- name: Tear down
57+
if: always()
58+
run: |
59+
docker compose -f docker-compose.cluster.yml down -v --remove-orphans

.github/workflows/gitleaks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ permissions:
55
on:
66
pull_request:
77
push:
8-
branches: [main]
8+
branches: [ main ]
99
workflow_dispatch:
1010
schedule:
1111
# run once a day at 4 AM

.github/workflows/image.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
name: image
3+
4+
# Build (and on the right refs, publish) the hypercache-server
5+
# container image. Three trigger shapes:
6+
# * pull_request — build only, never push (catches Dockerfile
7+
# regressions without polluting the registry).
8+
# * push to main — build + push as `:main` and `:sha-<short>`
9+
# so consumers can pin to either.
10+
# * tag push (v*.*.*) — build + push semver-flavored tags
11+
# (`:v1.2.3`, `:1.2.3`, `:1.2`, `:1`, `:latest`) for stable
12+
# pinning.
13+
# Multi-arch linux/amd64 + linux/arm64 via buildx + qemu so
14+
# operators on Apple Silicon (or k8s nodes on Graviton) get a
15+
# native binary without emulation.
16+
17+
on:
18+
pull_request:
19+
push:
20+
branches: [ main ]
21+
tags: [ "v*.*.*" ]
22+
workflow_dispatch:
23+
24+
permissions:
25+
contents: read
26+
packages: write
27+
28+
env:
29+
REGISTRY: ghcr.io
30+
IMAGE_NAME: ${{ github.repository }}/hypercache-server
31+
32+
jobs:
33+
build:
34+
name: build${{ github.event_name == 'pull_request' && ' (no push)' || ' + push'
35+
}}
36+
runs-on: ubuntu-latest
37+
timeout-minutes: 20
38+
39+
steps:
40+
- uses: actions/checkout@v6
41+
42+
- name: Set up QEMU
43+
uses: docker/setup-qemu-action@v4
44+
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v4
47+
48+
# Login is gated on non-PR events. Forks running PR workflows
49+
# don't have access to GITHUB_TOKEN with packages:write, and
50+
# we never push from a PR anyway — so skipping the login step
51+
# avoids an avoidable failure on those events.
52+
- name: Log in to GHCR
53+
if: github.event_name != 'pull_request'
54+
uses: docker/login-action@v4.1.0
55+
with:
56+
registry: ${{ env.REGISTRY }}
57+
username: ${{ github.actor }}
58+
password: ${{ secrets.GITHUB_TOKEN }}
59+
60+
# docker/metadata-action computes the tag set + OCI labels
61+
# from the triggering ref. The semver patterns only match
62+
# when the ref is a `v*.*.*` tag; on branch/PR pushes they
63+
# produce no tags and the type=ref/type=sha entries take over.
64+
# `:latest` is restricted to semver tag pushes — production
65+
# operators pinning to `:latest` get the highest stable
66+
# release, never an in-flight main commit. The `latest=false`
67+
# flavor disables the metadata-action default behavior that
68+
# would otherwise tag `:latest` on every default-branch push.
69+
- name: Compute tags and labels
70+
id: meta
71+
uses: docker/metadata-action@v6
72+
with:
73+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
74+
tags: |
75+
type=ref,event=branch
76+
type=ref,event=pr
77+
type=sha,format=short
78+
type=semver,pattern={{version}}
79+
type=semver,pattern={{major}}.{{minor}}
80+
type=semver,pattern={{major}}
81+
type=raw,value=latest,enable=${{ github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') }}
82+
flavor: |
83+
latest=false
84+
85+
- name: Build${{ github.event_name == 'pull_request' && '' || ' + push' }}
86+
uses: docker/build-push-action@v7.1.0
87+
with:
88+
context: .
89+
file: cmd/hypercache-server/Dockerfile
90+
platforms: linux/amd64,linux/arm64
91+
push: ${{ github.event_name != 'pull_request' }}
92+
tags: ${{ steps.meta.outputs.tags }}
93+
labels: ${{ steps.meta.outputs.labels }}
94+
# GHA cache speeds re-builds when only Go source changed
95+
# (the dependency-download layer stays warm).
96+
cache-from: type=gha
97+
cache-to: type=gha,mode=max

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,3 @@ tags
9696

9797
### Project ###
9898
.dccache
99-
cmd/
100-
bin/
101-
.github/instructions/instructions.md

.gitleaksignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
docker-compose.cluster.yml:curl-auth-header:14
2+
docker-compose.cluster.yml:curl-auth-header:16
3+
docker-compose.cluster.yml:curl-auth-header:17
4+
scripts/tests/10-test-cluster-api.sh:curl-auth-header:6
5+
scripts/tests/10-test-cluster-api.sh:curl-auth-header:13
6+
scripts/tests/10-test-cluster-api.sh:curl-auth-header:19
7+
scripts/tests/10-test-cluster-api.sh:curl-auth-header:26
8+
scripts/tests/10-test-cluster-api.sh:curl-auth-header:32
9+
scripts/tests/10-test-cluster-api.sh:curl-auth-header:36
10+
cmd/hypercache-server/README.md:curl-auth-header:50
11+
cmd/hypercache-server/README.md:curl-auth-header:55
12+
cmd/hypercache-server/README.md:curl-auth-header:59
13+
cmd/hypercache-server/README.md:curl-auth-header:102
14+
cmd/hypercache-server/README.md:curl-auth-header:108
15+
cmd/hypercache-server/README.md:curl-auth-header:112

0 commit comments

Comments
 (0)