Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
mix: add some docs and fix Whisper.bufferSize
  • Loading branch information
bom-d-van committed Dec 8, 2019
commit 4409fc4a95abcd1686b9cb1c358314509bc6ac69
19 changes: 18 additions & 1 deletion whisper.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,10 @@ func (whisper *Whisper) initMetaInfo() {
}

if i == 0 {
if whisper.aggregationMethod == Mix {
// TODO
// arc.bufferSize =
}
continue
}

Expand Down Expand Up @@ -620,6 +624,10 @@ func (whisper *Whisper) blockRangesSize() int {
}

func (whisper *Whisper) bufferSize() int {
if whisper.aggregationMethod == Mix {
return 0
}

if len(whisper.archives) == 0 {
return 0
}
Expand Down Expand Up @@ -1308,9 +1316,18 @@ type archiveInfo struct {
next *archiveInfo
whisper *Whisper

// reason:
// why having buffer:
//
// original reasons:
// 1. less file writes per point
// 2. less file reads & no decompressions on propagation
//
// necessary reasons:
// cwhisper don't handle well on data points coming in ramdon order by
// timestamp, having a buffer allows it to tolerate data points with
// different timestamp coming in non-increasing order for whatever reasons.
// But only the first/base archive is necessary to have it, so it's possible
// to optimize away buffers in lower archives.
buffer []byte
bufferSize int

Expand Down