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.

s3tables: clean up unused code and improve error response formatting

Chris Lu08ee4e37d83b
diff --git a/weed/s3api/s3api_tables.go b/weed/s3api/s3api_tables.go
index 0c420be274..1a0f0a86f0 100644
--- a/weed/s3api/s3api_tables.go
+++ b/weed/s3api/s3api_tables.go
@@ -45,14 +45,9 @@ type S3TablesApiServer struct {
// NewS3TablesApiServer creates a new S3 Tables API server
func NewS3TablesApiServer(s3a *S3ApiServer) *S3TablesApiServer {
- filerAddr := ""
- if len(s3a.option.Filers) > 0 {
- filerAddr = string(s3a.option.Filers[0])
- }
-
return &S3TablesApiServer{
s3a: s3a,
- handler: s3tables.NewS3TablesHandler(filerAddr),
+ handler: s3tables.NewS3TablesHandler(),
}
}
diff --git a/weed/s3api/s3tables/handler.go b/weed/s3api/s3tables/handler.go
index b2b23a9d80..dd565b1d52 100644
--- a/weed/s3api/s3tables/handler.go
+++ b/weed/s3api/s3tables/handler.go
@@ -24,17 +24,15 @@ const (
// S3TablesHandler handles S3 Tables API requests
type S3TablesHandler struct {
- filerAddress string
- region string
- accountID string
+ region string
+ accountID string
}
// NewS3TablesHandler creates a new S3 Tables handler
-func NewS3TablesHandler(filerAddress string) *S3TablesHandler {
+func NewS3TablesHandler() *S3TablesHandler {
return &S3TablesHandler{
- filerAddress: filerAddress,
- region: DefaultRegion,
- accountID: DefaultAccountID,
+ region: DefaultRegion,
+ accountID: DefaultAccountID,
}
}
@@ -187,11 +185,11 @@ func (h *S3TablesHandler) writeJSON(w http.ResponseWriter, status int, data inte
func (h *S3TablesHandler) writeError(w http.ResponseWriter, status int, code, message string) {
w.Header().Set("Content-Type", "application/x-amz-json-1.1")
w.WriteHeader(status)
- err := map[string]interface{}{
+ errorResponse := map[string]interface{}{
"__type": code,
"message": message,
}
- json.NewEncoder(w).Encode(err)
+ json.NewEncoder(w).Encode(errorResponse)
}
// ARN generation helpers