You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
752 B

1 year ago
  1. package balancer
  2. import "github.com/seaweedfs/seaweedfs/weed/pb/mq_pb"
  3. func (b *Balancer) LookupOrAllocateTopicPartitions(topic *mq_pb.Topic, publish bool) ([]*mq_pb.BrokerPartitionAssignment, error) {
  4. // TODO lock the topic
  5. // find the topic partitions on the filer
  6. // if the topic is not found
  7. // if the request is_for_publish
  8. // create the topic
  9. // if the request is_for_subscribe
  10. // return error not found
  11. // t := topic.FromPbTopic(request.Topic)
  12. return []*mq_pb.BrokerPartitionAssignment{
  13. {
  14. LeaderBroker: "localhost:17777",
  15. FollowerBrokers: []string{"localhost:17777"},
  16. Partition: &mq_pb.Partition{
  17. RingSize: MaxPartitionCount,
  18. RangeStart: 0,
  19. RangeStop: MaxPartitionCount,
  20. },
  21. },
  22. }, nil
  23. }