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