本文整理汇总了Golang中github.com/balzaczyy/golucene/core/store.Directory.LockFactory方法的典型用法代码示例。如果您正苦于以下问题:Golang Directory.LockFactory方法的具体用法?Golang Directory.LockFactory怎么用?Golang Directory.LockFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/balzaczyy/golucene/core/store.Directory
的用法示例。
在下文中一共展示了Directory.LockFactory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewMockDirectoryWrapper
func NewMockDirectoryWrapper(random *rand.Rand, delegate store.Directory) *MockDirectoryWrapper {
ans := &MockDirectoryWrapper{
noDeleteOpenFile: true,
preventDoubleWrite: true,
trackDiskUsage: false,
wrapLockFactory: true,
openFilesForWrite: make(map[string]bool),
openLocks: make(map[string]bool),
openLocksLock: &sync.Mutex{},
throttling: THROTTLING_SOMETIMES,
inputCloneCount: 0,
openFileHandles: make(map[io.Closer]error),
failOnCreateOutput: true,
failOnOpenInput: true,
assertNoUnreferencedFilesOnClose: true,
}
ans.BaseDirectoryWrapperImpl = NewBaseDirectoryWrapper(delegate)
ans.Locker = &sync.Mutex{}
// must make a private random since our methods are called from different
// methods; else test failures may not be reproducible from the original
// seed
ans.randomState = rand.New(rand.NewSource(random.Int63()))
ans.throttledOutput = NewThrottledIndexOutput(
MBitsToBytes(40+ans.randomState.Intn(10)), 5+ans.randomState.Int63n(5), nil)
// force wrapping of LockFactory
ans.myLockFactory = newMockLockFactoryWrapper(ans, delegate.LockFactory())
ans.init()
return ans
}