Commit e02443c3 authored by Mildred Ki'Lya's avatar Mildred Ki'Lya

Rename Encoded() to EncodeProtobuf()

License: MIT
Signed-off-by: default avatarMildred Ki'Lya <mildred-pub.git@mildred.fr>
parent 00d312ea
......@@ -68,9 +68,9 @@ func (n *Node) getPBNode() *pb.PBNode {
return pbn
}
// Encoded returns the encoded raw data version of a Node instance.
// EncodeProtobuf returns the encoded raw data version of a Node instance.
// It may use a cached encoded version, unless the force flag is given.
func (n *Node) Encoded(force bool) ([]byte, error) {
func (n *Node) EncodeProtobuf(force bool) ([]byte, error) {
sort.Stable(LinkSlice(n.Links)) // keep links sorted
if n.encoded == nil || force {
var err error
......
......@@ -49,7 +49,7 @@ func (n *dagService) Add(nd *Node) (key.Key, error) {
return "", fmt.Errorf("dagService is nil")
}
d, err := nd.Encoded(false)
d, err := nd.EncodeProtobuf(false)
if err != nil {
return "", err
}
......@@ -313,7 +313,7 @@ type Batch struct {
}
func (t *Batch) Add(nd *Node) (key.Key, error) {
d, err := nd.Encoded(false)
d, err := nd.EncodeProtobuf(false)
if err != nil {
return "", err
}
......
......@@ -64,7 +64,7 @@ func TestNode(t *testing.T) {
fmt.Println("-", l.Name, l.Size, l.Hash)
}
e, err := n.Encoded(false)
e, err := n.EncodeProtobuf(false)
if err != nil {
t.Error(err)
} else {
......@@ -96,9 +96,9 @@ func TestNode(t *testing.T) {
}
func SubtestNodeStat(t *testing.T, n *Node) {
enc, err := n.Encoded(true)
enc, err := n.EncodeProtobuf(true)
if err != nil {
t.Error("n.Encoded(true) failed")
t.Error("n.EncodeProtobuf(true) failed")
return
}
......
......@@ -203,7 +203,7 @@ func (n *Node) UpdateNodeLink(name string, that *Node) (*Node, error) {
// Size returns the total size of the data addressed by node,
// including the total sizes of references.
func (n *Node) Size() (uint64, error) {
b, err := n.Encoded(false)
b, err := n.EncodeProtobuf(false)
if err != nil {
return 0, err
}
......@@ -217,7 +217,7 @@ func (n *Node) Size() (uint64, error) {
// Stat returns statistics on the node.
func (n *Node) Stat() (*NodeStat, error) {
enc, err := n.Encoded(false)
enc, err := n.EncodeProtobuf(false)
if err != nil {
return nil, err
}
......@@ -244,8 +244,8 @@ func (n *Node) Stat() (*NodeStat, error) {
// Multihash hashes the encoded data of this node.
func (n *Node) Multihash() (mh.Multihash, error) {
// Note: Encoded generates the hash and puts it in n.cached.
_, err := n.Encoded(false)
// Note: EncodeProtobuf generates the hash and puts it in n.cached.
_, err := n.EncodeProtobuf(false)
if err != nil {
return nil, err
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment