2022-09-05 13:29:11 +08:00
|
|
|
package allocator
|
|
|
|
|
|
|
|
type MockGIDAllocator struct {
|
2022-10-09 10:06:58 +08:00
|
|
|
Interface
|
2022-09-05 13:29:11 +08:00
|
|
|
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{}
|
|
|
|
}
|