Encapsulate fingerprint frontier checks in renderView().

This commit is contained in:
Julius Volz 2013-03-11 14:59:28 -07:00 committed by Matt T. Proud
parent 1a1cba1bb2
commit ce4f560e48
2 changed files with 5 additions and 1 deletions

View File

@ -38,6 +38,10 @@ func (f *diskFrontier) String() string {
return fmt.Sprintf("diskFrontier from %s at %s to %s at %s", f.firstFingerprint.ToRowKey(), f.firstSupertime, f.lastFingerprint.ToRowKey(), f.lastSupertime) return fmt.Sprintf("diskFrontier from %s at %s to %s at %s", f.firstFingerprint.ToRowKey(), f.firstSupertime, f.lastFingerprint.ToRowKey(), f.lastSupertime)
} }
func (f *diskFrontier) ContainsFingerprint(fingerprint model.Fingerprint) bool {
return fingerprint.Less(f.firstFingerprint) || f.lastFingerprint.Less(fingerprint)
}
func newDiskFrontier(i iterator) (d *diskFrontier, err error) { func newDiskFrontier(i iterator) (d *diskFrontier, err error) {
i.SeekToLast() i.SeekToLast()
if i.Key() == nil { if i.Key() == nil {

View File

@ -365,7 +365,7 @@ func (t *tieredStorage) renderView(viewJob viewJob) (err error) {
) )
// fmt.Printf("Starting scan of %s...\n", scanJob) // fmt.Printf("Starting scan of %s...\n", scanJob)
if !(t.diskFrontier == nil || scanJob.fingerprint.Less(t.diskFrontier.firstFingerprint) || t.diskFrontier.lastFingerprint.Less(scanJob.fingerprint)) { if t.diskFrontier != nil || t.diskFrontier.ContainsFingerprint(scanJob.fingerprint) {
// fmt.Printf("Using diskFrontier %s\n", t.diskFrontier) // fmt.Printf("Using diskFrontier %s\n", t.diskFrontier)
seriesFrontier, err := newSeriesFrontier(scanJob.fingerprint, *t.diskFrontier, iterator) seriesFrontier, err := newSeriesFrontier(scanJob.fingerprint, *t.diskFrontier, iterator)
// fmt.Printf("Using seriesFrontier %s\n", seriesFrontier) // fmt.Printf("Using seriesFrontier %s\n", seriesFrontier)