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
704534e5
Commit
704534e5
authored
Jan 22, 2018
by
ForrestWeston
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs for coreapi dag method impls
License: MIT Signed-off-by:
ForrestWeston
<
forrest@protocol.ai
>
parent
1eee9e20
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
core/coreapi/dag.go
core/coreapi/dag.go
+5
-0
No files found.
core/coreapi/dag.go
View file @
704534e5
...
...
@@ -19,6 +19,9 @@ type DagAPI struct {
*
caopts
.
DagOptions
}
// Put inserts data using specified format and input encoding. Unless used with
// `WithCodes` or `WithHash`, the defaults "dag-cbor" and "sha256" are used.
// Returns the path of the inserted data.
func
(
api
*
DagAPI
)
Put
(
ctx
context
.
Context
,
src
io
.
Reader
,
opts
...
caopts
.
DagPutOption
)
(
coreiface
.
Path
,
error
)
{
settings
,
err
:=
caopts
.
DagPutOptions
(
opts
...
)
if
err
!=
nil
{
...
...
@@ -46,10 +49,12 @@ func (api *DagAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.DagPut
return
ParseCid
(
nds
[
0
]
.
Cid
()),
nil
}
// Get resolves `path` using Unixfs resolver, returns the resolved Node.
func
(
api
*
DagAPI
)
Get
(
ctx
context
.
Context
,
path
coreiface
.
Path
)
(
coreiface
.
Node
,
error
)
{
return
api
.
core
()
.
ResolveNode
(
ctx
,
path
)
}
// Tree returns list of paths within a node specified by the path `p`.
func
(
api
*
DagAPI
)
Tree
(
ctx
context
.
Context
,
p
coreiface
.
Path
,
opts
...
caopts
.
DagTreeOption
)
([]
coreiface
.
Path
,
error
)
{
settings
,
err
:=
caopts
.
DagTreeOptions
(
opts
...
)
if
err
!=
nil
{
...
...
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