Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
rename HasData() to IsEmpty()
Browse files Browse the repository at this point in the history
  • Loading branch information
replay committed Dec 14, 2017
1 parent fc64bb5 commit 7457eea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion mdata/aggmetric.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ func (a *AggMetric) GC(chunkMinTs, metricMinTs uint32) bool {
}

// this aggMetric has never had metrics written to it.
if len(a.Chunks) == 0 && (a.rob == nil || !a.rob.HasData()) {
if len(a.Chunks) == 0 && (a.rob == nil || a.rob.IsEmpty()) {
return true
}

Expand Down
4 changes: 2 additions & 2 deletions mdata/reorder_buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ func (rob *ReorderBuffer) Flush() []schema.Point {
return res
}

func (rob *ReorderBuffer) HasData() bool {
return rob.buf[rob.newest].Ts != 0
func (rob *ReorderBuffer) IsEmpty() bool {
return rob.buf[rob.newest].Ts == 0
}
14 changes: 7 additions & 7 deletions mdata/reorder_buffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,21 +291,21 @@ func TestReorderBufferFlushUnsortedData2(t *testing.T) {
}
}

func TestReorderBufferFlushAndHasData(t *testing.T) {
func TestReorderBufferFlushAndIsEmpty(t *testing.T) {
buf := NewReorderBuffer(10, 1)

if buf.HasData() != false {
t.Fatalf("Expected HasData() to be false")
if buf.IsEmpty() != true {
t.Fatalf("Expected IsEmpty() to be false")
}

buf.Add(123, 123)
if buf.HasData() != true {
t.Fatalf("Expected HasData() to be true")
if buf.IsEmpty() != false {
t.Fatalf("Expected IsEmpty() to be true")
}

buf.Reset()
if buf.HasData() != false {
t.Fatalf("Expected HasData() to be false")
if buf.IsEmpty() != true {
t.Fatalf("Expected IsEmpty() to be false")
}
}

Expand Down

0 comments on commit 7457eea

Please sign in to comment.