mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 01:58:34 +08:00
Signed-off-by: longjiquan <jiquan.long@zilliz.com> Co-authored-by: xaxys <tpnnghd@163.com> Signed-off-by: longjiquan <jiquan.long@zilliz.com> Co-authored-by: xaxys <tpnnghd@163.com>
25 lines
517 B
Go
25 lines
517 B
Go
package allocator
|
|
|
|
type MockGIDAllocator struct {
|
|
GIDAllocator
|
|
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{}
|
|
}
|