refactor(shardnode): replace shardnode.Blob with commom.Blob

with #22357426

Signed-off-by: xiejian <xiejian3@oppo.com>
This commit is contained in:
xiejian 2024-09-23 16:36:16 +08:00 committed by slasher
parent 0e5d3eb8a1
commit 4e563e095e
7 changed files with 133 additions and 333 deletions

View File

@ -114,6 +114,7 @@ func (m *Location) GetSlices() []Slice {
type Blob struct {
Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Location Location `protobuf:"bytes,2,opt,name=location,proto3" json:"location"`
Sealed bool `protobuf:"varint,3,opt,name=sealed,proto3" json:"sealed,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -166,6 +167,13 @@ func (m *Blob) GetLocation() Location {
return Location{}
}
func (m *Blob) GetSealed() bool {
if m != nil {
return m.Sealed
}
return false
}
type Slice struct {
MinSliceID BlobID `protobuf:"varint,1,opt,name=min_slice_id,json=minSliceId,proto3,casttype=BlobID" json:"min_bid"`
Vid Vid `protobuf:"varint,2,opt,name=vid,proto3,casttype=Vid" json:"vid,omitempty"`
@ -238,34 +246,35 @@ func init() {
func init() { proto.RegisterFile("blob.proto", fileDescriptor_6903d1e8a20272e8) }
var fileDescriptor_6903d1e8a20272e8 = []byte{
// 430 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0x41, 0x8b, 0xd3, 0x40,
0x14, 0xc7, 0xcd, 0x26, 0xed, 0xa6, 0x6f, 0xb7, 0x20, 0xc3, 0x22, 0x71, 0xc1, 0x4e, 0xa9, 0x82,
0x3d, 0x48, 0x02, 0xeb, 0x49, 0xf6, 0x96, 0xad, 0x87, 0xa0, 0x7b, 0x99, 0x05, 0x11, 0x2f, 0x65,
0x33, 0x33, 0xd6, 0x81, 0x24, 0x23, 0x4d, 0xea, 0xc1, 0x8b, 0x5f, 0x6f, 0x8f, 0x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 0x0f, 0x86, 0x9e, 0x5a, 0x2a,
0x53, 0xa2, 0x33, 0xd4, 0xb7, 0xc2, 0xd3, 0x35, 0x83, 0x62, 0x04, 0x04, 0x79, 0x02, 0xee, 0x57,
0x25, 0x86, 0x03, 0x9f, 0x76, 0x86, 0xba, 0xef, 0x95, 0x60, 0xb6, 0x46, 0x2e, 0x60, 0xc2, 0x75,
0x53, 0xd6, 0xa8, 0x60, 0xc6, 0xfa, 0x24, 0xb9, 0x7c, 0x68, 0xe7, 0xce, 0xcf, 0x76, 0xee, 0xfc,
0x6e, 0xe7, 0xce, 0xc7, 0x20, 0x8a, 0x6f, 0xf0, 0x4f, 0x32, 0x1f, 0x3f, 0xaf, 0xfe, 0x04, 0x00,
0x00, 0xff, 0xff, 0x18, 0x2d, 0xf0, 0x8f, 0xc0, 0x02, 0x00, 0x00,
}
func (m *Location) Marshal() (dAtA []byte, err error) {
@ -358,6 +367,16 @@ func (m *Blob) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if m.Sealed {
i--
if m.Sealed {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x18
}
{
size, err := m.Location.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
@ -476,6 +495,9 @@ func (m *Blob) Size() (n int) {
}
l = m.Location.Size()
n += 1 + l + sovBlob(uint64(l))
if m.Sealed {
n += 2
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
@ -785,6 +807,26 @@ func (m *Blob) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Sealed", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBlob
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Sealed = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipBlob(dAtA[iNdEx:])

View File

@ -35,6 +35,7 @@ message Location {
message Blob {
bytes name = 1;
Location location = 2 [(gogoproto.nullable) = false];
bool sealed = 3;
}
message Slice {

View File

@ -25,7 +25,6 @@ import (
"github.com/cubefs/cubefs/blobstore/common/proto"
"github.com/cubefs/cubefs/blobstore/common/rpc2"
"github.com/cubefs/cubefs/blobstore/shardnode/catalog/allocator"
shardnodeproto "github.com/cubefs/cubefs/blobstore/shardnode/proto"
"github.com/cubefs/cubefs/blobstore/shardnode/storage"
)
@ -171,22 +170,20 @@ func (s *Space) CreateBlob(ctx context.Context, req *shardnode.CreateBlobArgs) (
return
}
b := shardnodeproto.Blob{
Blob: proto.Blob{
Name: req.Name,
Location: proto.Location{
ClusterID: s.clusterID,
CodeMode: req.CodeMode,
Size_: req.Size_,
SliceSize: req.SliceSize,
Crc: 0,
Slices: slices,
},
b := proto.Blob{
Name: req.Name,
Location: proto.Location{
ClusterID: s.clusterID,
CodeMode: req.CodeMode,
Size_: req.Size_,
SliceSize: req.SliceSize,
Crc: 0,
Slices: slices,
},
Sealed: false,
}
key := s.generateSpaceKey(b.Blob.GetName())
key := s.generateSpaceKey(b.GetName())
kv, err := storage.InitKV(key, &io.LimitedReader{R: rpc2.Codec2Reader(&b), N: int64(b.Size())})
if err != nil {
return
@ -199,7 +196,7 @@ func (s *Space) CreateBlob(ctx context.Context, req *shardnode.CreateBlobArgs) (
return
}
resp.Blob = b.Blob
resp.Blob = b
return
}
@ -219,14 +216,14 @@ func (s *Space) GetBlob(ctx context.Context, req *shardnode.GetBlobArgs) (resp s
return
}
inBlob := shardnodeproto.Blob{}
if err = inBlob.Unmarshal(vg.Value()); err != nil {
b := proto.Blob{}
if err = b.Unmarshal(vg.Value()); err != nil {
vg.Close()
return
}
vg.Close()
resp.Blob = inBlob.Blob
resp.Blob = b
return
}
@ -259,7 +256,7 @@ func (s *Space) SealBlob(ctx context.Context, req *shardnode.SealBlobArgs) error
return err
}
b := shardnodeproto.Blob{}
b := proto.Blob{}
if err = b.Unmarshal(vg.Value()); err != nil {
vg.Close()
return err
@ -284,11 +281,11 @@ func (s *Space) ListBlob(ctx context.Context, h shardnode.ShardOpHeader, prefix,
return
}
rangeFunc := func(data []byte) error {
inBlob := shardnodeproto.Blob{}
if err = inBlob.Unmarshal(data); err != nil {
b := proto.Blob{}
if err = b.Unmarshal(data); err != nil {
return err
}
blobs = append(blobs, inBlob.Blob)
blobs = append(blobs, b)
return nil
}
nextMarker, err = shard.List(ctx, storage.OpHeader{

View File

@ -32,7 +32,6 @@ import (
"github.com/cubefs/cubefs/blobstore/common/rpc2"
"github.com/cubefs/cubefs/blobstore/shardnode/catalog/allocator"
"github.com/cubefs/cubefs/blobstore/shardnode/mock"
proto2 "github.com/cubefs/cubefs/blobstore/shardnode/proto"
"github.com/cubefs/cubefs/blobstore/shardnode/storage"
"github.com/cubefs/cubefs/blobstore/util/errors"
)
@ -167,7 +166,7 @@ func TestSpace_Blob(t *testing.T) {
require.Nil(t, err)
require.NotNil(t, ret.Blob.Location)
blobBytes, err := (&proto2.Blob{Blob: ret.Blob}).Marshal()
blobBytes, err := ret.Blob.Marshal()
require.Nil(t, err)
// get
@ -204,31 +203,29 @@ func TestKey(t *testing.T) {
func TestBlob(t *testing.T) {
mockSpace, cleanSpace := newMockSpace(t)
defer cleanSpace()
b := proto2.Blob{
Blob: proto.Blob{
Name: []byte("blob"),
Location: proto.Location{
ClusterID: 10000,
CodeMode: 11,
Size_: 10 * 1024,
SliceSize: 128,
Crc: 0,
Slices: []proto.Slice{
{
MinSliceID: 10,
Vid: 100,
Count: 20,
},
{
MinSliceID: 30,
Vid: 100,
Count: 10,
},
b := proto.Blob{
Name: []byte("blob"),
Location: proto.Location{
ClusterID: 10000,
CodeMode: 11,
Size_: 10 * 1024,
SliceSize: 128,
Crc: 0,
Slices: []proto.Slice{
{
MinSliceID: 10,
Vid: 100,
Count: 20,
},
{
MinSliceID: 30,
Vid: 100,
Count: 10,
},
},
},
}
kv, err := storage.InitKV(mockSpace.space.generateSpaceKey(b.Blob.GetName()), &io.LimitedReader{
kv, err := storage.InitKV(mockSpace.space.generateSpaceKey(b.GetName()), &io.LimitedReader{
R: rpc2.Codec2Reader(&b),
N: int64(b.Size()),
})
@ -236,9 +233,9 @@ func TestBlob(t *testing.T) {
data := kv.Marshal()
kv2 := storage.NewKV(data)
require.Equal(t, mockSpace.space.generateSpaceKey(b.Blob.GetName()), kv2.Key())
require.Equal(t, mockSpace.space.generateSpaceKey(b.GetName()), kv2.Key())
b2 := proto2.Blob{}
b2 := proto.Blob{}
err = b2.Unmarshal(kv.Value())
require.Nil(t, err)
require.Equal(t, b, b2)

View File

@ -6,7 +6,6 @@ package proto
import (
fmt "fmt"
github_com_cubefs_cubefs_blobstore_common_proto "github.com/cubefs/cubefs/blobstore/common/proto"
proto1 "github.com/cubefs/cubefs/blobstore/common/proto"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
@ -135,61 +134,6 @@ func (m *Field) GetValue() []byte {
return nil
}
type Blob struct {
Blob proto1.Blob `protobuf:"bytes,1,opt,name=blob,proto3" json:"blob"`
Sealed bool `protobuf:"varint,2,opt,name=Sealed,proto3" json:"Sealed,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Blob) Reset() { *m = Blob{} }
func (m *Blob) String() string { return proto.CompactTextString(m) }
func (*Blob) ProtoMessage() {}
func (*Blob) Descriptor() ([]byte, []int) {
return fileDescriptor_0d2c4ccf1453ffdb, []int{2}
}
func (m *Blob) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Blob) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Blob.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Blob) XXX_Merge(src proto.Message) {
xxx_messageInfo_Blob.Merge(m, src)
}
func (m *Blob) XXX_Size() int {
return m.Size()
}
func (m *Blob) XXX_DiscardUnknown() {
xxx_messageInfo_Blob.DiscardUnknown(m)
}
var xxx_messageInfo_Blob proto.InternalMessageInfo
func (m *Blob) GetBlob() proto1.Blob {
if m != nil {
return m.Blob
}
return proto1.Blob{}
}
func (m *Blob) GetSealed() bool {
if m != nil {
return m.Sealed
}
return false
}
type ShardMemberCtx struct {
Suid github_com_cubefs_cubefs_blobstore_common_proto.Suid `protobuf:"varint,1,opt,name=suid,proto3,casttype=github.com/cubefs/cubefs/blobstore/common/proto.Suid" json:"suid,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -201,7 +145,7 @@ func (m *ShardMemberCtx) Reset() { *m = ShardMemberCtx{} }
func (m *ShardMemberCtx) String() string { return proto.CompactTextString(m) }
func (*ShardMemberCtx) ProtoMessage() {}
func (*ShardMemberCtx) Descriptor() ([]byte, []int) {
return fileDescriptor_0d2c4ccf1453ffdb, []int{3}
return fileDescriptor_0d2c4ccf1453ffdb, []int{2}
}
func (m *ShardMemberCtx) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -240,35 +184,31 @@ func (m *ShardMemberCtx) GetSuid() github_com_cubefs_cubefs_blobstore_common_pro
func init() {
proto.RegisterType((*Item)(nil), "persistent.Item")
proto.RegisterType((*Field)(nil), "persistent.Field")
proto.RegisterType((*Blob)(nil), "persistent.Blob")
proto.RegisterType((*ShardMemberCtx)(nil), "persistent.ShardMemberCtx")
}
func init() { proto.RegisterFile("storage.proto", fileDescriptor_0d2c4ccf1453ffdb) }
var fileDescriptor_0d2c4ccf1453ffdb = []byte{
// 333 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x8f, 0xc1, 0x4b, 0xc3,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 0x0d, 0xf9, 0x67, 0x56, 0x73, 0xa3, 0x0d,
0x33, 0xc0, 0x9d, 0x8f, 0x30, 0xad, 0x60, 0x64, 0xab, 0x9c, 0x81, 0x19, 0xbc, 0x77, 0x8c, 0xfc,
0x54, 0x70, 0x72, 0x83, 0x91, 0x62, 0xe8, 0x93, 0xbd, 0xf9, 0x39, 0x35, 0x5c, 0x7a, 0xe0, 0x52,
0xc3, 0x35, 0xc5, 0xa9, 0xb2, 0xb4, 0xd1, 0xb5, 0x8d, 0x0c, 0xb1, 0xb3, 0x84, 0x30, 0x85, 0x48,
0xd3, 0xbb, 0x41, 0x3b, 0x79, 0x6b, 0x7c, 0xba, 0xdc, 0x84, 0x45, 0xf4, 0x04, 0x19, 0x87, 0xe2,
0x5e, 0x7e, 0x92, 0x57, 0x8c, 0xca, 0xaa, 0xed, 0x86, 0xfc, 0xdb, 0xa6, 0x76, 0xd1, 0xb2, 0x4a,
0xa2, 0x7d, 0xed, 0x5e, 0xfe, 0xb7, 0x9d, 0xf2, 0x05, 0x9a, 0xe6, 0x0f, 0x77, 0xcd, 0xc4, 0xfa,
0x6a, 0x26, 0xd6, 0x77, 0x33, 0xb1, 0xde, 0xba, 0x94, 0x5d, 0x6b, 0x09, 0x77, 0xf4, 0xe7, 0xe2,
0x27, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x8a, 0xd6, 0xed, 0x05, 0x02, 0x00, 0x00,
// 280 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x8e, 0x31, 0x4b, 0xc4, 0x30,
0x18, 0x86, 0x6d, 0xed, 0x15, 0x89, 0x9e, 0x60, 0x39, 0x8e, 0xe2, 0xd0, 0x1e, 0x9d, 0x6e, 0x6a,
0x40, 0x05, 0x07, 0x17, 0xad, 0x22, 0xdc, 0x20, 0x62, 0xcf, 0xc9, 0xad, 0x69, 0xbf, 0xf6, 0x02,
0xed, 0xa5, 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, 0xeb, 0x9e, 0x16, 0x7b, 0x19, 0x5e, 0xfd,
0xb7, 0x5e, 0xff, 0x4b, 0x0d, 0x2d, 0x99, 0xef, 0x54, 0x60, 0x7d, 0xaa, 0xc0, 0xfa, 0x52, 0x81,
0xf5, 0x76, 0x14, 0xe3, 0x1b, 0x13, 0x21, 0xae, 0x19, 0x97, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff,
0xb7, 0x02, 0x8a, 0x21, 0x7c, 0x01, 0x00, 0x00,
}
func (m *Item) Marshal() (dAtA []byte, err error) {
@ -358,53 +298,6 @@ func (m *Field) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *Blob) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Blob) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Blob) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if m.Sealed {
i--
if m.Sealed {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x10
}
{
size, err := m.Blob.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintStorage(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *ShardMemberCtx) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@ -489,23 +382,6 @@ func (m *Field) Size() (n int) {
return n
}
func (m *Blob) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Blob.Size()
n += 1 + l + sovStorage(uint64(l))
if m.Sealed {
n += 2
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *ShardMemberCtx) Size() (n int) {
if m == nil {
return 0
@ -750,110 +626,6 @@ func (m *Field) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *Blob) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowStorage
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Blob: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Blob: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Blob", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowStorage
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthStorage
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthStorage
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Blob.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Sealed", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowStorage
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Sealed = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipStorage(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthStorage
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *ShardMemberCtx) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0

View File

@ -23,7 +23,6 @@ option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
import "gogoproto/gogo.proto";
import "cubefs/blobstore/common/proto/blob.proto";
message Item {
bytes id = 1 [(gogoproto.customname) = "ID"];
@ -35,11 +34,6 @@ message Field {
bytes value = 2;
}
message Blob {
cubefs.blobstore.common.proto.Blob blob = 1 [(gogoproto.nullable) = false];
bool Sealed = 2;
}
message ShardMemberCtx {
uint64 suid = 1 [(gogoproto.customname) = "Suid", (gogoproto.casttype) = "github.com/cubefs/cubefs/blobstore/common/proto.Suid"];
}

View File

@ -32,7 +32,6 @@ import (
"github.com/cubefs/cubefs/blobstore/shardnode/catalog"
"github.com/cubefs/cubefs/blobstore/shardnode/catalog/allocator"
"github.com/cubefs/cubefs/blobstore/shardnode/mock"
snproto "github.com/cubefs/cubefs/blobstore/shardnode/proto"
"github.com/cubefs/cubefs/blobstore/shardnode/storage"
"github.com/cubefs/cubefs/blobstore/util/taskpool"
)
@ -80,10 +79,8 @@ func newMockService(t *testing.T) (*service, func(), error) {
sh.EXPECT().Insert(A, A, A).Return(nil).AnyTimes()
// blob
blob := snproto.Blob{
Blob: proto.Blob{
Name: []byte("test_get_blob"),
},
blob := proto.Blob{
Name: []byte("test_get_blob"),
}
raw, _ := blob.Marshal()
vg := mock.NewMockValGetter(C(t))