detect non streaming mode on first write request

This commit is contained in:
chrislu 2021-12-22 17:20:44 -08:00
parent b541e39a2c
commit c2aad1c7ff

View file

@ -14,18 +14,21 @@ type WriterPattern struct {
func NewWriterPattern(fileName string, chunkSize int64) *WriterPattern {
return &WriterPattern{
isStreaming: true,
lastWriteOffset: 0,
lastWriteOffset: -1,
chunkSize: chunkSize,
fileName: fileName,
}
}
func (rp *WriterPattern) MonitorWriteAt(offset int64, size int) {
if rp.lastWriteOffset == 0 {
}
if rp.lastWriteOffset > offset {
rp.isStreaming = false
}
if rp.lastWriteOffset == -1 {
if offset != 0 {
rp.isStreaming = false
}
}
rp.lastWriteOffset = offset
}