Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
7dbeb27e
Commit
7dbeb27e
authored
Oct 16, 2018
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
namesys: review fixes
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
94bbeffa
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
14 deletions
+27
-14
core/coreapi/interface/name.go
core/coreapi/interface/name.go
+0
-1
core/coreapi/name.go
core/coreapi/name.go
+1
-2
core/corehttp/gateway_test.go
core/corehttp/gateway_test.go
+1
-1
namesys/base.go
namesys/base.go
+9
-7
namesys/dns.go
namesys/dns.go
+1
-0
namesys/namesys.go
namesys/namesys.go
+15
-3
No files found.
core/coreapi/interface/name.go
View file @
7dbeb27e
...
...
@@ -2,7 +2,6 @@ package iface
import
(
"context"
"errors"
options
"github.com/ipfs/go-ipfs/core/coreapi/interface/options"
...
...
core/coreapi/name.go
View file @
7dbeb27e
...
...
@@ -7,8 +7,6 @@ import (
"strings"
"time"
ipath
"gx/ipfs/QmdrpbDgeYH3VxkCciQCJY5LkDYdXtig6unDzQmMxFtWEw/go-path"
"github.com/ipfs/go-ipfs/core"
coreiface
"github.com/ipfs/go-ipfs/core/coreapi/interface"
caopts
"github.com/ipfs/go-ipfs/core/coreapi/interface/options"
...
...
@@ -18,6 +16,7 @@ import (
"gx/ipfs/QmPvyPwuCgJ7pDmrKDxRtsScJgBaM5h4EpRL2qQJsmXf4n/go-libp2p-crypto"
"gx/ipfs/QmQ9PR61a8rwEFuFNs7JMA1QtQC9yZnBwoDn51JWXDbaTd/go-ipfs-routing/offline"
"gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer"
ipath
"gx/ipfs/QmdrpbDgeYH3VxkCciQCJY5LkDYdXtig6unDzQmMxFtWEw/go-path"
)
type
NameAPI
CoreAPI
...
...
core/corehttp/gateway_test.go
View file @
7dbeb27e
...
...
@@ -62,7 +62,7 @@ func (m mockNamesys) ResolveAsync(ctx context.Context, name string, opts ...nsop
v
,
err
:=
m
.
Resolve
(
ctx
,
name
,
opts
...
)
out
<-
namesys
.
Result
{
Path
:
v
,
Err
:
err
}
close
(
out
)
return
nil
return
out
}
func
(
m
mockNamesys
)
Publish
(
ctx
context
.
Context
,
name
ci
.
PrivKey
,
value
path
.
Path
)
error
{
...
...
namesys/base.go
View file @
7dbeb27e
package
namesys
import
(
"context"
"strings"
"time"
context
"context"
opts
"github.com/ipfs/go-ipfs/namesys/opts"
path
"gx/ipfs/QmdrpbDgeYH3VxkCciQCJY5LkDYdXtig6unDzQmMxFtWEw/go-path"
)
...
...
@@ -40,13 +40,10 @@ func resolve(ctx context.Context, r resolver, name string, options opts.ResolveO
return
p
,
err
}
//TODO:
// - better error handling
// - select on writes
func
resolveAsync
(
ctx
context
.
Context
,
r
resolver
,
name
string
,
options
opts
.
ResolveOpts
,
prefix
string
)
<-
chan
Result
{
resCh
:=
r
.
resolveOnceAsync
(
ctx
,
name
,
options
)
depth
:=
options
.
Depth
outCh
:=
make
(
chan
Result
)
outCh
:=
make
(
chan
Result
,
1
)
go
func
()
{
defer
close
(
outCh
)
...
...
@@ -97,8 +94,13 @@ func resolveAsync(ctx context.Context, r resolver, name string, options opts.Res
break
}
outCh
<-
res
select
{
case
outCh
<-
res
:
case
<-
ctx
.
Done
()
:
return
}
case
<-
ctx
.
Done
()
:
return
}
if
resCh
==
nil
&&
subCh
==
nil
{
return
...
...
namesys/dns.go
View file @
7dbeb27e
...
...
@@ -7,6 +7,7 @@ import (
"strings"
opts
"github.com/ipfs/go-ipfs/namesys/opts"
isd
"gx/ipfs/QmZmmuAXgX73UQmX1jRKjTGmjzq24Jinqkq8vzkBtno4uX/go-is-domain"
path
"gx/ipfs/QmdrpbDgeYH3VxkCciQCJY5LkDYdXtig6unDzQmMxFtWEw/go-path"
)
...
...
namesys/namesys.go
View file @
7dbeb27e
...
...
@@ -5,9 +5,10 @@ import (
"strings"
"time"
opts
"github.com/ipfs/go-ipfs/namesys/opts"
path
"gx/ipfs/QmdrpbDgeYH3VxkCciQCJY5LkDYdXtig6unDzQmMxFtWEw/go-path"
opts
"github.com/ipfs/go-ipfs/namesys/opts"
routing
"gx/ipfs/QmPmFeQ5oY5G6M7aBWggi5phxEPXwsQntE1DFcUzETULdp/go-libp2p-routing"
mh
"gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash"
ci
"gx/ipfs/QmPvyPwuCgJ7pDmrKDxRtsScJgBaM5h4EpRL2qQJsmXf4n/go-libp2p-crypto"
...
...
@@ -138,10 +139,21 @@ func (ns *mpns) resolveOnceAsync(ctx context.Context, name string, options opts.
// Attach rest of the path
if
len
(
segments
)
>
3
{
p
,
_
=
path
.
FromSegments
(
""
,
strings
.
TrimRight
(
p
.
String
(),
"/"
),
segments
[
3
])
p
,
err
:=
path
.
FromSegments
(
""
,
strings
.
TrimRight
(
p
.
String
(),
"/"
),
segments
[
3
])
if
err
!=
nil
{
select
{
case
out
<-
onceResult
{
value
:
p
,
err
:
err
}
:
case
<-
ctx
.
Done
()
:
}
return
}
}
out
<-
onceResult
{
value
:
p
,
err
:
res
.
err
}
select
{
case
out
<-
onceResult
{
value
:
p
,
ttl
:
res
.
ttl
,
err
:
res
.
err
}
:
case
<-
ctx
.
Done
()
:
return
}
case
<-
ctx
.
Done
()
:
return
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment