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
add helper functions
chrisluff479565301f
diff --git a/weed/mq/schema/schema.go b/weed/mq/schema/schema.goindex 5fadf2cc22..ca31ce5349 100644--- a/weed/mq/schema/schema.go+++ b/weed/mq/schema/schema.go@@ -24,3 +24,30 @@ func (s *Schema) GetField(name string) (*schema_pb.Field, bool) {field, ok := s.fieldMap[name]return field, ok}++func TypeToString(t *schema_pb.Type) string {+ switch t.Kind.(type) {+ case *schema_pb.Type_ScalarType:+ switch t.GetScalarType() {+ case schema_pb.ScalarType_BOOL:+ return "bool"+ case schema_pb.ScalarType_INT32:+ return "int32"+ case schema_pb.ScalarType_INT64:+ return "int64"+ case schema_pb.ScalarType_FLOAT:+ return "float"+ case schema_pb.ScalarType_DOUBLE:+ return "double"+ case schema_pb.ScalarType_BYTES:+ return "bytes"+ case schema_pb.ScalarType_STRING:+ return "string"+ }+ case *schema_pb.Type_ListType:+ return "list"+ case *schema_pb.Type_RecordType:+ return "record"+ }+ return "unknown"+}diff --git a/weed/mq/topic/partition.go b/weed/mq/topic/partition.goindex ba1accce10..192af6c987 100644--- a/weed/mq/topic/partition.go+++ b/weed/mq/topic/partition.go@@ -1,6 +1,9 @@package topic-import "github.com/seaweedfs/seaweedfs/weed/pb/mq_pb"+import (+ "fmt"+ "github.com/seaweedfs/seaweedfs/weed/pb/mq_pb"+)const PartitionCount = 4096@@ -81,3 +84,11 @@ func (partition Partition) Overlaps(partition2 Partition) bool {}return true}++func (partition Partition) String() string {+ return fmt.Sprintf("%04d-%04d", partition.RangeStart, partition.RangeStop)+}++func ToString(partition *mq_pb.Partition) string {+ return fmt.Sprintf("%04d-%04d", partition.RangeStart, partition.RangeStop)+}