github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/storage/enginepb/mvcc3.go (about) 1 // Copyright 2017 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 enginepb 12 13 import "fmt" 14 15 // ToStats converts the receiver to an MVCCStats. 16 func (ms *MVCCStatsDelta) ToStats() MVCCStats { 17 return MVCCStats(*ms) 18 } 19 20 // ToStatsDelta converts the receiver to an MVCCStatsDelta. 21 func (ms *MVCCStats) ToStatsDelta() MVCCStatsDelta { 22 return MVCCStatsDelta(*ms) 23 } 24 25 // ToStats converts the receiver to an MVCCStats. 26 func (ms *MVCCPersistentStats) ToStats() MVCCStats { 27 return MVCCStats(*ms) 28 } 29 30 // ToPersistentStats converts the receiver to an MVCCPersistentStats. 31 func (ms *MVCCStats) ToPersistentStats() MVCCPersistentStats { 32 return MVCCPersistentStats(*ms) 33 } 34 35 // MustSetValue is like SetValue, except it resets the enum and panics if the 36 // provided value is not a valid variant type. 37 func (op *MVCCLogicalOp) MustSetValue(value interface{}) { 38 op.Reset() 39 if !op.SetValue(value) { 40 panic(fmt.Sprintf("%T excludes %T", op, value)) 41 } 42 }