From 2312cbaf222f464f257535139b1f810295906f64 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Thu, 12 Oct 2023 13:57:37 +1100 Subject: [PATCH] fix: entity-bytes=0:0 fix for sharded files Ref: https://github.com/ipld/ipld/pull/309 --- go.mod | 2 +- go.sum | 4 ++-- types.go | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 7d4f1e0..aed0462 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/ipld/go-car/v2 v2.13.1 github.com/ipld/go-codec-dagpb v1.6.0 github.com/ipld/go-ipld-prime v0.21.0 - github.com/ipld/ipld/specs v0.0.0-20230907004443-0e4ff95ff474 + github.com/ipld/ipld/specs v0.0.0-20231012031213-54d3b21deda4 github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c github.com/multiformats/go-multihash v0.2.3 github.com/stretchr/testify v1.8.4 diff --git a/go.sum b/go.sum index 9b5b86c..c8389e8 100644 --- a/go.sum +++ b/go.sum @@ -72,8 +72,8 @@ github.com/ipld/go-codec-dagpb v1.6.0/go.mod h1:ANzFhfP2uMJxRBr8CE+WQWs5UsNa0pYt github.com/ipld/go-ipld-prime v0.21.0 h1:n4JmcpOlPDIxBcY037SVfpd1G+Sj1nKZah0m6QH9C2E= github.com/ipld/go-ipld-prime v0.21.0/go.mod h1:3RLqy//ERg/y5oShXXdx5YIp50cFGOanyMctpPjsvxQ= github.com/ipld/go-ipld-prime/storage/bsadapter v0.0.0-20230102063945-1a409dc236dd h1:gMlw/MhNr2Wtp5RwGdsW23cs+yCuj9k2ON7i9MiJlRo= -github.com/ipld/ipld/specs v0.0.0-20230907004443-0e4ff95ff474 h1:CiDtcUFyzRwhKyiS4Gn+fzdraMoNVtPHd+wVIekExPc= -github.com/ipld/ipld/specs v0.0.0-20230907004443-0e4ff95ff474/go.mod h1:WcT0DfRe+e2QFY0kcbsOnuT6jL5Q0JNZ83I5DHIdStg= +github.com/ipld/ipld/specs v0.0.0-20231012031213-54d3b21deda4 h1:0VXv637/xpI0Pb5J8K+K8iRtTw4DOcxs0MB1HMzfwNY= +github.com/ipld/ipld/specs v0.0.0-20231012031213-54d3b21deda4/go.mod h1:WcT0DfRe+e2QFY0kcbsOnuT6jL5Q0JNZ83I5DHIdStg= github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c h1:uUx61FiAa1GI6ZmVd2wf2vULeQZIKG66eybjNXKYCz4= github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c/go.mod h1:sdx1xVM9UuLw1tXnhJWN3piypTUO3vCIHYmG15KE/dU= github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= diff --git a/types.go b/types.go index f2d65f2..e0fe4ad 100644 --- a/types.go +++ b/types.go @@ -22,9 +22,11 @@ var matcherSelector = builder.NewSelectorSpecBuilder(basicnode.Prototype.Any).Ma // Gateway protocol. type DagScope string -const DagScopeAll DagScope = "all" -const DagScopeEntity DagScope = "entity" -const DagScopeBlock DagScope = "block" +const ( + DagScopeAll DagScope = "all" + DagScopeEntity DagScope = "entity" + DagScopeBlock DagScope = "block" +) // ParseDagScope parses a string form of a DagScope into a DagScope. func ParseDagScope(s string) (DagScope, error) { @@ -144,7 +146,7 @@ func (r Request) Selector() datamodel.Node { var to int64 = math.MaxInt64 if r.Bytes.To != nil { to = *r.Bytes.To - if to > 0 { + if to >= 0 { to++ // selector is exclusive, so increment the end } }