milvus/internal/allocator/mock_global_id.go
Xiaofan 6826964e60
Rename some interface and files in id allocator (#19605)
Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>

Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>
2022-10-09 10:06:58 +08:00

25 lines
514 B
Go

package allocator
type MockGIDAllocator struct {
Interface
AllocF func(count uint32) (UniqueID, UniqueID, error)
AllocOneF func() (UniqueID, error)
UpdateIDF func() error
}
func (m MockGIDAllocator) Alloc(count uint32) (UniqueID, UniqueID, error) {
return m.AllocF(count)
}
func (m MockGIDAllocator) AllocOne() (UniqueID, error) {
return m.AllocOneF()
}
func (m MockGIDAllocator) UpdateID() error {
return m.UpdateIDF()
}
func NewMockGIDAllocator() *MockGIDAllocator {
return &MockGIDAllocator{}
}