commands: Got rid of Response#Stream() in favor of setting value to a io.Reader

This commit is contained in:
Matt Bell 2014-10-21 16:15:06 -07:00
parent b65a5bacbe
commit dd84a3eb44
2 changed files with 4 additions and 9 deletions

View File

@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"strings"
"io"
u "github.com/jbenet/go-ipfs/util"
)
@ -48,9 +47,8 @@ func (c *Command) Register(id string, sub *Command) error {
}
// Call invokes the command for the given Request
// Streaming output is written to `out`
func (c *Command) Call(req Request, out io.Writer) Response {
res := NewResponse(req, out)
func (c *Command) Call(req Request) Response {
res := NewResponse(req)
cmds, err := c.Resolve(req.Path())
if err != nil {

View File

@ -60,9 +60,6 @@ type Response interface {
SetValue(interface{})
Value() interface{}
// Returns the output stream Writer
Stream() io.Writer
// Marshal marshals out the response into a buffer. It uses the EncodingType
// on the Request to chose a Marshaller (Codec).
Marshal() ([]byte, error)
@ -125,6 +122,6 @@ func (r *response) Marshal() ([]byte, error) {
}
// NewResponse returns a response to match given Request
func NewResponse(req Request, out io.Writer) Response {
return &response{req: req, out: out}
func NewResponse(req Request) Response {
return &response{req: req}
}