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-unixfs
Commits
7b98bf80
Commit
7b98bf80
authored
Jul 05, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaned up interface to use DAG
parent
9f542f87
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
4 additions
and
13 deletions
+4
-13
cli/add.go
cli/add.go
+1
-1
cli/cat.go
cli/cat.go
+1
-1
cli/ls.go
cli/ls.go
+1
-1
cli/refs.go
cli/refs.go
+1
-1
core/core.go
core/core.go
+0
-9
No files found.
cli/add.go
View file @
7b98bf80
...
@@ -119,7 +119,7 @@ func addFile(n *core.IpfsNode, fpath string, depth int) (*dag.Node, error) {
...
@@ -119,7 +119,7 @@ func addFile(n *core.IpfsNode, fpath string, depth int) (*dag.Node, error) {
// addNode adds the node to the graph + local storage
// addNode adds the node to the graph + local storage
func
addNode
(
n
*
core
.
IpfsNode
,
nd
*
dag
.
Node
,
fpath
string
)
error
{
func
addNode
(
n
*
core
.
IpfsNode
,
nd
*
dag
.
Node
,
fpath
string
)
error
{
// add the file to the graph + local storage
// add the file to the graph + local storage
k
,
err
:=
n
.
AddDagNode
(
nd
)
k
,
err
:=
n
.
DAG
.
Put
(
nd
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
cli/cat.go
View file @
7b98bf80
...
@@ -37,7 +37,7 @@ func catCmd(c *commander.Command, inp []string) error {
...
@@ -37,7 +37,7 @@ func catCmd(c *commander.Command, inp []string) error {
return
err
return
err
}
}
nd
,
err
:=
n
.
GetDagNode
(
u
.
Key
(
h
))
nd
,
err
:=
n
.
DAG
.
Get
(
u
.
Key
(
h
))
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
cli/ls.go
View file @
7b98bf80
...
@@ -40,7 +40,7 @@ func lsCmd(c *commander.Command, inp []string) error {
...
@@ -40,7 +40,7 @@ func lsCmd(c *commander.Command, inp []string) error {
return
err
return
err
}
}
nd
,
err
:=
n
.
GetDagNode
(
u
.
Key
(
h
))
nd
,
err
:=
n
.
DAG
.
Get
(
u
.
Key
(
h
))
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
cli/refs.go
View file @
7b98bf80
...
@@ -58,7 +58,7 @@ func refCmd(c *commander.Command, inp []string) error {
...
@@ -58,7 +58,7 @@ func refCmd(c *commander.Command, inp []string) error {
var
printRefs
func
(
h
mh
.
Multihash
,
recursive
bool
)
var
printRefs
func
(
h
mh
.
Multihash
,
recursive
bool
)
printRefs
=
func
(
h
mh
.
Multihash
,
recursive
bool
)
{
printRefs
=
func
(
h
mh
.
Multihash
,
recursive
bool
)
{
nd
,
err
:=
n
.
GetDagNode
(
u
.
Key
(
h
))
nd
,
err
:=
n
.
DAG
.
Get
(
u
.
Key
(
h
))
if
err
!=
nil
{
if
err
!=
nil
{
u
.
PErr
(
"error: cannot retrieve %s (%s)
\n
"
,
h
.
B58String
(),
err
)
u
.
PErr
(
"error: cannot retrieve %s (%s)
\n
"
,
h
.
B58String
(),
err
)
return
return
...
...
core/core.go
View file @
7b98bf80
...
@@ -7,7 +7,6 @@ import (
...
@@ -7,7 +7,6 @@ import (
config
"github.com/jbenet/go-ipfs/config"
config
"github.com/jbenet/go-ipfs/config"
merkledag
"github.com/jbenet/go-ipfs/merkledag"
merkledag
"github.com/jbenet/go-ipfs/merkledag"
peer
"github.com/jbenet/go-ipfs/peer"
peer
"github.com/jbenet/go-ipfs/peer"
u
"github.com/jbenet/go-ipfs/util"
)
)
// IPFS Core module. It represents an IPFS instance.
// IPFS Core module. It represents an IPFS instance.
...
@@ -74,11 +73,3 @@ func NewIpfsNode(cfg *config.Config) (*IpfsNode, error) {
...
@@ -74,11 +73,3 @@ func NewIpfsNode(cfg *config.Config) (*IpfsNode, error) {
return
n
,
nil
return
n
,
nil
}
}
func
(
n
*
IpfsNode
)
AddDagNode
(
nd
*
merkledag
.
Node
)
(
u
.
Key
,
error
)
{
return
n
.
DAG
.
Put
(
nd
)
}
func
(
n
*
IpfsNode
)
GetDagNode
(
k
u
.
Key
)
(
*
merkledag
.
Node
,
error
)
{
return
n
.
DAG
.
Get
(
k
)
}
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