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
2ea1b470
Commit
2ea1b470
authored
Jan 15, 2019
by
Lucas Molas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
helpers: doc and TODOs
parent
b1b1f17d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
importer/helpers/dagbuilder.go
importer/helpers/dagbuilder.go
+7
-1
No files found.
importer/helpers/dagbuilder.go
View file @
2ea1b470
...
...
@@ -175,6 +175,8 @@ func (db *DagBuilderHelper) NewLeafNode(data []byte, fsNodeType pb.Data_DataType
// FillNodeLayer will add datanodes as children to the give node until
// it is full in this layer or no more data.
// NOTE: This function creates raw data nodes so it only works
// for the `trickle.Layout`.
func
(
db
*
DagBuilderHelper
)
FillNodeLayer
(
node
*
FSNodeOverDag
)
error
{
// while we have room AND we're not done
...
...
@@ -189,6 +191,8 @@ func (db *DagBuilderHelper) FillNodeLayer(node *FSNodeOverDag) error {
}
}
node
.
Commit
()
// TODO: Do we need to commit here? The caller who created the
// `FSNodeOverDag` should be in charge of that.
return
nil
}
...
...
@@ -344,7 +348,7 @@ func (n *FSNodeOverDag) RemoveChild(index int, dbh *DagBuilderHelper) {
// that represents them: the `ft.FSNode` is encoded inside the
// `dag.ProtoNode`.
//
// TODO:
Evaluate making
it read-only after committing.
// TODO:
Make
it read-only after committing
, allow to commit only once
.
func
(
n
*
FSNodeOverDag
)
Commit
()
(
ipld
.
Node
,
error
)
{
fileData
,
err
:=
n
.
file
.
GetBytes
()
if
err
!=
nil
{
...
...
@@ -375,6 +379,8 @@ func (n *FSNodeOverDag) SetFileData(fileData []byte) {
// GetDagNode fills out the proper formatting for the FSNodeOverDag node
// inside of a DAG node and returns the dag node.
// TODO: Check if we have committed (passed the UnixFS information
// to the DAG layer) before returning this.
func
(
n
*
FSNodeOverDag
)
GetDagNode
()
(
ipld
.
Node
,
error
)
{
return
n
.
dag
,
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