Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
go-ipfs
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
ipfs
go-ipfs
Commits
1c114967
Commit
1c114967
authored
7 years ago
by
ForrestWeston
Browse files
Options
Downloads
Patches
Plain Diff
docs for coreunix add method impls
License: MIT Signed-off-by:
ForrestWeston
<
forrest@protocol.ai
>
parent
8637bbce
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/coreunix/add.go
+7
-0
7 additions, 0 deletions
core/coreunix/add.go
with
7 additions
and
0 deletions
core/coreunix/add.go
+
7
−
0
View file @
1c114967
...
...
@@ -73,6 +73,7 @@ type AddedObject struct {
Size
string
`json:",omitempty"`
}
// NewAdder Returns a new Adder used for a file add operation.
func
NewAdder
(
ctx
context
.
Context
,
p
pin
.
Pinner
,
bs
bstore
.
GCBlockstore
,
ds
dag
.
DAGService
)
(
*
Adder
,
error
)
{
return
&
Adder
{
ctx
:
ctx
,
...
...
@@ -126,6 +127,7 @@ func (adder *Adder) mfsRoot() (*mfs.Root, error) {
return
adder
.
mroot
,
nil
}
// SetMfsRoot sets `r` as the root for Adder.
func
(
adder
*
Adder
)
SetMfsRoot
(
r
*
mfs
.
Root
)
{
adder
.
mroot
=
r
}
...
...
@@ -152,6 +154,7 @@ func (adder *Adder) add(reader io.Reader) (node.Node, error) {
return
balanced
.
BalancedLayout
(
params
.
New
(
chnk
))
}
// RootNode returns the root node of the Added.
func
(
adder
*
Adder
)
RootNode
()
(
node
.
Node
,
error
)
{
// for memoizing
if
adder
.
root
!=
nil
{
...
...
@@ -181,6 +184,8 @@ func (adder *Adder) RootNode() (node.Node, error) {
return
root
,
err
}
// Recursively pins the root node of Adder and
// writes the pin state to the backing datastore.
func
(
adder
*
Adder
)
PinRoot
()
error
{
root
,
err
:=
adder
.
RootNode
()
if
err
!=
nil
{
...
...
@@ -207,6 +212,7 @@ func (adder *Adder) PinRoot() error {
return
adder
.
pinning
.
Flush
()
}
// Finalize flushes the mfs root directory and returns the mfs root node.
func
(
adder
*
Adder
)
Finalize
()
(
node
.
Node
,
error
)
{
mr
,
err
:=
adder
.
mfsRoot
()
if
err
!=
nil
{
...
...
@@ -566,6 +572,7 @@ func outputDagnode(out chan interface{}, name string, dn node.Node) error {
return
nil
}
// NewMemoryDagService builds and returns a new mem-datastore.
func
NewMemoryDagService
()
dag
.
DAGService
{
// build mem-datastore for editor's intermediary nodes
bs
:=
bstore
.
NewBlockstore
(
syncds
.
MutexWrap
(
ds
.
NewMapDatastore
()))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment