Skip to content

Commit

Permalink
commands: Got rid of Response#Stream() in favor of setting value to a…
Browse files Browse the repository at this point in the history
… io.Reader
  • Loading branch information
mappum committed Oct 21, 2014
1 parent b65a5ba commit dd84a3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
6 changes: 2 additions & 4 deletions commands/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"strings"
"io"

u "github.com/jbenet/go-ipfs/util"
)
Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 2 additions & 5 deletions commands/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}
}

0 comments on commit dd84a3e

Please sign in to comment.