This commit is contained in:
Łukasz Magiera 2022-05-24 16:22:52 +02:00
parent df7709c2e2
commit b53db68bda
2 changed files with 5 additions and 5 deletions

View File

@ -4,7 +4,6 @@ import (
"encoding/hex" "encoding/hex"
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/filecoin-project/lotus/lib/httpreader"
"io" "io"
"math" "math"
"net/http" "net/http"
@ -25,6 +24,7 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks" "github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface" "github.com/filecoin-project/lotus/extern/sector-storage/storiface"
"github.com/filecoin-project/lotus/lib/httpreader"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
lcli "github.com/filecoin-project/lotus/cli" lcli "github.com/filecoin-project/lotus/cli"

View File

@ -5,7 +5,6 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"github.com/filecoin-project/lotus/lib/httpreader"
"io" "io"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
@ -24,6 +23,7 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/extern/storage-sealing/lib/nullreader" "github.com/filecoin-project/lotus/extern/storage-sealing/lib/nullreader"
"github.com/filecoin-project/lotus/lib/httpreader"
) )
var log = logging.Logger("rpcenc") var log = logging.Logger("rpcenc")
@ -35,7 +35,7 @@ type StreamType string
const ( const (
Null StreamType = "null" Null StreamType = "null"
PushStream StreamType = "push" PushStream StreamType = "push"
HttpUrl StreamType = "http" HTTP StreamType = "http"
// TODO: Data transfer handoff to workers? // TODO: Data transfer handoff to workers?
) )
@ -108,7 +108,7 @@ func ReaderParamEncoder(addr string) jsonrpc.Option {
return reflect.ValueOf(ReaderStream{Type: Null, Info: fmt.Sprint(r.N)}), nil return reflect.ValueOf(ReaderStream{Type: Null, Info: fmt.Sprint(r.N)}), nil
} }
if r, ok := r.(*httpreader.HttpReader); ok && r.URL != "" { if r, ok := r.(*httpreader.HttpReader); ok && r.URL != "" {
return reflect.ValueOf(ReaderStream{Type: HttpUrl, Info: r.URL}), nil return reflect.ValueOf(ReaderStream{Type: HTTP, Info: r.URL}), nil
} }
reqID := uuid.New() reqID := uuid.New()
@ -426,7 +426,7 @@ func ReaderParamDecoder() (http.HandlerFunc, jsonrpc.ServerOption) {
} }
return reflect.ValueOf(nullreader.NewNullReader(abi.UnpaddedPieceSize(n))), nil return reflect.ValueOf(nullreader.NewNullReader(abi.UnpaddedPieceSize(n))), nil
case HttpUrl: case HTTP:
return reflect.ValueOf(&httpreader.HttpReader{URL: rs.Info}), nil return reflect.ValueOf(&httpreader.HttpReader{URL: rs.Info}), nil
} }