Skip to content

Commit

Permalink
Merge pull request #157 from jkawamoto/serial
Browse files Browse the repository at this point in the history
Use SerialBlobUploader and SerialBlobDownloader if P = 1
  • Loading branch information
lukechampine authored Jan 23, 2021
2 parents a017ff5 + 12c5e49 commit 18eb849
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions renter/renterutil/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,20 @@ func (kv PseudoKV) Put(ctx context.Context, key []byte, r io.Reader) error {
if err := kv.DB.AddBlob(b); err != nil {
return err
}
bu := ParallelBlobUploader{
U: kv.Uploader,
M: kv.M,
N: kv.N,
P: kv.P,
var bu BlobUploader
if kv.P == 1 {
bu = SerialBlobUploader{
U: kv.Uploader,
M: kv.M,
N: kv.N,
}
} else {
bu = ParallelBlobUploader{
U: kv.Uploader,
M: kv.M,
N: kv.N,
P: kv.P,
}
}
return bu.UploadBlob(ctx, kv.DB, b, r)
}
Expand Down Expand Up @@ -91,9 +100,16 @@ func (kv PseudoKV) GetRange(ctx context.Context, key []byte, w io.Writer, off, n
if err != nil {
return err
}
bd := ParallelBlobDownloader{
D: kv.Downloader,
P: kv.P,
var bd BlobDownloader
if kv.P == 1 {
bd = SerialBlobDownloader{
D: kv.Downloader,
}
} else {
bd = ParallelBlobDownloader{
D: kv.Downloader,
P: kv.P,
}
}
return bd.DownloadBlob(ctx, kv.DB, b, w, off, n)
}
Expand Down

0 comments on commit 18eb849

Please sign in to comment.