Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kadai3-2 by @int128 #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

kadai3-2 by @int128 #35

wants to merge 1 commit into from

Conversation

int128
Copy link
Member

@int128 int128 commented Jul 4, 2018

課題3-2を提出します。

  • Rangeアクセスを用いる
  • いくつかのゴルーチンでダウンロードしてマージする
    • 最後にバイト列をマージするのではなく io.WriterAt を並列実行しています。
  • エラー処理を工夫する: golang.org/x/sync/errgourpパッケージなどを使ってみる
  • キャンセルが発生した場合の実装を行う

@tenntenn tenntenn added the kadai3 This issue or pull request already exists label Jul 5, 2018

// ParseContentRange parses a Content-Range header and returns the Range.
func ParseContentRange(header string) (*ContentRange, error) {
rng := Range{}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var rnd Range でもよい


// RangeWriter supports partial write.
type RangeWriter struct {
io.WriterAt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

埋め込みにする必要がないように思えます。
埋め込んでもいいですが、型が公開されているものだと。w.WriterAt = nilのように外から変えれちゃいます。
参考:https://qiita.com/tenntenn/items/eac962a49c56b2b15ee8#%E5%9F%8B%E3%82%81%E8%BE%BC%E3%81%BF%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%9F%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9%E3%81%AE%E5%8B%95%E7%9A%84%E5%AE%9F%E8%A3%85

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kadai3 This issue or pull request already exists
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants