From 6ae94d3fbc17a6600999dc24c28bd01735a87b76 Mon Sep 17 00:00:00 2001 From: Jonathan Amsterdam Date: Mon, 12 Dec 2016 18:59:33 -0500 Subject: [PATCH] bundler: rename Close to Stop The name Close should be used for methods that return error, and Stop for methods that don't. Change-Id: I545770da48605db307d61713b2bbdf9144f005a2 Reviewed-on: https://code-review.googlesource.com/9839 Reviewed-by: Michael McGreevy --- support/bundler/bundler.go | 8 ++++---- support/bundler/bundler_test.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/support/bundler/bundler.go b/support/bundler/bundler.go index 4faf13ec024..62cfd21e3b9 100644 --- a/support/bundler/bundler.go +++ b/support/bundler/bundler.go @@ -87,7 +87,7 @@ type bundle struct { } // NewBundler creates a new Bundler. When you are finished with a Bundler, call -// its Close method. +// its Stop method. // // itemExample is a value of the type that will be bundled. For example, if you // want to create bundles of *Entry, you could pass &Entry{} for itemExample. @@ -177,11 +177,11 @@ func (b *Bundler) Flush() { <-calledc } -// Close calls Flush, then shuts down the Bundler. Close should always be +// Stop calls Flush, then shuts down the Bundler. Stop should always be // called on a Bundler when it is no longer needed. You must wait for all calls -// to Add to complete before calling Close. Calling Add concurrently with Close +// to Add to complete before calling Stop. Calling Add concurrently with Stop // may result in the added items being ignored. -func (b *Bundler) Close() { +func (b *Bundler) Stop() { b.Flush() b.mu.Lock() b.timer.Stop() diff --git a/support/bundler/bundler_test.go b/support/bundler/bundler_test.go index 12c30ee8db2..8d565195c83 100644 --- a/support/bundler/bundler_test.go +++ b/support/bundler/bundler_test.go @@ -33,7 +33,7 @@ func TestBundlerCount1(t *testing.T) { t.Fatal(err) } } - b.Close() + b.Stop() got := handler.bundles() want := [][]int{{0}, {1}, {2}} if !reflect.DeepEqual(got, want) { @@ -95,7 +95,7 @@ func TestBundlerByteThreshold(t *testing.T) { add(5, 2) // Passed byte threshold, but not limit: bundle = 3, 4, 5 add(6, 1) - b.Close() + b.Stop() bgot := handler.bundles() bwant := [][]int{{1, 2}, {3, 4, 5}, {6}} if !reflect.DeepEqual(bgot, bwant) { @@ -128,7 +128,7 @@ func TestBundlerLimit(t *testing.T) { // Exceeded byte limit: bundle = 3, 4 add(6, 2) // Exceeded byte limit: bundle = 5 - b.Close() + b.Stop() bgot := handler.bundles() bwant := [][]int{{1, 2}, {3, 4}, {5}, {6}} if !reflect.DeepEqual(bgot, bwant) {