diff options
Diffstat (limited to 'weed/mq/topic/partition.go')
| -rw-r--r-- | weed/mq/topic/partition.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/weed/mq/topic/partition.go b/weed/mq/topic/partition.go index cee512ab5..658ec85c4 100644 --- a/weed/mq/topic/partition.go +++ b/weed/mq/topic/partition.go @@ -2,8 +2,9 @@ package topic import ( "fmt" - "github.com/seaweedfs/seaweedfs/weed/pb/schema_pb" "time" + + "github.com/seaweedfs/seaweedfs/weed/pb/schema_pb" ) const PartitionCount = 4096 @@ -40,6 +41,13 @@ func (partition Partition) Equals(other Partition) bool { return true } +// LogicalEquals compares only the partition boundaries (RangeStart, RangeStop) +// This is useful when comparing partitions that may have different timestamps or ring sizes +// but represent the same logical partition range +func (partition Partition) LogicalEquals(other Partition) bool { + return partition.RangeStart == other.RangeStart && partition.RangeStop == other.RangeStop +} + func FromPbPartition(partition *schema_pb.Partition) Partition { return Partition{ RangeStart: partition.RangeStart, |
