瀏覽代碼

Updated godocs at an attempt to improve understanding of said documentation.

Phillip Couto 11 年之前
父節點
當前提交
e781c604d6
共有 1 個文件被更改,包括 8 次插入5 次删除
  1. 8 5
      policies.go

+ 8 - 5
policies.go

@@ -10,19 +10,22 @@ type RetryableQuery interface {
 	Attempts() int
 }
 
-// RetryPolicy is the interface that is used by gocql to determine if a query
-// can be retried based on the policy provided by the using application.
-// See SimpleRetryPolicy for an example of how to create a custom policy.
+// RetryPolicy interace is used by gocql to determine if a query can be attempted
+// again after a retryable error has been received. The interface allows gocql
+// users to implement their own logic to determine if a query can be attempted
+// again.
+// See SimpleRetryPolicy as an example of implementing the RetryPolicy interface.
 type RetryPolicy interface {
 	Attempt(RetryableQuery) bool
 }
 
-// SimpleRetryPolicy is just a simple number of retries logic.
+// SimpleRetryPolicy has simple logic for attempting a query a fixed number of times.
 type SimpleRetryPolicy struct {
 	NumRetries int //Number of times to retry a query
 }
 
-//Attempt tells gocql to attempt the query again.
+// Attempt tells gocql to attempt the query again based on query.Attemps being less
+// than the NumRetries defined in the policy.
 func (s *SimpleRetryPolicy) Attempt(q RetryableQuery) bool {
 	return q.Attempts() <= s.NumRetries
 }