Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
builds:
- main: ./cmd/sfptc
- main: ./cmd/cachew
binary: sfptc
id: sfptc
env:
Expand All @@ -10,7 +10,7 @@ builds:
goarch:
- amd64
- arm64
- main: ./cmd/sfptcd
- main: ./cmd/cachewd
id: sfptcd
binary: sfptcd
env:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion cmd/sfptc/main.go → cmd/cachew/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions cmd/sfptcd/main.go → cmd/cachewd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/block/sfptc
module github.com/block/cachew

go 1.25.5

Expand Down
2 changes: 1 addition & 1 deletion internal/cache/cachetest/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion internal/cache/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions internal/cache/disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion internal/cache/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions internal/cache/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion internal/cache/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/alecthomas/errors"

"github.com/block/sfptc/internal/logging"
"github.com/block/cachew/internal/logging"
)

func init() {
Expand Down
6 changes: 3 additions & 3 deletions internal/cache/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions internal/cache/remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion internal/cache/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions internal/cache/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion internal/cache/tiered.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions internal/cache/tiered_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/httputil/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion internal/httputil/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/strategy/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions internal/strategy/apiv1.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
8 changes: 4 additions & 4 deletions internal/strategy/github_releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions internal/strategy/github_releases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions internal/strategy/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions internal/strategy/handler/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions internal/strategy/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions internal/strategy/host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions scripts/cachew
File renamed without changes.
1 change: 0 additions & 1 deletion scripts/sfptc

This file was deleted.