@@ -547,30 +547,6 @@ func (ns *nodeStats) UnmarshalJSON(data []byte) error {
547
547
}
548
548
549
549
// Clone returns a deep copy of the nodeStats DetailedMetrics object
550
- // func (ns *nodeStats) cloneDetailedMetrics() *amap.Map[string, *amap.Map[commandType, *commandMetric]] {
551
- // cloned := amap.New[string, *amap.Map[commandType, *commandMetric]](0)
552
-
553
- // for _, namespace := range ns.DetailedMetrics.Keys() {
554
- // for _, command := range ns.DetailedMetrics.Get(namespace).Keys() {
555
- // cloned.UpdateOrInsertFn(namespace, func(clonedInner *amap.Map[commandType, *commandMetric]) *amap.Map[commandType, *commandMetric] {
556
- // clonedInner.UpdateOrInsertFn(command, func(clonedCommand *commandMetric) *commandMetric {
557
- // clonedCommand.ConnectionAq = *ns.DetailedMetrics.Get(namespace).Get(command).ConnectionAq.Clone()
558
- // clonedCommand.Latency = *ns.DetailedMetrics.Get(namespace).Get(command).Latency.Clone()
559
- // clonedCommand.Parsing = *ns.DetailedMetrics.Get(namespace).Get(command).Parsing.Clone()
560
- // clonedCommand.BytesSent = *ns.DetailedMetrics.Get(namespace).Get(command).BytesSent.Clone()
561
- // return clonedCommand
562
- // }, func() *commandMetric {
563
- // return ns.newCommandMetric()
564
- // })
565
- // return clonedInner
566
- // }, func() *amap.Map[commandType, *commandMetric] {
567
- // return amap.NewWithValue(command, ns.newCommandMetric())
568
- // })
569
- // }
570
- // }
571
-
572
- // return cloned
573
- // }
574
550
func (ns * nodeStats ) cloneDetailedMetrics () * amap.Map [string , * amap.Map [commandType , * commandMetric ]] {
575
551
// allocate the top‐level map once
576
552
cloned := amap.New [string , * amap.Map [commandType , * commandMetric ]](0 )
@@ -609,27 +585,6 @@ func (ns *nodeStats) cloneDetailedMetrics() *amap.Map[string, *amap.Map[commandT
609
585
}
610
586
611
587
// Clone returns a deep copy of the nodeStats DetailedResultCodes object
612
- // func (ns *nodeStats) cloneDetailedResultCodeCounts() *amap.Map[string, *amap.Map[commandType, *commandResultCodeMetric]] {
613
- // cloned := amap.New[string, *amap.Map[commandType, *commandResultCodeMetric]](0)
614
-
615
- // for _, namespace := range ns.DetailedResultCodeCounts.Keys() {
616
- // for _, command := range ns.DetailedResultCodeCounts.Get(namespace).Keys() {
617
- // cloned.UpdateOrInsertFn(namespace, func(clonedInner *amap.Map[commandType, *commandResultCodeMetric]) *amap.Map[commandType, *commandResultCodeMetric] {
618
- // clonedInner.UpdateOrInsertFn(command, func(clonedCommand *commandResultCodeMetric) *commandResultCodeMetric {
619
- // clonedCommand.ResultCodeCounts = *ns.DetailedResultCodeCounts.Get(namespace).Get(command).ResultCodeCounts.CloneMap()
620
- // return clonedCommand
621
- // }, func() *commandResultCodeMetric {
622
- // return ns.newCommandResultCodeMetric()
623
- // })
624
- // return clonedInner
625
- // }, func() *amap.Map[commandType, *commandResultCodeMetric] {
626
- // return amap.NewWithValue(command, ns.newCommandResultCodeMetric())
627
- // })
628
- // }
629
- // }
630
-
631
- // return cloned
632
- // }
633
588
func (ns * nodeStats ) cloneDetailedResultCodeCounts () * amap.Map [string , * amap.Map [commandType , * commandResultCodeMetric ]] {
634
589
cloned := amap.New [string , * amap.Map [commandType , * commandResultCodeMetric ]](0 )
635
590
@@ -659,30 +614,6 @@ func (ns *nodeStats) cloneDetailedResultCodeCounts() *amap.Map[string, *amap.Map
659
614
}
660
615
661
616
// Clone and reset returns a deep copy of the nodeStats DetailedMetrics object and resets the original
662
- // func (n *nodeStats) cloneAndResetDetailedMetrics() *amap.Map[string, *amap.Map[commandType, *commandMetric]] {
663
- // cloned := amap.New[string, *amap.Map[commandType, *commandMetric]](0)
664
-
665
- // for _, namespace := range n.DetailedMetrics.Keys() {
666
- // for _, ct := range n.DetailedMetrics.Get(namespace).Keys() {
667
- // cloned.UpdateOrInsertFn(namespace, func(old *amap.Map[commandType, *commandMetric]) *amap.Map[commandType, *commandMetric] {
668
- // old.UpdateOrInsertFn(ct, func(od *commandMetric) *commandMetric {
669
- // od.ConnectionAq = *n.DetailedMetrics.Get(namespace).Get(ct).ConnectionAq.CloneAndReset()
670
- // od.Latency = *n.DetailedMetrics.Get(namespace).Get(ct).Latency.CloneAndReset()
671
- // od.Parsing = *n.DetailedMetrics.Get(namespace).Get(ct).Parsing.CloneAndReset()
672
- // od.BytesSent = *n.DetailedMetrics.Get(namespace).Get(ct).BytesSent.CloneAndReset()
673
- // return od
674
- // }, func() *commandMetric {
675
- // return n.newCommandMetric()
676
- // })
677
- // return old
678
- // }, func() *amap.Map[commandType, *commandMetric] {
679
- // return amap.NewWithValue(ct, n.newCommandMetric())
680
- // })
681
- // }
682
- // }
683
-
684
- // return cloned
685
- // }
686
617
func (n * nodeStats ) cloneAndResetDetailedMetrics () * amap.Map [string , * amap.Map [commandType , * commandMetric ]] {
687
618
// one allocation for the top-level map
688
619
cloned := amap.New [string , * amap.Map [commandType , * commandMetric ]](0 )
0 commit comments