From e83f58b946ae338262fa7e323738702edcd16560 Mon Sep 17 00:00:00 2001 From: joeybloggs Date: Thu, 16 Jun 2016 10:06:12 -0400 Subject: [PATCH] update good formatting --- doc.go | 7 ++++--- pool.go | 26 +++++++++++++------------- work_unit.go | 3 ++- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/doc.go b/doc.go index 0672be9..a4a3b25 100644 --- a/doc.go +++ b/doc.go @@ -24,7 +24,8 @@ Pool v2 advantages over Pool v1: Pool v3 advantages over Pool v2: - Objects are not interfaces allowing for less breaking changes going forward. - - Now there are 2 Pool types, both completely interchangeable, a limited worker pool and unlimited pool. + - Now there are 2 Pool types, both completely interchangeable, a limited worker pool + and unlimited pool. - Simpler usage of Work Units, instead of `<-work.Done` now can do `work.Wait()` Important Information READ THIS! @@ -39,8 +40,8 @@ important usage information - When Batching DO NOT FORGET TO CALL batch.QueueComplete(), if you do the Batch WILL deadlock - - It is your responsibility to call WorkUnit.IsCancelled() to check if it's cancelled after a blocking - operation like waiting for a connection from a pool. + - It is your responsibility to call WorkUnit.IsCancelled() to check if it's cancelled + after a blocking operation like waiting for a connection from a pool. Usage and documentation diff --git a/pool.go b/pool.go index be2adc1..c912e39 100644 --- a/pool.go +++ b/pool.go @@ -6,25 +6,25 @@ type Pool interface { // Queue queues the work to be run, and starts processing immediately Queue(fn WorkFunc) WorkUnit - // Reset reinitializes a pool that has been closed/cancelled back to a working state. - // if the pool has not been closed/cancelled, nothing happens as the pool is still in - // a valid running state + // Reset reinitializes a pool that has been closed/cancelled back to a working + // state. if the pool has not been closed/cancelled, nothing happens as the pool + // is still in a valid running state Reset() - // Cancel cancels any pending work still not committed to processing - // call Reset() to reinitialize the pool for use. + // Cancel cancels any pending work still not committed to processing. + // Call Reset() to reinitialize the pool for use. Cancel() - // Close cleans up pool data and cancels any pending work still not committed to processing - // call Reset() to reinitialize the pool for use. + // Close cleans up pool data and cancels any pending work still not committed + // to processing. Call Reset() to reinitialize the pool for use. Close() - // Batch creates a new Batch object for queueing Work Units separate from any others - // that may be running on the pool. Grouping these Work Units together allows for individual - // Cancellation of the Batch Work Units without affecting anything else running on the pool - // as well as outputting the results on a channel as they complete. - // NOTE: Batch is not reusable, once QueueComplete() has been called it's lifetime has been sealed - // to completing the Queued items. + // Batch creates a new Batch object for queueing Work Units separate from any + // others that may be running on the pool. Grouping these Work Units together + // allows for individual Cancellation of the Batch Work Units without affecting + // anything else running on the pool as well as outputting the results on a + // channel as they complete. NOTE: Batch is not reusable, once QueueComplete() + // has been called it's lifetime has been sealed to completing the Queued items. Batch() Batch } diff --git a/work_unit.go b/work_unit.go index b8e18b2..22bdfae 100644 --- a/work_unit.go +++ b/work_unit.go @@ -14,7 +14,8 @@ type WorkUnit interface { // Error returns the Work Unit's error Error() error - // Cancel cancels this specific unit of work, if not already committed to processing. + // Cancel cancels this specific unit of work, if not already committed + // to processing. Cancel() // IsCancelled returns if the Work Unit has been cancelled.