Commit 7eeef97e authored by Matthew Sevey's avatar Matthew Sevey

Merge branch 'segment-size' into 'master'

Custom erasure code settings should also use NewRSSubCode

See merge request NebulousLabs/Sia!3597
parents dd9b3bdb a87eb7be
Pipeline #57476522 failed with stages
in 24 minutes and 23 seconds
......@@ -58,7 +58,7 @@ func (r *Renter) Upload(up modules.FileUploadParams) error {
// Fill in any missing upload params with sensible defaults.
if up.ErasureCode == nil {
up.ErasureCode, _ = siafile.NewRSSubCode(defaultDataPieces, defaultParityPieces, 64)
up.ErasureCode, _ = siafile.NewRSSubCode(defaultDataPieces, defaultParityPieces, crypto.SegmentSize)
}
// Check that we have contracts to upload to. We need at least data +
......
......@@ -409,14 +409,14 @@ func (c *Client) RenterUploadDefaultPost(path string, siaPath modules.SiaPath) (
// RenterUploadStreamPost uploads data using a stream. It will return a
// io.WriteCloser that can be used to write the data to the request body. The
// writer needs to be closed when done for the whole file to be uploaded.
func (c *Client) RenterUploadStreamPost(r io.Reader, siaPath string, dataPieces, parityPieces uint64, force bool) error {
siaPath = escapeSiaPath(trimSiaPath(siaPath))
func (c *Client) RenterUploadStreamPost(r io.Reader, siaPath modules.SiaPath, dataPieces, parityPieces uint64, force bool) error {
sp := escapeSiaPath(siaPath)
values := url.Values{}
values.Set("datapieces", strconv.FormatUint(dataPieces, 10))
values.Set("paritypieces", strconv.FormatUint(parityPieces, 10))
values.Set("force", strconv.FormatBool(force))
values.Set("stream", strconv.FormatBool(true))
_, err := c.postRawResponse(fmt.Sprintf("/renter/uploadstream/%s?%s", siaPath, values.Encode()), r)
_, err := c.postRawResponse(fmt.Sprintf("/renter/uploadstream/%s?%s", sp, values.Encode()), r)
return err
}
......
......@@ -291,7 +291,7 @@ func parseErasureCodingParameters(strDataPieces, strParityPieces string) (module
}
// Create the erasure coder.
return siafile.NewRSCode(dataPieces, parityPieces)
return siafile.NewRSSubCode(dataPieces, parityPieces, crypto.SegmentSize)
}
return nil, nil
}
......
......@@ -311,9 +311,12 @@ func testUploadStreaming(t *testing.T, tg *siatest.TestGroup) {
d := bytes.NewReader(data)
// Upload the data.
siaPath := "/foo"
siaPath, err := modules.NewSiaPath("/foo")
if err != nil {
t.Fatal(err)
}
r := tg.Renters()[0]
err := r.RenterUploadStreamPost(d, siaPath, 1, uint64(len(tg.Hosts())-1), false)
err = r.RenterUploadStreamPost(d, siaPath, 1, uint64(len(tg.Hosts())-1), false)
if err != nil {
t.Fatal(err)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment