Populating http handler with test scaffolding

This commit is contained in:
Frederick F. Kautz IV
2015-01-18 16:10:48 -08:00
parent 8d20e81295
commit c766f3617b
2 changed files with 29 additions and 8 deletions

View File

@@ -1,12 +1,28 @@
package storage
import "errors"
import (
"bytes"
"errors"
"io"
)
func Start() (chan<- string, <-chan error) {
type Storage struct{}
func (storage *Storage) CopyObjectToWriter(w io.Writer, bucket string, object string) error {
// TODO synchronize access
// get object
objectData := "OBJECT: " + bucket + " - " + object
objectBuffer := bytes.NewBufferString(objectData)
// copy object to writer
_, err := io.Copy(w, objectBuffer)
return err
}
func Start() (chan<- string, <-chan error, *Storage) {
ctrlChannel := make(chan string)
errorChannel := make(chan error)
go start(ctrlChannel, errorChannel)
return ctrlChannel, errorChannel
return ctrlChannel, errorChannel, &Storage{}
}
func start(ctrlChannel <-chan string, errorChannel chan<- error) {