Make NewMeta private (#9057)

Signed-off-by: godchen <qingxiang.chen@zilliz.com>
This commit is contained in:
godchen 2021-10-02 23:09:56 +08:00 committed by GitHub
parent 1315fa278d
commit f18e0628ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View File

@ -38,7 +38,7 @@ type meta struct {
} }
// NewMeta create meta from provided `kv.TxnKV` // NewMeta create meta from provided `kv.TxnKV`
func NewMeta(kv kv.TxnKV) (*meta, error) { func newMeta(kv kv.TxnKV) (*meta, error) {
mt := &meta{ mt := &meta{
client: kv, client: kv,
collections: make(map[UniqueID]*datapb.CollectionInfo), collections: make(map[UniqueID]*datapb.CollectionInfo),

View File

@ -124,14 +124,14 @@ func TestMeta_Basic(t *testing.T) {
// inject error for `Save` // inject error for `Save`
memoryKV := memkv.NewMemoryKV() memoryKV := memkv.NewMemoryKV()
fkv := &saveFailKV{TxnKV: memoryKV} fkv := &saveFailKV{TxnKV: memoryKV}
meta, err := NewMeta(fkv) meta, err := newMeta(fkv)
assert.Nil(t, err) assert.Nil(t, err)
err = meta.AddSegment(NewSegmentInfo(&datapb.SegmentInfo{})) err = meta.AddSegment(NewSegmentInfo(&datapb.SegmentInfo{}))
assert.NotNil(t, err) assert.NotNil(t, err)
fkv2 := &removeFailKV{TxnKV: memoryKV} fkv2 := &removeFailKV{TxnKV: memoryKV}
meta, err = NewMeta(fkv2) meta, err = newMeta(fkv2)
assert.Nil(t, err) assert.Nil(t, err)
// nil, since no segment yet // nil, since no segment yet
err = meta.DropSegment(0) err = meta.DropSegment(0)

View File

@ -34,7 +34,7 @@ import (
func newMemoryMeta(allocator allocator) (*meta, error) { func newMemoryMeta(allocator allocator) (*meta, error) {
memoryKV := memkv.NewMemoryKV() memoryKV := memkv.NewMemoryKV()
return NewMeta(memoryKV) return newMeta(memoryKV)
} }
var _ allocator = (*MockAllocator)(nil) var _ allocator = (*MockAllocator)(nil)

View File

@ -397,7 +397,7 @@ func TestTryToSealSegment(t *testing.T) {
mockAllocator := newMockAllocator() mockAllocator := newMockAllocator()
memoryKV := memkv.NewMemoryKV() memoryKV := memkv.NewMemoryKV()
fkv := &saveFailKV{TxnKV: memoryKV} fkv := &saveFailKV{TxnKV: memoryKV}
meta, err := NewMeta(memoryKV) meta, err := newMeta(memoryKV)
assert.Nil(t, err) assert.Nil(t, err)
@ -423,7 +423,7 @@ func TestTryToSealSegment(t *testing.T) {
mockAllocator := newMockAllocator() mockAllocator := newMockAllocator()
memoryKV := memkv.NewMemoryKV() memoryKV := memkv.NewMemoryKV()
fkv := &saveFailKV{TxnKV: memoryKV} fkv := &saveFailKV{TxnKV: memoryKV}
meta, err := NewMeta(memoryKV) meta, err := newMeta(memoryKV)
assert.Nil(t, err) assert.Nil(t, err)

View File

@ -287,7 +287,7 @@ func (s *Server) initMeta() error {
} }
s.kvClient = etcdKV s.kvClient = etcdKV
s.meta, err = NewMeta(s.kvClient) s.meta, err = newMeta(s.kvClient)
if err != nil { if err != nil {
return err return err
} }