Skip to content

Commit

Permalink
feat: clear hashcircler and maputils package (#768)
Browse files Browse the repository at this point in the history
* feat: clear hashcircler and maputils package

Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi committed Jun 28, 2023
1 parent fe8befb commit 52cf43a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 357 deletions.
4 changes: 2 additions & 2 deletions cdn/supervisor/cdn/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ import (

"d7y.io/dragonfly/v2/cdn/types"
"d7y.io/dragonfly/v2/pkg/source"
"d7y.io/dragonfly/v2/pkg/structure/maputils"
"d7y.io/dragonfly/v2/pkg/util/maputils"
"d7y.io/dragonfly/v2/pkg/util/rangeutils"
"github.com/pkg/errors"
)

const RangeHeaderName = "Range"

func (cm *Manager) download(ctx context.Context, task *types.SeedTask, detectResult *cacheResult) (io.ReadCloser, error) {
headers := maputils.DeepCopyMap(nil, task.Header)
headers := maputils.DeepCopy(task.Header)
if detectResult.breakPoint > 0 {
breakRange, err := rangeutils.GetBreakRange(detectResult.breakPoint, task.SourceFileLength)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/source/httpprotocol/http_source_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ import (
"time"

"d7y.io/dragonfly/v2/cdn/types"
"d7y.io/dragonfly/v2/pkg/util/maputils"
"d7y.io/dragonfly/v2/pkg/util/rangeutils"

"github.com/go-http-utils/headers"

"d7y.io/dragonfly/v2/pkg/source"
"d7y.io/dragonfly/v2/pkg/structure/maputils"
"d7y.io/dragonfly/v2/pkg/util/stringutils"
"d7y.io/dragonfly/v2/pkg/util/timeutils"
)
Expand Down Expand Up @@ -119,7 +119,7 @@ func (client *httpSourceClient) GetContentLength(ctx context.Context, url string
}

func (client *httpSourceClient) IsSupportRange(ctx context.Context, url string, header source.RequestHeader) (bool, error) {
copied := maputils.DeepCopyMap(nil, header)
copied := maputils.DeepCopy(header)
copied[headers.Range] = "bytes=0-0"

resp, err := client.doRequest(ctx, http.MethodGet, url, copied)
Expand All @@ -140,7 +140,7 @@ func (client *httpSourceClient) IsExpired(ctx context.Context, url string, heade
}

// set header: header is a reference to map, should not change it
copied := maputils.DeepCopyMap(nil, header)
copied := maputils.DeepCopy(header)
if lastModified > 0 {
copied[headers.IfModifiedSince] = expireInfo[headers.LastModified]
}
Expand Down
176 changes: 0 additions & 176 deletions pkg/structure/hashcircler/hash_circler.go

This file was deleted.

171 changes: 0 additions & 171 deletions pkg/structure/hashcircler/hash_circler_test.go

This file was deleted.

Loading

0 comments on commit 52cf43a

Please sign in to comment.