mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-29 14:31:30 +08:00
detect non streaming mode on first write request
This commit is contained in:
parent
b541e39a2c
commit
c2aad1c7ff
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user