MCPcopy
hub / github.com/IBM/sarama / setPartitionCache

Method setPartitionCache

client.go:854–871  ·  view source on GitHub ↗
(topic string, partitionSet partitionType)

Source from the content-addressed store, hash-verified

852}
853
854func (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
873func (client *client) cachedLeader(topic string, partitionID int32) (*Broker, int32, error) {
874 client.lock.RLock()

Callers 1

updateMetadataMethod · 0.95

Calls 2

int32SliceTypeAlias · 0.85
IsMethod · 0.80

Tested by

no test coverage detected