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
ld
go-ld-prime
Commits
89c40af3
Commit
89c40af3
authored
Mar 16, 2019
by
Eric Myhre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish creating cid in cidlink.LinkBuilder.
Signed-off-by:
Eric Myhre
<
hash@exultant.us
>
parent
57832ad7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
linking/cid/cidLink.go
linking/cid/cidLink.go
+6
-8
No files found.
linking/cid/cidLink.go
View file @
89c40af3
...
...
@@ -78,18 +78,16 @@ func (lb LinkBuilder) Build(ctx context.Context, lnkCtx ipld.LinkContext, node i
if
!
exists
{
return
nil
,
fmt
.
Errorf
(
"no encoder registered for multicodec %d"
,
lb
.
Prefix
.
MhType
)
}
var
hasher
bytes
.
Buffer
// multihash only exports bulk use, which is... really inefficient and should be fixed.
var
hasher
bytes
.
Buffer
// multihash
-via-cid
only exports bulk use, which is... really inefficient and should be fixed.
w
=
io
.
MultiWriter
(
&
hasher
,
w
)
err
=
mcEncoder
(
node
,
w
)
if
err
!=
nil
{
return
nil
,
err
}
hash
,
err
:=
multihash
.
Sum
(
hasher
.
Bytes
(),
lb
.
Prefix
.
MhType
,
lb
.
Prefix
.
MhLength
)
// FIXME finish making a CID out of this.
// the cid package is a maze of twisty little passages all alike and I don't honestly know what's up where why.
_
=
hash
if
err
:=
commit
(
nil
);
err
!=
nil
{
return
nil
,
err
cid
,
err
:=
lb
.
Prefix
.
Sum
(
hasher
.
Bytes
())
lnk
:=
Link
{
cid
}
if
err
:=
commit
(
lnk
);
err
!=
nil
{
return
lnk
,
err
}
panic
(
"TODO"
)
return
lnk
,
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