From 39c9d1ab250605fcf789870ecce5c861f7d450ff Mon Sep 17 00:00:00 2001 From: Alan Bernstein Date: Wed, 11 Jan 2017 09:38:45 -0600 Subject: [PATCH] Cleanup and update comments --- bench/store.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/bench/store.go b/bench/store.go index 36a64cded..b838e4bf3 100644 --- a/bench/store.go +++ b/bench/store.go @@ -9,20 +9,20 @@ import ( "github.com/aws/aws-sdk-go/service/s3" ) -type Uploader interface { - Write(p []byte) (n int, err error) -} - +// NewS3Uploader creates an S3Uploader with a hardcoded region and bucket, +// and a specified key. func NewS3Uploader(key string) *S3Uploader { region := "us-east-1" + bucket := "benchmarks-pilosa" return &S3Uploader{ region, - "benchmarks-pilosa", + bucket, s3.New(session.New(&aws.Config{Region: aws.String(region)})), key, } } +// S3Uploader is an io.Writer for sending output to AWS S3 storage. type S3Uploader struct { region string bucket string @@ -30,10 +30,9 @@ type S3Uploader struct { key string } -// pilosa-sandbox is "us-east-1" -// benchmarks go to benchmarks-pilosa/run-uuid/??.txt -// first return value of PutObject contains an ETag (hash) of the uploaded object, returned here but not needed +// Write writes data to the uploader's bucket/key func (u *S3Uploader) Write(data []byte) (int, error) { + // first return value of PutObject contains an ETag (hash) of the uploaded object, not needed here fmt.Println(string(data)) _, err := u.service.PutObject(&s3.PutObjectInput{ Body: strings.NewReader(string(data)),