本文整理匯總了Golang中github.com/cockroachdb/cockroach/pkg/storage.Store類的典型用法代碼示例。如果您正苦於以下問題:Golang Store類的具體用法?Golang Store怎麽用?Golang Store使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Store類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: verifyRocksDBStats
func verifyRocksDBStats(t *testing.T, s *storage.Store) {
if err := s.ComputeMetrics(context.TODO(), 0); err != nil {
t.Fatal(err)
}
m := s.Metrics()
testcases := []struct {
gauge *metric.Gauge
min int64
}{
{m.RdbBlockCacheHits, 10},
{m.RdbBlockCacheMisses, 0},
{m.RdbBlockCacheUsage, 0},
{m.RdbBlockCachePinnedUsage, 0},
{m.RdbBloomFilterPrefixChecked, 20},
{m.RdbBloomFilterPrefixUseful, 20},
{m.RdbMemtableHits, 0},
{m.RdbMemtableMisses, 0},
{m.RdbMemtableTotalSize, 5000},
{m.RdbFlushes, 1},
{m.RdbCompactions, 0},
{m.RdbTableReadersMemEstimate, 50},
}
for _, tc := range testcases {
if a := tc.gauge.Value(); a < tc.min {
t.Errorf("gauge %s = %d < min %d", tc.gauge.GetName(), a, tc.min)
}
}
}
示例2: createSplitRanges
func createSplitRanges(
store *storage.Store,
) (*roachpb.RangeDescriptor, *roachpb.RangeDescriptor, *roachpb.Error) {
args := adminSplitArgs(roachpb.KeyMin, []byte("b"))
if _, err := client.SendWrapped(context.Background(), rg1(store), &args); err != nil {
return nil, nil, err
}
rangeADesc := store.LookupReplica([]byte("a"), nil).Desc()
rangeBDesc := store.LookupReplica([]byte("c"), nil).Desc()
if bytes.Equal(rangeADesc.StartKey, rangeBDesc.StartKey) {
log.Errorf(context.TODO(), "split ranges keys are equal %q!=%q", rangeADesc.StartKey, rangeBDesc.StartKey)
}
return rangeADesc, rangeBDesc, nil
}