From 8918348dd67ab0f2e10680c48939a9e25519ce4a Mon Sep 17 00:00:00 2001 From: Hanzo AI Date: Wed, 3 Jun 2026 10:04:07 -0700 Subject: [PATCH] =?UTF-8?q?zapdb:=20swap=20minio-go/v7=20=E2=86=92=20hanzo?= =?UTF-8?q?s3/go-sdk=20v1.0.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Canonical S3 SDK across the stack is the Hanzo S3 fork at github.com/hanzos3/go-sdk (package `s3`, not `minio`). The fork already had `module github.com/hanzos3/go-sdk` and `package s3` landed on its `main` branch (5c5ecda); tagged v1.0.2 with the Go 1.26.3 security bump on top of v1.0.1. Replicator changes: - import: `s3 "github.com/hanzos3/go-sdk"` (alias for clarity since package name `s3` differs from last path segment `go-sdk`) - field `Replicator.s3` → `Replicator.cli` so the field name no longer shadows the package qualifier in struct literals - all `minio.X` → `s3.X` (Client, New, Options, PutObject, GetObject, ListObjects, *Options types) No behavioral changes. All Replicator tests pass. --- go.mod | 4 +--- go.sum | 4 ++-- replicate.go | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 48e6f29..ea074ff 100644 --- a/go.mod +++ b/go.mod @@ -7,9 +7,9 @@ require ( github.com/dgraph-io/ristretto/v2 v2.2.0 github.com/dustin/go-humanize v1.0.1 github.com/google/flatbuffers v25.2.10+incompatible + github.com/hanzos3/go-sdk v1.0.2 github.com/klauspost/compress v1.18.2 github.com/luxfi/age v1.4.0 - github.com/minio/minio-go/v7 v7.0.100 github.com/spf13/cobra v1.9.1 github.com/stretchr/testify v1.10.0 go.opentelemetry.io/contrib/zpages v0.62.0 @@ -45,5 +45,3 @@ require ( golang.org/x/text v0.32.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - - diff --git a/go.sum b/go.sum index aa72acf..c773c4b 100644 --- a/go.sum +++ b/go.sum @@ -26,6 +26,8 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hanzos3/go-sdk v1.0.2 h1:EOJQGVnwclkzIyRJyWqtqmA2muyaSsF4y+7KYC4Vhdw= +github.com/hanzos3/go-sdk v1.0.2/go.mod h1:oOp/rYVDpZIv2Mn3ZacAUiIahRNOi+V/vlGukvIcuI0= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/klauspost/compress v1.18.2 h1:iiPHWW0YrcFgpBYhsA6D1+fqHssJscY/Tm/y2Uqnapk= @@ -45,8 +47,6 @@ github.com/minio/crc64nvme v1.1.1 h1:8dwx/Pz49suywbO+auHCBpCtlW1OfpcLN7wYgVR6wAI github.com/minio/crc64nvme v1.1.1/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= -github.com/minio/minio-go/v7 v7.0.100 h1:ShkWi8Tyj9RtU57OQB2HIXKz4bFgtVib0bbT1sbtLI8= -github.com/minio/minio-go/v7 v7.0.100/go.mod h1:EtGNKtlX20iL2yaYnxEigaIvj0G0GwSDnifnG8ClIdw= github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/replicate.go b/replicate.go index c823b09..7aee5fd 100644 --- a/replicate.go +++ b/replicate.go @@ -17,9 +17,9 @@ import ( "sync" "time" + s3 "github.com/hanzos3/go-sdk" + "github.com/hanzos3/go-sdk/pkg/credentials" "github.com/luxfi/age" - "github.com/minio/minio-go/v7" - "github.com/minio/minio-go/v7/pkg/credentials" ) // ReplicatorConfig configures encrypted streaming replication to S3. @@ -73,7 +73,7 @@ func (c *ReplicatorConfig) maxPendingWrites() int { type Replicator struct { db *DB cfg ReplicatorConfig - s3 *minio.Client + cli *s3.Client log Logger mu sync.Mutex stop context.CancelFunc @@ -84,7 +84,7 @@ type Replicator struct { // NewReplicator creates a Replicator. Call Start to begin replication. func NewReplicator(db *DB, cfg ReplicatorConfig) (*Replicator, error) { - s3, err := minio.New(cfg.Endpoint, &minio.Options{ + cli, err := s3.New(cfg.Endpoint, &s3.Options{ Creds: credentials.NewStaticV4(cfg.AccessKey, cfg.SecretKey, ""), Region: cfg.Region, Secure: cfg.UseSSL, @@ -101,7 +101,7 @@ func NewReplicator(db *DB, cfg ReplicatorConfig) (*Replicator, error) { return &Replicator{ db: db, cfg: cfg, - s3: s3, + cli: cli, log: log, }, nil } @@ -169,7 +169,7 @@ func (r *Replicator) Incremental(ctx context.Context) error { } key := r.incKey(maxVersion) - _, err = r.s3.PutObject(ctx, r.cfg.Bucket, key, body, size, minio.PutObjectOptions{ + _, err = r.cli.PutObject(ctx, r.cfg.Bucket, key, body, size, s3.PutObjectOptions{ ContentType: "application/octet-stream", }) if err != nil { @@ -209,7 +209,7 @@ func (r *Replicator) Snapshot(ctx context.Context) error { } key := r.snapKey(time.Now()) - _, err = r.s3.PutObject(ctx, r.cfg.Bucket, key, body, size, minio.PutObjectOptions{ + _, err = r.cli.PutObject(ctx, r.cfg.Bucket, key, body, size, s3.PutObjectOptions{ ContentType: "application/octet-stream", }) if err != nil { @@ -232,7 +232,7 @@ func (r *Replicator) Restore(ctx context.Context) error { // Find latest snapshot. snapPrefix := path.Join(r.cfg.Path, "snap") + "/" latestSnap := "" - for obj := range r.s3.ListObjects(ctx, r.cfg.Bucket, minio.ListObjectsOptions{ + for obj := range r.cli.ListObjects(ctx, r.cfg.Bucket, s3.ListObjectsOptions{ Prefix: snapPrefix, Recursive: true, }) { @@ -263,7 +263,7 @@ func (r *Replicator) Restore(ctx context.Context) error { version uint64 } var incs []incEntry - for obj := range r.s3.ListObjects(ctx, r.cfg.Bucket, minio.ListObjectsOptions{ + for obj := range r.cli.ListObjects(ctx, r.cfg.Bucket, s3.ListObjectsOptions{ Prefix: incPrefix, Recursive: true, }) { @@ -291,7 +291,7 @@ func (r *Replicator) Restore(ctx context.Context) error { } func (r *Replicator) downloadAndLoad(ctx context.Context, key string) error { - obj, err := r.s3.GetObject(ctx, r.cfg.Bucket, key, minio.GetObjectOptions{}) + obj, err := r.cli.GetObject(ctx, r.cfg.Bucket, key, s3.GetObjectOptions{}) if err != nil { return fmt.Errorf("get %s: %w", key, err) }