github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/kv/kvserver/reports/helpers_test.go (about)

     1  // Copyright 2020 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  package reports
    12  
    13  import (
    14  	"context"
    15  
    16  	"github.com/cockroachdb/cockroach/pkg/config"
    17  )
    18  
    19  // computeConstraintConformanceReport iterates through all the ranges and
    20  // generates the constraint conformance report.
    21  func computeConstraintConformanceReport(
    22  	ctx context.Context,
    23  	rangeStore RangeIterator,
    24  	cfg *config.SystemConfig,
    25  	storeResolver StoreResolver,
    26  ) (ConstraintReport, error) {
    27  	v := makeConstraintConformanceVisitor(ctx, cfg, storeResolver)
    28  	err := visitRanges(ctx, rangeStore, cfg, &v)
    29  	return v.Report(), err
    30  }
    31  
    32  // computeReplicationStatsReport iterates through all the ranges and generates
    33  // the replication stats report.
    34  func computeReplicationStatsReport(
    35  	ctx context.Context, rangeStore RangeIterator, checker nodeChecker, cfg *config.SystemConfig,
    36  ) (RangeReport, error) {
    37  	v := makeReplicationStatsVisitor(ctx, cfg, checker)
    38  	err := visitRanges(ctx, rangeStore, cfg, &v)
    39  	return v.Report(), err
    40  }