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-merkledag
Commits
c8d632c5
Unverified
Commit
c8d632c5
authored
Sep 30, 2019
by
postables
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coding.go: make getPBNode() public
parent
f5474e03
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
coding.go
coding.go
+6
-4
No files found.
coding.go
View file @
c8d632c5
...
...
@@ -5,8 +5,7 @@ import (
"sort"
"strings"
"github.com/ipfs/go-block-format"
blocks
"github.com/ipfs/go-block-format"
pb
"github.com/ipfs/go-merkledag/pb"
cid
"github.com/ipfs/go-cid"
...
...
@@ -49,7 +48,7 @@ func (n *ProtoNode) unmarshal(encoded []byte) error {
// Marshal encodes a *Node instance into a new byte slice.
// The conversion uses an intermediate PBNode.
func
(
n
*
ProtoNode
)
Marshal
()
([]
byte
,
error
)
{
pbn
:=
n
.
g
etPBNode
()
pbn
:=
n
.
G
etPBNode
()
data
,
err
:=
pbn
.
Marshal
()
if
err
!=
nil
{
return
data
,
fmt
.
Errorf
(
"marshal failed. %v"
,
err
)
...
...
@@ -57,7 +56,10 @@ func (n *ProtoNode) Marshal() ([]byte, error) {
return
data
,
nil
}
func
(
n
*
ProtoNode
)
getPBNode
()
*
pb
.
PBNode
{
// GetPBNode converts *ProtoNode into it's protocol buffer variant.
// If you plan on mutating the data of the original node, it is recommended
// that you call ProtoNode.Copy() before calling ProtoNode.GetPBNode()
func
(
n
*
ProtoNode
)
GetPBNode
()
*
pb
.
PBNode
{
pbn
:=
&
pb
.
PBNode
{}
if
len
(
n
.
links
)
>
0
{
pbn
.
Links
=
make
([]
*
pb
.
PBLink
,
len
(
n
.
links
))
...
...
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