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)),