From 29b5629ffee58af97dac9e6b777a99f71461147c Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Wed, 14 Jan 2026 15:20:19 +1100 Subject: [PATCH] refactor: rename to cachew --- .goreleaser.yaml | 4 ++-- README.md | 8 ++++---- sfptc.hcl => cachew.hcl | 0 cmd/{sfptc => cachew}/main.go | 2 +- cmd/{sfptcd => cachewd}/main.go | 12 ++++++------ go.mod | 2 +- internal/cache/cachetest/suite.go | 2 +- internal/cache/disk.go | 2 +- internal/cache/disk_test.go | 6 +++--- internal/cache/http.go | 2 +- internal/cache/http_test.go | 4 ++-- internal/cache/memory.go | 2 +- internal/cache/memory_test.go | 6 +++--- internal/cache/remote_test.go | 8 ++++---- internal/cache/s3.go | 2 +- internal/cache/s3_test.go | 6 +++--- internal/cache/tiered.go | 2 +- internal/cache/tiered_test.go | 6 +++--- internal/config/config.go | 6 +++--- internal/httputil/error.go | 2 +- internal/httputil/logging.go | 2 +- internal/strategy/api.go | 2 +- internal/strategy/apiv1.go | 4 ++-- internal/strategy/github_releases.go | 8 ++++---- internal/strategy/github_releases_test.go | 6 +++--- internal/strategy/handler/handler.go | 6 +++--- internal/strategy/handler/handler_test.go | 8 ++++---- internal/strategy/host.go | 6 +++--- internal/strategy/host_test.go | 6 +++--- scripts/cachew | 1 + scripts/{sfptcd => cachewd} | 0 scripts/sfptc | 1 - 32 files changed, 67 insertions(+), 67 deletions(-) rename sfptc.hcl => cachew.hcl (100%) rename cmd/{sfptc => cachew}/main.go (74%) rename cmd/{sfptcd => cachewd}/main.go (80%) create mode 120000 scripts/cachew rename scripts/{sfptcd => cachewd} (100%) delete mode 120000 scripts/sfptc diff --git a/.goreleaser.yaml b/.goreleaser.yaml index d6bd36e..96f164e 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,5 +1,5 @@ builds: - - main: ./cmd/sfptc + - main: ./cmd/cachew binary: sfptc id: sfptc env: @@ -10,7 +10,7 @@ builds: goarch: - amd64 - arm64 - - main: ./cmd/sfptcd + - main: ./cmd/cachewd id: sfptcd binary: sfptcd env: diff --git a/README.md b/README.md index e5293d3..7945b70 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Super-fast Pass-through Cache (SFPTC) +# Cachew (pronounced cashew) is a super-fast pass-through cache -SFPTC is a server and tooling for incredibly efficient, protocol-aware caching. It is +Cachew is a server and tooling for incredibly efficient, protocol-aware caching. It is designed to be used at scale, with minimal impact on upstream systems. By "protocol-aware", we mean that the proxy isn't just a naive HTTP proxy, it is aware of the higher level protocol being proxied (Git, Docker, etc.) and can make more efficient decisions. @@ -19,11 +19,11 @@ To solve this we apply two different strategies on the server: On the client we redirect git to the proxy: ```ini -[url "https://sfptc.local/github/"] +[url "https://cachew.local/github/"] insteadOf = https://github.com/ ``` -As Git itself isn't aware of the snapshots, Git-specific code in the SFPTC CLI can be used to reconstruct a repository. +As Git itself isn't aware of the snapshots, Git-specific code in the Cachew CLI can be used to reconstruct a repository. ## Docker diff --git a/sfptc.hcl b/cachew.hcl similarity index 100% rename from sfptc.hcl rename to cachew.hcl diff --git a/cmd/sfptc/main.go b/cmd/cachew/main.go similarity index 74% rename from cmd/sfptc/main.go rename to cmd/cachew/main.go index 073b3ba..52bd3b0 100644 --- a/cmd/sfptc/main.go +++ b/cmd/cachew/main.go @@ -3,7 +3,7 @@ package main import ( "github.com/alecthomas/kong" - "github.com/block/sfptc/internal/logging" + "github.com/block/cachew/internal/logging" ) var cli struct { diff --git a/cmd/sfptcd/main.go b/cmd/cachewd/main.go similarity index 80% rename from cmd/sfptcd/main.go rename to cmd/cachewd/main.go index b20e77b..74e3b60 100644 --- a/cmd/sfptcd/main.go +++ b/cmd/cachewd/main.go @@ -11,19 +11,19 @@ import ( "github.com/alecthomas/kong" - "github.com/block/sfptc/internal/config" - "github.com/block/sfptc/internal/httputil" - "github.com/block/sfptc/internal/logging" + "github.com/block/cachew/internal/config" + "github.com/block/cachew/internal/httputil" + "github.com/block/cachew/internal/logging" ) var cli struct { - Config *os.File `hcl:"-" help:"Configuration file path." placeholder:"PATH" required:"" default:"sfptc.hcl"` + Config *os.File `hcl:"-" help:"Configuration file path." placeholder:"PATH" required:"" default:"cachew.hcl"` Bind string `hcl:"bind" default:"127.0.0.1:8080" help:"Bind address for the server."` LoggingConfig logging.Config `embed:"" prefix:"log-"` } func main() { - kctx := kong.Parse(&cli, kong.DefaultEnvars("SFPTC")) + kctx := kong.Parse(&cli, kong.DefaultEnvars("CACHEW")) ctx := context.Background() logger, ctx := logging.Configure(ctx, cli.LoggingConfig) @@ -33,7 +33,7 @@ func main() { err := config.Load(ctx, cli.Config, mux, parseEnvars()) kctx.FatalIfErrorf(err) - logger.InfoContext(ctx, "Starting sfptcd", slog.String("bind", cli.Bind)) + logger.InfoContext(ctx, "Starting cachewd", slog.String("bind", cli.Bind)) server := &http.Server{ Addr: cli.Bind, diff --git a/go.mod b/go.mod index 65720eb..941a773 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/block/sfptc +module github.com/block/cachew go 1.25.5 diff --git a/internal/cache/cachetest/suite.go b/internal/cache/cachetest/suite.go index 2789a1e..9bdc6cf 100644 --- a/internal/cache/cachetest/suite.go +++ b/internal/cache/cachetest/suite.go @@ -10,7 +10,7 @@ import ( "github.com/alecthomas/assert/v2" - "github.com/block/sfptc/internal/cache" + "github.com/block/cachew/internal/cache" ) // Suite runs a comprehensive test suite against a cache.Cache implementation. diff --git a/internal/cache/disk.go b/internal/cache/disk.go index 1eebee0..858b7c1 100644 --- a/internal/cache/disk.go +++ b/internal/cache/disk.go @@ -15,7 +15,7 @@ import ( "github.com/alecthomas/errors" "github.com/alecthomas/kong" - "github.com/block/sfptc/internal/logging" + "github.com/block/cachew/internal/logging" ) func init() { diff --git a/internal/cache/disk_test.go b/internal/cache/disk_test.go index fbbce87..117119a 100644 --- a/internal/cache/disk_test.go +++ b/internal/cache/disk_test.go @@ -7,9 +7,9 @@ import ( "github.com/alecthomas/assert/v2" - "github.com/block/sfptc/internal/cache" - "github.com/block/sfptc/internal/cache/cachetest" - "github.com/block/sfptc/internal/logging" + "github.com/block/cachew/internal/cache" + "github.com/block/cachew/internal/cache/cachetest" + "github.com/block/cachew/internal/logging" ) func TestDiskCache(t *testing.T) { diff --git a/internal/cache/http.go b/internal/cache/http.go index 61ee00c..ca2c7e1 100644 --- a/internal/cache/http.go +++ b/internal/cache/http.go @@ -9,7 +9,7 @@ import ( "github.com/alecthomas/errors" - "github.com/block/sfptc/internal/httputil" + "github.com/block/cachew/internal/httputil" ) // Fetch retrieves a response from cache or fetches from the request URL and caches it. diff --git a/internal/cache/http_test.go b/internal/cache/http_test.go index dccfebe..407381f 100644 --- a/internal/cache/http_test.go +++ b/internal/cache/http_test.go @@ -11,8 +11,8 @@ import ( "github.com/alecthomas/assert/v2" - "github.com/block/sfptc/internal/cache" - "github.com/block/sfptc/internal/logging" + "github.com/block/cachew/internal/cache" + "github.com/block/cachew/internal/logging" ) func TestCachedFetch(t *testing.T) { diff --git a/internal/cache/memory.go b/internal/cache/memory.go index 4d315dc..102a1fa 100644 --- a/internal/cache/memory.go +++ b/internal/cache/memory.go @@ -12,7 +12,7 @@ import ( "github.com/alecthomas/errors" - "github.com/block/sfptc/internal/logging" + "github.com/block/cachew/internal/logging" ) func init() { diff --git a/internal/cache/memory_test.go b/internal/cache/memory_test.go index e125704..32eb9eb 100644 --- a/internal/cache/memory_test.go +++ b/internal/cache/memory_test.go @@ -7,9 +7,9 @@ import ( "github.com/alecthomas/assert/v2" - "github.com/block/sfptc/internal/cache" - "github.com/block/sfptc/internal/cache/cachetest" - "github.com/block/sfptc/internal/logging" + "github.com/block/cachew/internal/cache" + "github.com/block/cachew/internal/cache/cachetest" + "github.com/block/cachew/internal/logging" ) func TestMemoryCache(t *testing.T) { diff --git a/internal/cache/remote_test.go b/internal/cache/remote_test.go index cc9a179..1229f17 100644 --- a/internal/cache/remote_test.go +++ b/internal/cache/remote_test.go @@ -9,10 +9,10 @@ import ( "github.com/alecthomas/assert/v2" - "github.com/block/sfptc/internal/cache" - "github.com/block/sfptc/internal/cache/cachetest" - "github.com/block/sfptc/internal/logging" - "github.com/block/sfptc/internal/strategy" + "github.com/block/cachew/internal/cache" + "github.com/block/cachew/internal/cache/cachetest" + "github.com/block/cachew/internal/logging" + "github.com/block/cachew/internal/strategy" ) func TestRemoteClient(t *testing.T) { diff --git a/internal/cache/s3.go b/internal/cache/s3.go index 8960719..d1a0f7e 100644 --- a/internal/cache/s3.go +++ b/internal/cache/s3.go @@ -16,7 +16,7 @@ import ( "github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7/pkg/credentials" - "github.com/block/sfptc/internal/logging" + "github.com/block/cachew/internal/logging" ) func init() { diff --git a/internal/cache/s3_test.go b/internal/cache/s3_test.go index 53e4750..8de88d1 100644 --- a/internal/cache/s3_test.go +++ b/internal/cache/s3_test.go @@ -14,9 +14,9 @@ import ( "github.com/minio/minio-go/v7/pkg/credentials" testcontainersminio "github.com/testcontainers/testcontainers-go/modules/minio" - "github.com/block/sfptc/internal/cache" - "github.com/block/sfptc/internal/cache/cachetest" - "github.com/block/sfptc/internal/logging" + "github.com/block/cachew/internal/cache" + "github.com/block/cachew/internal/cache/cachetest" + "github.com/block/cachew/internal/logging" ) var ( diff --git a/internal/cache/tiered.go b/internal/cache/tiered.go index fd1938e..fdc4181 100644 --- a/internal/cache/tiered.go +++ b/internal/cache/tiered.go @@ -11,7 +11,7 @@ import ( "github.com/alecthomas/errors" - "github.com/block/sfptc/internal/logging" + "github.com/block/cachew/internal/logging" ) // The Tiered cache combines multiple caches. diff --git a/internal/cache/tiered_test.go b/internal/cache/tiered_test.go index 8abab5b..8a707b2 100644 --- a/internal/cache/tiered_test.go +++ b/internal/cache/tiered_test.go @@ -6,9 +6,9 @@ import ( "github.com/alecthomas/assert/v2" - "github.com/block/sfptc/internal/cache" - "github.com/block/sfptc/internal/cache/cachetest" - "github.com/block/sfptc/internal/logging" + "github.com/block/cachew/internal/cache" + "github.com/block/cachew/internal/cache/cachetest" + "github.com/block/cachew/internal/logging" ) func TestTiered(t *testing.T) { diff --git a/internal/config/config.go b/internal/config/config.go index c410a3d..f221e7c 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -11,9 +11,9 @@ import ( "github.com/alecthomas/errors" "github.com/alecthomas/hcl/v2" - "github.com/block/sfptc/internal/cache" - "github.com/block/sfptc/internal/logging" - "github.com/block/sfptc/internal/strategy" + "github.com/block/cachew/internal/cache" + "github.com/block/cachew/internal/logging" + "github.com/block/cachew/internal/strategy" ) type loggingMux struct { diff --git a/internal/httputil/error.go b/internal/httputil/error.go index 42aaade..f21c01c 100644 --- a/internal/httputil/error.go +++ b/internal/httputil/error.go @@ -7,7 +7,7 @@ import ( "github.com/alecthomas/errors" - "github.com/block/sfptc/internal/logging" + "github.com/block/cachew/internal/logging" ) // ErrorResponse creates an error response with the given code and format, and also logs a message. diff --git a/internal/httputil/logging.go b/internal/httputil/logging.go index 2555fb2..8eeae13 100644 --- a/internal/httputil/logging.go +++ b/internal/httputil/logging.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "github.com/block/sfptc/internal/logging" + "github.com/block/cachew/internal/logging" ) func LoggingMiddleware(next http.Handler) http.Handler { diff --git a/internal/strategy/api.go b/internal/strategy/api.go index 599e6ba..ee908f4 100644 --- a/internal/strategy/api.go +++ b/internal/strategy/api.go @@ -8,7 +8,7 @@ import ( "github.com/alecthomas/errors" "github.com/alecthomas/hcl/v2" - "github.com/block/sfptc/internal/cache" + "github.com/block/cachew/internal/cache" ) // ErrNotFound is returned when a strategy is not found. diff --git a/internal/strategy/apiv1.go b/internal/strategy/apiv1.go index 9a9cc75..167f21e 100644 --- a/internal/strategy/apiv1.go +++ b/internal/strategy/apiv1.go @@ -11,8 +11,8 @@ import ( "os" "time" - "github.com/block/sfptc/internal/cache" - "github.com/block/sfptc/internal/logging" + "github.com/block/cachew/internal/cache" + "github.com/block/cachew/internal/logging" ) func init() { diff --git a/internal/strategy/github_releases.go b/internal/strategy/github_releases.go index 0eff0f9..7874712 100644 --- a/internal/strategy/github_releases.go +++ b/internal/strategy/github_releases.go @@ -10,10 +10,10 @@ import ( "github.com/alecthomas/errors" - "github.com/block/sfptc/internal/cache" - "github.com/block/sfptc/internal/httputil" - "github.com/block/sfptc/internal/logging" - "github.com/block/sfptc/internal/strategy/handler" + "github.com/block/cachew/internal/cache" + "github.com/block/cachew/internal/httputil" + "github.com/block/cachew/internal/logging" + "github.com/block/cachew/internal/strategy/handler" ) func init() { diff --git a/internal/strategy/github_releases_test.go b/internal/strategy/github_releases_test.go index ad85e7f..7518a04 100644 --- a/internal/strategy/github_releases_test.go +++ b/internal/strategy/github_releases_test.go @@ -13,9 +13,9 @@ import ( "github.com/alecthomas/assert/v2" - "github.com/block/sfptc/internal/cache" - "github.com/block/sfptc/internal/logging" - "github.com/block/sfptc/internal/strategy" + "github.com/block/cachew/internal/cache" + "github.com/block/cachew/internal/logging" + "github.com/block/cachew/internal/strategy" ) // httpTransportMutex ensures GitHub release tests don't run in parallel diff --git a/internal/strategy/handler/handler.go b/internal/strategy/handler/handler.go index 367b5a0..6628a59 100644 --- a/internal/strategy/handler/handler.go +++ b/internal/strategy/handler/handler.go @@ -11,9 +11,9 @@ import ( "github.com/alecthomas/errors" - "github.com/block/sfptc/internal/cache" - "github.com/block/sfptc/internal/httputil" - "github.com/block/sfptc/internal/logging" + "github.com/block/cachew/internal/cache" + "github.com/block/cachew/internal/httputil" + "github.com/block/cachew/internal/logging" ) // Handler provides a fluent API for creating cache-backed HTTP handlers. diff --git a/internal/strategy/handler/handler_test.go b/internal/strategy/handler/handler_test.go index b82bd6c..52d25f7 100644 --- a/internal/strategy/handler/handler_test.go +++ b/internal/strategy/handler/handler_test.go @@ -13,10 +13,10 @@ import ( "github.com/alecthomas/assert/v2" "github.com/alecthomas/errors" - "github.com/block/sfptc/internal/cache" - "github.com/block/sfptc/internal/httputil" - "github.com/block/sfptc/internal/logging" - "github.com/block/sfptc/internal/strategy/handler" + "github.com/block/cachew/internal/cache" + "github.com/block/cachew/internal/httputil" + "github.com/block/cachew/internal/logging" + "github.com/block/cachew/internal/strategy/handler" ) type testRequest struct { diff --git a/internal/strategy/host.go b/internal/strategy/host.go index 3cbc692..31fedb2 100644 --- a/internal/strategy/host.go +++ b/internal/strategy/host.go @@ -7,9 +7,9 @@ import ( "net/http" "net/url" - "github.com/block/sfptc/internal/cache" - "github.com/block/sfptc/internal/logging" - "github.com/block/sfptc/internal/strategy/handler" + "github.com/block/cachew/internal/cache" + "github.com/block/cachew/internal/logging" + "github.com/block/cachew/internal/strategy/handler" ) func init() { diff --git a/internal/strategy/host_test.go b/internal/strategy/host_test.go index e86e812..1f8442b 100644 --- a/internal/strategy/host_test.go +++ b/internal/strategy/host_test.go @@ -11,9 +11,9 @@ import ( "github.com/alecthomas/assert/v2" - "github.com/block/sfptc/internal/cache" - "github.com/block/sfptc/internal/logging" - "github.com/block/sfptc/internal/strategy" + "github.com/block/cachew/internal/cache" + "github.com/block/cachew/internal/logging" + "github.com/block/cachew/internal/strategy" ) func TestHostCaching(t *testing.T) { diff --git a/scripts/cachew b/scripts/cachew new file mode 120000 index 0000000..d72ba69 --- /dev/null +++ b/scripts/cachew @@ -0,0 +1 @@ +cachewd \ No newline at end of file diff --git a/scripts/sfptcd b/scripts/cachewd similarity index 100% rename from scripts/sfptcd rename to scripts/cachewd diff --git a/scripts/sfptc b/scripts/sfptc deleted file mode 120000 index 83eaee9..0000000 --- a/scripts/sfptc +++ /dev/null @@ -1 +0,0 @@ -sfptcd \ No newline at end of file