func newMockIndexOutputWrapper(dir *MockDirectoryWrapper, name string, delegate store.IndexOutput) *MockIndexOutputWrapper {
	assert(delegate != nil)
	ans := &MockIndexOutputWrapper{
		dir:        dir,
		name:       name,
		delegate:   delegate,
		first:      true,
		singleByte: make([]byte, 1),
	}
	ans.IndexOutputImpl = store.NewIndexOutput(ans)
	return ans
}
예제 #2
0
func (out *ThrottledIndexOutput) NewFromDelegate(output store.IndexOutput) *ThrottledIndexOutput {
	ans := &ThrottledIndexOutput{
		delegate:         output,
		bytesPerSecond:   out.bytesPerSecond,
		flushDelayMillis: out.flushDelayMillis,
		closeDelayMillis: out.closeDelayMillis,
		seekDelayMillis:  out.seekDelayMillis,
		minBytesWritten:  out.minBytesWritten,
		bytes:            make([]byte, 1),
	}
	ans.IndexOutputImpl = store.NewIndexOutput(ans)
	return ans
}
예제 #3
0
func NewThrottledIndexOutput(bytesPerSecond int, delayInMillis int64, delegate store.IndexOutput) *ThrottledIndexOutput {
	assert(bytesPerSecond > 0)
	ans := &ThrottledIndexOutput{
		delegate:         delegate,
		bytesPerSecond:   bytesPerSecond,
		flushDelayMillis: delayInMillis,
		closeDelayMillis: delayInMillis,
		seekDelayMillis:  delayInMillis,
		minBytesWritten:  DEFAULT_MIN_WRITTEN_BYTES,
		bytes:            make([]byte, 1),
	}
	ans.IndexOutputImpl = store.NewIndexOutput(ans)
	return ans
}