Commit d45513e0 authored by Brian Tiger Chow's avatar Brian Tiger Chow

fix(merkledag/pb) rename proto package -> merkledag_pb

parent 05e10f8e
PB = $(wildcard *.proto)
GO = $(PB:.proto=.pb.go)
all: node.pb.go all: $(GO)
node.pb.go: node.proto %.pb.go: %.proto
protoc --gogo_out=. --proto_path=../../../../:/usr/local/opt/protobuf/include:. $< protoc --gogo_out=. --proto_path=../../../../../../:/usr/local/opt/protobuf/include:. $<
clean: clean:
rm node.pb.go rm -f *.pb.go
rm -f *.go
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo.
// source: node.proto // source: merkledag.proto
// DO NOT EDIT! // DO NOT EDIT!
/* /*
Package merkledag is a generated protocol buffer package. Package merkledag_pb is a generated protocol buffer package.
It is generated from these files: It is generated from these files:
node.proto merkledag.proto
It has these top-level messages: It has these top-level messages:
PBLink PBLink
PBNode PBNode
*/ */
package merkledag package merkledag_pb
import proto "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/proto" import proto "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/proto"
import math "math" import math "math"
...@@ -300,9 +300,9 @@ func (this *PBLink) String() string { ...@@ -300,9 +300,9 @@ func (this *PBLink) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&PBLink{`, s := strings.Join([]string{`&PBLink{`,
`Hash:` + valueToStringNode(this.Hash) + `,`, `Hash:` + valueToStringMerkledag(this.Hash) + `,`,
`Name:` + valueToStringNode(this.Name) + `,`, `Name:` + valueToStringMerkledag(this.Name) + `,`,
`Tsize:` + valueToStringNode(this.Tsize) + `,`, `Tsize:` + valueToStringMerkledag(this.Tsize) + `,`,
`XXX_unrecognized:` + fmt1.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt1.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
...@@ -314,13 +314,13 @@ func (this *PBNode) String() string { ...@@ -314,13 +314,13 @@ func (this *PBNode) String() string {
} }
s := strings.Join([]string{`&PBNode{`, s := strings.Join([]string{`&PBNode{`,
`Links:` + strings.Replace(fmt1.Sprintf("%v", this.Links), "PBLink", "PBLink", 1) + `,`, `Links:` + strings.Replace(fmt1.Sprintf("%v", this.Links), "PBLink", "PBLink", 1) + `,`,
`Data:` + valueToStringNode(this.Data) + `,`, `Data:` + valueToStringMerkledag(this.Data) + `,`,
`XXX_unrecognized:` + fmt1.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt1.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
return s return s
} }
func valueToStringNode(v interface{}) string { func valueToStringMerkledag(v interface{}) string {
rv := reflect.ValueOf(v) rv := reflect.ValueOf(v)
if rv.IsNil() { if rv.IsNil() {
return "nil" return "nil"
...@@ -333,14 +333,14 @@ func (m *PBLink) Size() (n int) { ...@@ -333,14 +333,14 @@ func (m *PBLink) Size() (n int) {
_ = l _ = l
if m.Hash != nil { if m.Hash != nil {
l = len(m.Hash) l = len(m.Hash)
n += 1 + l + sovNode(uint64(l)) n += 1 + l + sovMerkledag(uint64(l))
} }
if m.Name != nil { if m.Name != nil {
l = len(*m.Name) l = len(*m.Name)
n += 1 + l + sovNode(uint64(l)) n += 1 + l + sovMerkledag(uint64(l))
} }
if m.Tsize != nil { if m.Tsize != nil {
n += 1 + sovNode(uint64(*m.Tsize)) n += 1 + sovMerkledag(uint64(*m.Tsize))
} }
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
...@@ -353,12 +353,12 @@ func (m *PBNode) Size() (n int) { ...@@ -353,12 +353,12 @@ func (m *PBNode) Size() (n int) {
if len(m.Links) > 0 { if len(m.Links) > 0 {
for _, e := range m.Links { for _, e := range m.Links {
l = e.Size() l = e.Size()
n += 1 + l + sovNode(uint64(l)) n += 1 + l + sovMerkledag(uint64(l))
} }
} }
if m.Data != nil { if m.Data != nil {
l = len(m.Data) l = len(m.Data)
n += 1 + l + sovNode(uint64(l)) n += 1 + l + sovMerkledag(uint64(l))
} }
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
...@@ -366,7 +366,7 @@ func (m *PBNode) Size() (n int) { ...@@ -366,7 +366,7 @@ func (m *PBNode) Size() (n int) {
return n return n
} }
func sovNode(x uint64) (n int) { func sovMerkledag(x uint64) (n int) {
for { for {
n++ n++
x >>= 7 x >>= 7
...@@ -376,10 +376,10 @@ func sovNode(x uint64) (n int) { ...@@ -376,10 +376,10 @@ func sovNode(x uint64) (n int) {
} }
return n return n
} }
func sozNode(x uint64) (n int) { func sozMerkledag(x uint64) (n int) {
return sovNode(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovMerkledag(uint64((x << 1) ^ uint64((int64(x) >> 63))))
} }
func NewPopulatedPBLink(r randyNode, easy bool) *PBLink { func NewPopulatedPBLink(r randyMerkledag, easy bool) *PBLink {
this := &PBLink{} this := &PBLink{}
if r.Intn(10) != 0 { if r.Intn(10) != 0 {
v1 := r.Intn(100) v1 := r.Intn(100)
...@@ -389,7 +389,7 @@ func NewPopulatedPBLink(r randyNode, easy bool) *PBLink { ...@@ -389,7 +389,7 @@ func NewPopulatedPBLink(r randyNode, easy bool) *PBLink {
} }
} }
if r.Intn(10) != 0 { if r.Intn(10) != 0 {
v2 := randStringNode(r) v2 := randStringMerkledag(r)
this.Name = &v2 this.Name = &v2
} }
if r.Intn(10) != 0 { if r.Intn(10) != 0 {
...@@ -397,12 +397,12 @@ func NewPopulatedPBLink(r randyNode, easy bool) *PBLink { ...@@ -397,12 +397,12 @@ func NewPopulatedPBLink(r randyNode, easy bool) *PBLink {
this.Tsize = &v3 this.Tsize = &v3
} }
if !easy && r.Intn(10) != 0 { if !easy && r.Intn(10) != 0 {
this.XXX_unrecognized = randUnrecognizedNode(r, 4) this.XXX_unrecognized = randUnrecognizedMerkledag(r, 4)
} }
return this return this
} }
func NewPopulatedPBNode(r randyNode, easy bool) *PBNode { func NewPopulatedPBNode(r randyMerkledag, easy bool) *PBNode {
this := &PBNode{} this := &PBNode{}
if r.Intn(10) != 0 { if r.Intn(10) != 0 {
v4 := r.Intn(10) v4 := r.Intn(10)
...@@ -419,12 +419,12 @@ func NewPopulatedPBNode(r randyNode, easy bool) *PBNode { ...@@ -419,12 +419,12 @@ func NewPopulatedPBNode(r randyNode, easy bool) *PBNode {
} }
} }
if !easy && r.Intn(10) != 0 { if !easy && r.Intn(10) != 0 {
this.XXX_unrecognized = randUnrecognizedNode(r, 3) this.XXX_unrecognized = randUnrecognizedMerkledag(r, 3)
} }
return this return this
} }
type randyNode interface { type randyMerkledag interface {
Float32() float32 Float32() float32
Float64() float64 Float64() float64
Int63() int64 Int63() int64
...@@ -433,22 +433,22 @@ type randyNode interface { ...@@ -433,22 +433,22 @@ type randyNode interface {
Intn(n int) int Intn(n int) int
} }
func randUTF8RuneNode(r randyNode) rune { func randUTF8RuneMerkledag(r randyMerkledag) rune {
res := rune(r.Uint32() % 1112064) res := rune(r.Uint32() % 1112064)
if 55296 <= res { if 55296 <= res {
res += 2047 res += 2047
} }
return res return res
} }
func randStringNode(r randyNode) string { func randStringMerkledag(r randyMerkledag) string {
v6 := r.Intn(100) v6 := r.Intn(100)
tmps := make([]rune, v6) tmps := make([]rune, v6)
for i := 0; i < v6; i++ { for i := 0; i < v6; i++ {
tmps[i] = randUTF8RuneNode(r) tmps[i] = randUTF8RuneMerkledag(r)
} }
return string(tmps) return string(tmps)
} }
func randUnrecognizedNode(r randyNode, maxFieldNumber int) (data []byte) { func randUnrecognizedMerkledag(r randyMerkledag, maxFieldNumber int) (data []byte) {
l := r.Intn(5) l := r.Intn(5)
for i := 0; i < l; i++ { for i := 0; i < l; i++ {
wire := r.Intn(4) wire := r.Intn(4)
...@@ -456,37 +456,37 @@ func randUnrecognizedNode(r randyNode, maxFieldNumber int) (data []byte) { ...@@ -456,37 +456,37 @@ func randUnrecognizedNode(r randyNode, maxFieldNumber int) (data []byte) {
wire = 5 wire = 5
} }
fieldNumber := maxFieldNumber + r.Intn(100) fieldNumber := maxFieldNumber + r.Intn(100)
data = randFieldNode(data, r, fieldNumber, wire) data = randFieldMerkledag(data, r, fieldNumber, wire)
} }
return data return data
} }
func randFieldNode(data []byte, r randyNode, fieldNumber int, wire int) []byte { func randFieldMerkledag(data []byte, r randyMerkledag, fieldNumber int, wire int) []byte {
key := uint32(fieldNumber)<<3 | uint32(wire) key := uint32(fieldNumber)<<3 | uint32(wire)
switch wire { switch wire {
case 0: case 0:
data = encodeVarintPopulateNode(data, uint64(key)) data = encodeVarintPopulateMerkledag(data, uint64(key))
v7 := r.Int63() v7 := r.Int63()
if r.Intn(2) == 0 { if r.Intn(2) == 0 {
v7 *= -1 v7 *= -1
} }
data = encodeVarintPopulateNode(data, uint64(v7)) data = encodeVarintPopulateMerkledag(data, uint64(v7))
case 1: case 1:
data = encodeVarintPopulateNode(data, uint64(key)) data = encodeVarintPopulateMerkledag(data, uint64(key))
data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
case 2: case 2:
data = encodeVarintPopulateNode(data, uint64(key)) data = encodeVarintPopulateMerkledag(data, uint64(key))
ll := r.Intn(100) ll := r.Intn(100)
data = encodeVarintPopulateNode(data, uint64(ll)) data = encodeVarintPopulateMerkledag(data, uint64(ll))
for j := 0; j < ll; j++ { for j := 0; j < ll; j++ {
data = append(data, byte(r.Intn(256))) data = append(data, byte(r.Intn(256)))
} }
default: default:
data = encodeVarintPopulateNode(data, uint64(key)) data = encodeVarintPopulateMerkledag(data, uint64(key))
data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
} }
return data return data
} }
func encodeVarintPopulateNode(data []byte, v uint64) []byte { func encodeVarintPopulateMerkledag(data []byte, v uint64) []byte {
for v >= 1<<7 { for v >= 1<<7 {
data = append(data, uint8(uint64(v)&0x7f|0x80)) data = append(data, uint8(uint64(v)&0x7f|0x80))
v >>= 7 v >>= 7
...@@ -512,19 +512,19 @@ func (m *PBLink) MarshalTo(data []byte) (n int, err error) { ...@@ -512,19 +512,19 @@ func (m *PBLink) MarshalTo(data []byte) (n int, err error) {
if m.Hash != nil { if m.Hash != nil {
data[i] = 0xa data[i] = 0xa
i++ i++
i = encodeVarintNode(data, i, uint64(len(m.Hash))) i = encodeVarintMerkledag(data, i, uint64(len(m.Hash)))
i += copy(data[i:], m.Hash) i += copy(data[i:], m.Hash)
} }
if m.Name != nil { if m.Name != nil {
data[i] = 0x12 data[i] = 0x12
i++ i++
i = encodeVarintNode(data, i, uint64(len(*m.Name))) i = encodeVarintMerkledag(data, i, uint64(len(*m.Name)))
i += copy(data[i:], *m.Name) i += copy(data[i:], *m.Name)
} }
if m.Tsize != nil { if m.Tsize != nil {
data[i] = 0x18 data[i] = 0x18
i++ i++
i = encodeVarintNode(data, i, uint64(*m.Tsize)) i = encodeVarintMerkledag(data, i, uint64(*m.Tsize))
} }
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(data[i:], m.XXX_unrecognized) i += copy(data[i:], m.XXX_unrecognized)
...@@ -550,7 +550,7 @@ func (m *PBNode) MarshalTo(data []byte) (n int, err error) { ...@@ -550,7 +550,7 @@ func (m *PBNode) MarshalTo(data []byte) (n int, err error) {
for _, msg := range m.Links { for _, msg := range m.Links {
data[i] = 0x12 data[i] = 0x12
i++ i++
i = encodeVarintNode(data, i, uint64(msg.Size())) i = encodeVarintMerkledag(data, i, uint64(msg.Size()))
n, err := msg.MarshalTo(data[i:]) n, err := msg.MarshalTo(data[i:])
if err != nil { if err != nil {
return 0, err return 0, err
...@@ -561,7 +561,7 @@ func (m *PBNode) MarshalTo(data []byte) (n int, err error) { ...@@ -561,7 +561,7 @@ func (m *PBNode) MarshalTo(data []byte) (n int, err error) {
if m.Data != nil { if m.Data != nil {
data[i] = 0xa data[i] = 0xa
i++ i++
i = encodeVarintNode(data, i, uint64(len(m.Data))) i = encodeVarintMerkledag(data, i, uint64(len(m.Data)))
i += copy(data[i:], m.Data) i += copy(data[i:], m.Data)
} }
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
...@@ -569,7 +569,7 @@ func (m *PBNode) MarshalTo(data []byte) (n int, err error) { ...@@ -569,7 +569,7 @@ func (m *PBNode) MarshalTo(data []byte) (n int, err error) {
} }
return i, nil return i, nil
} }
func encodeFixed64Node(data []byte, offset int, v uint64) int { func encodeFixed64Merkledag(data []byte, offset int, v uint64) int {
data[offset] = uint8(v) data[offset] = uint8(v)
data[offset+1] = uint8(v >> 8) data[offset+1] = uint8(v >> 8)
data[offset+2] = uint8(v >> 16) data[offset+2] = uint8(v >> 16)
...@@ -580,14 +580,14 @@ func encodeFixed64Node(data []byte, offset int, v uint64) int { ...@@ -580,14 +580,14 @@ func encodeFixed64Node(data []byte, offset int, v uint64) int {
data[offset+7] = uint8(v >> 56) data[offset+7] = uint8(v >> 56)
return offset + 8 return offset + 8
} }
func encodeFixed32Node(data []byte, offset int, v uint32) int { func encodeFixed32Merkledag(data []byte, offset int, v uint32) int {
data[offset] = uint8(v) data[offset] = uint8(v)
data[offset+1] = uint8(v >> 8) data[offset+1] = uint8(v >> 8)
data[offset+2] = uint8(v >> 16) data[offset+2] = uint8(v >> 16)
data[offset+3] = uint8(v >> 24) data[offset+3] = uint8(v >> 24)
return offset + 4 return offset + 4
} }
func encodeVarintNode(data []byte, offset int, v uint64) int { func encodeVarintMerkledag(data []byte, offset int, v uint64) int {
for v >= 1<<7 { for v >= 1<<7 {
data[offset] = uint8(v&0x7f | 0x80) data[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
...@@ -600,17 +600,17 @@ func (this *PBLink) GoString() string { ...@@ -600,17 +600,17 @@ func (this *PBLink) GoString() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
s := strings1.Join([]string{`&merkledag.PBLink{` + `Hash:` + valueToGoStringNode(this.Hash, "byte"), `Name:` + valueToGoStringNode(this.Name, "string"), `Tsize:` + valueToGoStringNode(this.Tsize, "uint64"), `XXX_unrecognized:` + fmt2.Sprintf("%#v", this.XXX_unrecognized) + `}`}, ", ") s := strings1.Join([]string{`&merkledag_pb.PBLink{` + `Hash:` + valueToGoStringMerkledag(this.Hash, "byte"), `Name:` + valueToGoStringMerkledag(this.Name, "string"), `Tsize:` + valueToGoStringMerkledag(this.Tsize, "uint64"), `XXX_unrecognized:` + fmt2.Sprintf("%#v", this.XXX_unrecognized) + `}`}, ", ")
return s return s
} }
func (this *PBNode) GoString() string { func (this *PBNode) GoString() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
s := strings1.Join([]string{`&merkledag.PBNode{` + `Links:` + fmt2.Sprintf("%#v", this.Links), `Data:` + valueToGoStringNode(this.Data, "byte"), `XXX_unrecognized:` + fmt2.Sprintf("%#v", this.XXX_unrecognized) + `}`}, ", ") s := strings1.Join([]string{`&merkledag_pb.PBNode{` + `Links:` + fmt2.Sprintf("%#v", this.Links), `Data:` + valueToGoStringMerkledag(this.Data, "byte"), `XXX_unrecognized:` + fmt2.Sprintf("%#v", this.XXX_unrecognized) + `}`}, ", ")
return s return s
} }
func valueToGoStringNode(v interface{}, typ string) string { func valueToGoStringMerkledag(v interface{}, typ string) string {
rv := reflect1.ValueOf(v) rv := reflect1.ValueOf(v)
if rv.IsNil() { if rv.IsNil() {
return "nil" return "nil"
...@@ -618,7 +618,7 @@ func valueToGoStringNode(v interface{}, typ string) string { ...@@ -618,7 +618,7 @@ func valueToGoStringNode(v interface{}, typ string) string {
pv := reflect1.Indirect(rv).Interface() pv := reflect1.Indirect(rv).Interface()
return fmt2.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) return fmt2.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
} }
func extensionToGoStringNode(e map[int32]code_google_com_p_gogoprotobuf_proto1.Extension) string { func extensionToGoStringMerkledag(e map[int32]code_google_com_p_gogoprotobuf_proto1.Extension) string {
if e == nil { if e == nil {
return "nil" return "nil"
} }
......
package merkledag; package merkledag.pb;
import "code.google.com/p/gogoprotobuf/gogoproto/gogo.proto"; import "code.google.com/p/gogoprotobuf/gogoproto/gogo.proto";
......
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo.
// source: node.proto // source: merkledag.proto
// DO NOT EDIT! // DO NOT EDIT!
/* /*
Package merkledag is a generated protocol buffer package. Package merkledag_pb is a generated protocol buffer package.
It is generated from these files: It is generated from these files:
node.proto merkledag.proto
It has these top-level messages: It has these top-level messages:
PBLink PBLink
PBNode PBNode
*/ */
package merkledag package merkledag_pb
import testing "testing" import testing "testing"
import math_rand "math/rand" import math_rand "math/rand"
......
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