common: Implement generic retry helper
common: Implement generic retry helper

Implemented a generic retry helper than can be used to call a
function repeatedly with backoff interval until the function
returns non-error value.

Example:

    fn := func(r int, lastErr error) error {
        if r > 0 {
            fmt.Printf("Error occured (%v) .. Retrying(%d)\n", lastErr, r)
        }
        if r == 8 {
            return nil
        }
        return errors.New("failed")
    }

    rh := common.NewRetryHelper(10, time.Second*2, 2, fn)
    err := rh.Run()

Change-Id: I7e9e9b03007207a62a9f4fdcd792de41f5034083
Reviewed-on: http://review.couchbase.org/43710
Reviewed-by: Pratap Chakravarthy <3f7aa3c5f732447448ccfcd013fd9591a9825870@couchbase.com>
Reviewed-by: Sarath Lakshman <d41e430501c5d3aeeb2b91142f917f514040f807@couchbase.com>
Tested-by: Sarath Lakshman <d41e430501c5d3aeeb2b91142f917f514040f807@couchbase.com>

jchris/indexing,jchris/indexing,jchris/indexing,jchris/indexing