Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

chore(weed/s3api): prune dead code (#10462)

Lars Lehtonen2bea4dd610fe
diff --git a/weed/s3api/auth_credentials.go b/weed/s3api/auth_credentials.go
index bf7eca7f9f..1f98f11ee9 100644
--- a/weed/s3api/auth_credentials.go
+++ b/weed/s3api/auth_credentials.go
@@ -57,7 +57,6 @@ type IdentityAccessManagement struct {
hashes map[string]*sync.Pool
hashCounters map[string]*int32
identityAnonymous *Identity
- hashMu sync.RWMutex
domain string
externalHost string // pre-computed host for S3 signature verification (from ExternalUrl)
isAuthEnabled bool
diff --git a/weed/s3api/custom_types.go b/weed/s3api/custom_types.go
index 3d7a06ffa4..0e147dced1 100644
--- a/weed/s3api/custom_types.go
+++ b/weed/s3api/custom_types.go
@@ -5,8 +5,6 @@ import (
"github.com/seaweedfs/seaweedfs/weed/s3api/s3err"
)
-const s3TimeFormat = "2006-01-02T15:04:05.999Z07:00"
-
// ConditionalHeaderResult holds the result of conditional header checking
type ConditionalHeaderResult struct {
ErrorCode s3err.ErrorCode
diff --git a/weed/s3api/s3_iam_middleware.go b/weed/s3api/s3_iam_middleware.go
index 5c2bee18f4..42dd27d319 100644
--- a/weed/s3api/s3_iam_middleware.go
+++ b/weed/s3api/s3_iam_middleware.go
@@ -516,12 +516,6 @@ func (s3a *S3ApiServer) SetIAMIntegration(iamManager *integration.IAMManager) {
}
}
-// EnhancedS3ApiServer extends S3ApiServer with IAM integration
-type EnhancedS3ApiServer struct {
- *S3ApiServer
- iamIntegration IAMIntegration
-}
-
// OIDCIdentity represents an identity validated through OIDC
type OIDCIdentity struct {
UserID string
diff --git a/weed/s3api/s3_sse_kms.go b/weed/s3api/s3_sse_kms.go
index 25f9113465..47e2dd8e52 100644
--- a/weed/s3api/s3_sse_kms.go
+++ b/weed/s3api/s3_sse_kms.go
@@ -12,7 +12,6 @@ import (
"fmt"
"io"
"net/http"
- "regexp"
"sort"
"strings"
"time"
@@ -24,12 +23,6 @@ import (
"github.com/seaweedfs/seaweedfs/weed/s3api/s3err"
)
-// Compiled regex patterns for KMS key validation
-var (
- uuidRegex = regexp.MustCompile(`^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`)
- arnRegex = regexp.MustCompile(`^arn:aws:kms:[a-z0-9-]+:\d{12}:(key|alias)/.+$`)
-)
-
// SSEKMSKey contains the metadata for an SSE-KMS encrypted object
type SSEKMSKey struct {
KeyID string // The KMS key ID used
diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go
index 8ac5db12d9..dee0fb0cb6 100644
--- a/weed/s3api/s3api_object_handlers.go
+++ b/weed/s3api/s3api_object_handlers.go
@@ -33,17 +33,6 @@ import (
"google.golang.org/grpc/status"
)
-// corsHeaders defines the CORS headers that need to be preserved
-// Package-level constant to avoid repeated allocations
-var corsHeaders = []string{
- "Access-Control-Allow-Origin",
- "Access-Control-Allow-Methods",
- "Access-Control-Allow-Headers",
- "Access-Control-Expose-Headers",
- "Access-Control-Max-Age",
- "Access-Control-Allow-Credentials",
-}
-
// zeroBuf is a reusable buffer of zero bytes for padding operations
// Package-level to avoid per-call allocations in writeZeroBytes
var zeroBuf = make([]byte, 32*1024)
@@ -2998,15 +2987,6 @@ type MultipartSSEReader struct {
readers []io.Reader
}
-// SSERangeReader applies range logic to an underlying reader
-type SSERangeReader struct {
- reader io.Reader
- offset int64 // bytes to skip from the beginning
- remaining int64 // bytes remaining to read (-1 for unlimited)
- skipped int64 // bytes already skipped
- skipBuf []byte // reusable buffer for skipping bytes (avoids per-call allocation)
-}
-
// NewMultipartSSEReader creates a new multipart reader that can properly close all underlying readers
func NewMultipartSSEReader(readers []io.Reader) *MultipartSSEReader {
return &MultipartSSEReader{
@@ -3117,7 +3097,7 @@ func (s3a *S3ApiServer) buildRemoteObjectPath(bucket, object string) (dir, name
}
// doCacheRemoteObject calls the filer's CacheRemoteObjectToLocalCluster gRPC endpoint.
-// This is the core caching function used by both cacheRemoteObjectWithDedup and cacheRemoteObjectForStreaming.
+// This is the core caching function used by cacheRemoteObjectForStreaming.
func (s3a *S3ApiServer) doCacheRemoteObject(ctx context.Context, dir, name string) (*filer_pb.Entry, error) {
var cachedEntry *filer_pb.Entry
err := s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {
@@ -3136,36 +3116,6 @@ func (s3a *S3ApiServer) doCacheRemoteObject(ctx context.Context, dir, name strin
return cachedEntry, err
}
-// cacheRemoteObjectWithDedup caches a remote-only object to the local cluster.
-// The filer server handles singleflight deduplication, so all clients (S3, HTTP, Hadoop) benefit.
-// On cache error, returns the original entry (will retry in streamFromVolumeServers).
-// Uses a bounded timeout to avoid blocking requests indefinitely.
-func (s3a *S3ApiServer) cacheRemoteObjectWithDedup(ctx context.Context, bucket, object string, entry *filer_pb.Entry) *filer_pb.Entry {
- const cacheTimeout = 30 * time.Second
- cacheCtx, cancel := context.WithTimeout(ctx, cacheTimeout)
- defer cancel()
-
- dir, name := s3a.buildRemoteObjectPath(bucket, object)
- glog.V(2).Infof("cacheRemoteObjectWithDedup: caching %s/%s (remote size: %d)", bucket, object, entry.RemoteEntry.RemoteSize)
-
- cachedEntry, err := s3a.doCacheRemoteObject(cacheCtx, dir, name)
- if err != nil {
- if errors.Is(err, context.DeadlineExceeded) {
- glog.V(1).Infof("cacheRemoteObjectWithDedup: timeout caching %s/%s after %v (will retry in streaming)", bucket, object, cacheTimeout)
- } else {
- glog.Warningf("cacheRemoteObjectWithDedup: failed to cache %s/%s: %v (will retry in streaming)", bucket, object, err)
- }
- return entry
- }
-
- if cachedEntry != nil && len(cachedEntry.GetChunks()) > 0 {
- glog.V(1).Infof("cacheRemoteObjectWithDedup: successfully cached %s/%s (%d chunks)", bucket, object, len(cachedEntry.GetChunks()))
- entry.Chunks = cachedEntry.Chunks
- }
-
- return entry
-}
-
func (s3a *S3ApiServer) buildVersionedRemoteObjectPath(bucket, object, versionId string) (dir, name string) {
if versionId != "" && versionId != "null" {
normalizedObject := s3_constants.NormalizeObjectKey(object)
diff --git a/weed/s3api/s3api_sosapi.go b/weed/s3api/s3api_sosapi.go
index 673b60993f..e0594a6dcf 100644
--- a/weed/s3api/s3api_sosapi.go
+++ b/weed/s3api/s3api_sosapi.go
@@ -36,9 +36,6 @@ const (
// sosAPICapacityXML is the path to the capacity information XML file.
sosAPICapacityXML = sosAPISystemFolder + "/capacity.xml"
- // sosAPIClientUserAgent is a substring to detect SOSAPI-compatible backup clients.
- sosAPIClientUserAgent = "APN/1.0 Veeam/1.0"
-
// sosAPIProtocolVersion is the SOSAPI protocol version supported.
sosAPIProtocolVersion = `"1.0"`