From 7457eea666d074a60048d699f3bf8992fcba9784 Mon Sep 17 00:00:00 2001 From: Mauro Stettler Date: Thu, 14 Dec 2017 20:07:58 +0900 Subject: [PATCH] rename HasData() to IsEmpty() --- mdata/aggmetric.go | 2 +- mdata/reorder_buffer.go | 4 ++-- mdata/reorder_buffer_test.go | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mdata/aggmetric.go b/mdata/aggmetric.go index 2ca03da0d2..689e005cdb 100644 --- a/mdata/aggmetric.go +++ b/mdata/aggmetric.go @@ -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 } diff --git a/mdata/reorder_buffer.go b/mdata/reorder_buffer.go index fe914ac24e..5e963c3b85 100644 --- a/mdata/reorder_buffer.go +++ b/mdata/reorder_buffer.go @@ -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 } diff --git a/mdata/reorder_buffer_test.go b/mdata/reorder_buffer_test.go index a7dfeaeeea..70575bfe3e 100644 --- a/mdata/reorder_buffer_test.go +++ b/mdata/reorder_buffer_test.go @@ -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") } }