partition.go 646 B

1234567891011121314151617181920212223242526272829303132
  1. package topic
  2. import "github.com/seaweedfs/seaweedfs/weed/pb/mq_pb"
  3. const PartitionCount = 4096
  4. type Partition struct {
  5. RangeStart int32
  6. RangeStop int32 // exclusive
  7. RingSize int32
  8. }
  9. func (partition Partition) Equals(other Partition) bool {
  10. if partition.RangeStart != other.RangeStart {
  11. return false
  12. }
  13. if partition.RangeStop != other.RangeStop {
  14. return false
  15. }
  16. if partition.RingSize != other.RingSize {
  17. return false
  18. }
  19. return true
  20. }
  21. func FromPbPartition(partition *mq_pb.Partition) Partition {
  22. return Partition{
  23. RangeStart: partition.RangeStart,
  24. RangeStop: partition.RangeStop,
  25. RingSize: partition.RingSize,
  26. }
  27. }