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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
try showing the first 100 volume ids and an extra ...
bingoohuang1f8782a1ed50
diff --git a/weed/topology/data_node.go b/weed/topology/data_node.goindex f6e96e235a..0dccdd0f22 100644--- a/weed/topology/data_node.go+++ b/weed/topology/data_node.go@@ -195,16 +195,11 @@ func (dn *DataNode) ToDataNodeInfo() *master_pb.DataNodeInfo {// GetVolumeIds returns the human readable volume ids limited to count of max 100.func (dn *DataNode) GetVolumeIds() string {- volumesLen := len(dn.volumes)- if volumesLen > 100 {- return "..."- }-- ids := make([]int, 0, volumesLen)+ ids := make([]int, 0, len(dn.volumes))for k := range dn.volumes {ids = append(ids, int(k))}- return util.HumanReadableInts(ids...)+ return util.HumanReadableIntsMax(100, ids...)}diff --git a/weed/util/inits.go b/weed/util/inits.goindex dfbf9da5f6..378878012b 100644--- a/weed/util/inits.go+++ b/weed/util/inits.go@@ -5,6 +5,15 @@ import ("sort")+// HumanReadableIntsMax joins a serials of inits into a smart one like 1-3 5 ... for human readable.+func HumanReadableIntsMax(max int, ids ...int) string {+ if len(ids) <= max {+ return HumanReadableInts(ids...)+ }++ return HumanReadableInts(ids[:max]...) + " ..."+}+// HumanReadableInts joins a serials of inits into a smart one like 1-3 5 7-10 for human readable.func HumanReadableInts(ids ...int) string {sort.Ints(ids)diff --git a/weed/util/inits_test.go b/weed/util/inits_test.goindex f1ccb4f7ba..f2c9b701fc 100644--- a/weed/util/inits_test.go+++ b/weed/util/inits_test.go@@ -5,6 +5,11 @@ import ("testing")+func TestHumanReadableIntsMax(t *testing.T) {+ assert.Equal(t, "1-2 ...", HumanReadableIntsMax(2, 1, 2, 3))+ assert.Equal(t, "1 3 ...", HumanReadableIntsMax(2, 1, 3, 5))+}+func TestHumanReadableInts(t *testing.T) {assert.Equal(t, "1-3", HumanReadableInts(1, 2, 3))assert.Equal(t, "1 3", HumanReadableInts(1, 3))