s3: Move AttemptStrategy into S3 object so callers can change, replace
Hi Hashicorp team. Thanks for all your projects and products.
The hardwired default of S3 attempts is a bit problematic for me.
In:
// The S3 type encapsulates operations with an S3 region.
type S3 struct {
aws.Auth
aws.Region
private byte // Reserve the right of using private data.
}
add
Attempts *aws.AttemptStrategy
Then change new to point to the current default attempts that is private and hardwired
func New(auth aws.Auth, region aws.Region) *S3 {
return &S3{auth, region, 0, &attempts}
}
The caller could then point to another aws.AttemptStrategy objects as needed.
We could also change the New api as well but this seemed like the dumbest solution that unblocks everything.
If ok, then I'll proceed with a pull request.
thanks again!
nickg
i think that if we change attempts->Attempts, then the user can replace the strategy with another one after import. For example:
import "github.com/mitchellh/goamz/s3"
// swap default attempt strategy with another one
s3.Attempts = aws.AttemptStrategy{
Min: 10,
Total: 10 * time.Second,
Delay: 500 * time.Millisecond,
}
is this your usecase @client9 ?
oh nice, yeah that will work.
thanks and closing!
Argh.
attempts is a private variable (lower case) If it were capital then the solution by @dqminh would work.
See also #80