(topic string, partitionSet partitionType)
| 852 | } |
| 853 | |
| 854 | func (client *client) setPartitionCache(topic string, partitionSet partitionType) []int32 { |
| 855 | partitions := client.metadata[topic] |
| 856 | |
| 857 | if partitions == nil { |
| 858 | return nil |
| 859 | } |
| 860 | |
| 861 | ret := make([]int32, 0, len(partitions)) |
| 862 | for _, partition := range partitions { |
| 863 | if partitionSet == writablePartitions && errors.Is(partition.Err, ErrLeaderNotAvailable) { |
| 864 | continue |
| 865 | } |
| 866 | ret = append(ret, partition.ID) |
| 867 | } |
| 868 | |
| 869 | sort.Sort(int32Slice(ret)) |
| 870 | return ret |
| 871 | } |
| 872 | |
| 873 | func (client *client) cachedLeader(topic string, partitionID int32) (*Broker, int32, error) { |
| 874 | client.lock.RLock() |
no test coverage detected