Ejemplo n.º 1
0
        internal static TopicMetadata ReadFrom(ByteBuffer buffer, Dictionary <int, Broker> brokers)
        {
            var errorCode     = ApiUtils.ReadShortInRange(buffer, "error code", Tuple.Create((short)-1, short.MaxValue));
            var topic         = ApiUtils.ReadShortString(buffer);
            var numPartitions = ApiUtils.ReadIntInRange(buffer, "number of partitions", Tuple.Create(0, int.MaxValue));

            var partitionsMetadata = new List <PartitionMetadata>(numPartitions);

            for (var i = 0; i < numPartitions; i++)
            {
                var partitionMetadata = PartitionMetadata.ReadFrom(buffer, brokers);
                partitionsMetadata.Add(partitionMetadata);
            }

            return(new TopicMetadata(topic, partitionsMetadata, errorCode));
        }
Ejemplo n.º 2
0
 protected bool Equals(PartitionMetadata other)
 {
     return this.PartitionId == other.PartitionId && Equals(this.Leader, other.Leader) && this.Replicas.SequenceEqual(other.Replicas) && this.Isr.SequenceEqual(other.Isr) && this.ErrorCode == other.ErrorCode;
 }
Ejemplo n.º 3
0
 protected bool Equals(PartitionMetadata other)
 {
     return(this.PartitionId == other.PartitionId && Equals(this.Leader, other.Leader) && this.Replicas.SequenceEqual(other.Replicas) && this.Isr.SequenceEqual(other.Isr) && this.ErrorCode == other.ErrorCode);
 }