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.

storage: register tier backends at the binary composition root (#9989)

Chris Lu5e8152b81c70
diff --git a/weed/command/backends.go b/weed/command/backends.go
new file mode 100644
index 0000000000..6654b18a1d
--- /dev/null
+++ b/weed/command/backends.go
@@ -0,0 +1,5 @@
+package command
+
+// Register the tiered-storage backends here, at the binary's composition root,
+// so library consumers of weed/storage don't pull the backend SDKs.
+import _ "github.com/seaweedfs/seaweedfs/weed/storage/backend/all"
diff --git a/weed/storage/backend/all/all.go b/weed/storage/backend/all/all.go
new file mode 100644
index 0000000000..df77a4ed1d
--- /dev/null
+++ b/weed/storage/backend/all/all.go
@@ -0,0 +1,10 @@
+// Package all registers every tiered-storage backend factory. Binaries that
+// serve or manage tiered volumes blank-import it from their composition root;
+// keeping the registrations out of weed/storage lets library consumers avoid
+// pulling the backend SDKs into their dependency graph.
+package all
+
+import (
+ _ "github.com/seaweedfs/seaweedfs/weed/storage/backend/rclone_backend"
+ _ "github.com/seaweedfs/seaweedfs/weed/storage/backend/s3_backend"
+)
diff --git a/weed/storage/volume_info/volume_info.go b/weed/storage/volume_info/volume_info.go
index 19b1d336e1..78c931af62 100644
--- a/weed/storage/volume_info/volume_info.go
+++ b/weed/storage/volume_info/volume_info.go
@@ -6,8 +6,6 @@ import (
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
- _ "github.com/seaweedfs/seaweedfs/weed/storage/backend/rclone_backend"
- _ "github.com/seaweedfs/seaweedfs/weed/storage/backend/s3_backend"
"github.com/seaweedfs/seaweedfs/weed/util"
jsonpb "google.golang.org/protobuf/encoding/protojson"
)
diff --git a/weed/storage/volume_tier.go b/weed/storage/volume_tier.go
index d398503a38..775db67f3f 100644
--- a/weed/storage/volume_tier.go
+++ b/weed/storage/volume_tier.go
@@ -7,8 +7,6 @@ import (
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
"github.com/seaweedfs/seaweedfs/weed/storage/backend"
- _ "github.com/seaweedfs/seaweedfs/weed/storage/backend/rclone_backend"
- _ "github.com/seaweedfs/seaweedfs/weed/storage/backend/s3_backend"
"github.com/seaweedfs/seaweedfs/weed/storage/needle"
"github.com/seaweedfs/seaweedfs/weed/storage/types"
"github.com/seaweedfs/seaweedfs/weed/storage/volume_info"