mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 11:29:48 +08:00
a5e2d6b6fb
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>
44 lines
816 B
Go
44 lines
816 B
Go
package tso
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type MockAllocator struct {
|
|
Allocator
|
|
InitializeF func() error
|
|
UpdateTSOF func() error
|
|
SetTSOF func(tso uint64) error
|
|
GenerateTSOF func(count uint32) (uint64, error)
|
|
ResetF func()
|
|
GetLastSavedTimeF func() time.Time
|
|
}
|
|
|
|
func (m MockAllocator) Initialize() error {
|
|
return m.InitializeF()
|
|
}
|
|
|
|
func (m MockAllocator) UpdateTSO() error {
|
|
return m.UpdateTSOF()
|
|
}
|
|
|
|
func (m MockAllocator) SetTSO(tso uint64) error {
|
|
return m.SetTSOF(tso)
|
|
}
|
|
|
|
func (m MockAllocator) GenerateTSO(count uint32) (uint64, error) {
|
|
return m.GenerateTSOF(count)
|
|
}
|
|
|
|
func (m MockAllocator) Reset() {
|
|
m.ResetF()
|
|
}
|
|
|
|
func (m MockAllocator) GetLastSavedTime() time.Time {
|
|
return m.GetLastSavedTimeF()
|
|
}
|
|
|
|
func NewMockAllocator() *MockAllocator {
|
|
return &MockAllocator{}
|
|
}
|