merkledag.pb.go 18.6 KB
Newer Older
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
1
// Code generated by protoc-gen-gogo.
2
// source: merkledag.proto
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
3 4 5
// DO NOT EDIT!

/*
6
	Package merkledag_pb is a generated protocol buffer package.
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
7 8

	It is generated from these files:
9
		merkledag.proto
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
10 11 12 13 14

	It has these top-level messages:
		PBLink
		PBNode
*/
15
package merkledag_pb
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
16

17
import proto "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/proto"
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
18 19 20 21 22
import math "math"

// discarding unused import gogoproto "code.google.com/p/gogoprotobuf/gogoproto/gogo.pb"

import io "io"
Chas Leichner's avatar
Chas Leichner committed
23
import fmt "fmt"
24
import code_google_com_p_gogoprotobuf_proto "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/proto"
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
25

Chas Leichner's avatar
Chas Leichner committed
26
import fmt1 "fmt"
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
27 28 29
import strings "strings"
import reflect "reflect"

Chas Leichner's avatar
Chas Leichner committed
30
import fmt2 "fmt"
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
31
import strings1 "strings"
32
import code_google_com_p_gogoprotobuf_proto1 "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/proto"
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
33 34 35 36
import sort "sort"
import strconv "strconv"
import reflect1 "reflect"

Chas Leichner's avatar
Chas Leichner committed
37
import fmt3 "fmt"
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
38 39
import bytes "bytes"

Chas Leichner's avatar
Chas Leichner committed
40
// Reference imports to suppress errors if they are not otherwise used.
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
var _ = proto.Marshal
var _ = math.Inf

// An IPFS MerkleDAG Link
type PBLink struct {
	// multihash of the target object
	Hash []byte `protobuf:"bytes,1,opt" json:"Hash,omitempty"`
	// utf string name. should be unique per object
	Name *string `protobuf:"bytes,2,opt" json:"Name,omitempty"`
	// cumulative size of target object
	Tsize            *uint64 `protobuf:"varint,3,opt" json:"Tsize,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

func (m *PBLink) Reset()      { *m = PBLink{} }
func (*PBLink) ProtoMessage() {}

func (m *PBLink) GetHash() []byte {
	if m != nil {
		return m.Hash
	}
	return nil
}

func (m *PBLink) GetName() string {
	if m != nil && m.Name != nil {
		return *m.Name
	}
	return ""
}

func (m *PBLink) GetTsize() uint64 {
	if m != nil && m.Tsize != nil {
		return *m.Tsize
	}
	return 0
}

// An IPFS MerkleDAG Node
type PBNode struct {
	// refs to other objects
	Links []*PBLink `protobuf:"bytes,2,rep" json:"Links,omitempty"`
	// opaque user data
	Data             []byte `protobuf:"bytes,1,opt" json:"Data,omitempty"`
	XXX_unrecognized []byte `json:"-"`
}

func (m *PBNode) Reset()      { *m = PBNode{} }
func (*PBNode) ProtoMessage() {}

func (m *PBNode) GetLinks() []*PBLink {
	if m != nil {
		return m.Links
	}
	return nil
}

func (m *PBNode) GetData() []byte {
	if m != nil {
		return m.Data
	}
	return nil
}

func init() {
}
func (m *PBLink) Unmarshal(data []byte) error {
	l := len(data)
	index := 0
	for index < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if index >= l {
				return io.ErrUnexpectedEOF
			}
			b := data[index]
			index++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		switch fieldNum {
		case 1:
			if wireType != 2 {
Chas Leichner's avatar
Chas Leichner committed
128
				return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if index >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[index]
				index++
				byteLen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			postIndex := index + byteLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Hash = append(m.Hash, data[index:postIndex]...)
			index = postIndex
		case 2:
			if wireType != 2 {
Chas Leichner's avatar
Chas Leichner committed
150
				return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if index >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[index]
				index++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			postIndex := index + int(stringLen)
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			s := string(data[index:postIndex])
			m.Name = &s
			index = postIndex
		case 3:
			if wireType != 0 {
Chas Leichner's avatar
Chas Leichner committed
173
				return fmt.Errorf("proto: wrong wireType = %d for field Tsize", wireType)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
			}
			var v uint64
			for shift := uint(0); ; shift += 7 {
				if index >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[index]
				index++
				v |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			m.Tsize = &v
		default:
			var sizeOfWire int
			for {
				sizeOfWire++
				wire >>= 7
				if wire == 0 {
					break
				}
			}
			index -= sizeOfWire
			skippy, err := code_google_com_p_gogoprotobuf_proto.Skip(data[index:])
			if err != nil {
				return err
			}
			if (index + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
			index += skippy
		}
	}
	return nil
}
func (m *PBNode) Unmarshal(data []byte) error {
	l := len(data)
	index := 0
	for index < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if index >= l {
				return io.ErrUnexpectedEOF
			}
			b := data[index]
			index++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		switch fieldNum {
		case 2:
			if wireType != 2 {
Chas Leichner's avatar
Chas Leichner committed
232
				return fmt.Errorf("proto: wrong wireType = %d for field Links", wireType)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if index >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[index]
				index++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			postIndex := index + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Links = append(m.Links, &PBLink{})
			m.Links[len(m.Links)-1].Unmarshal(data[index:postIndex])
			index = postIndex
		case 1:
			if wireType != 2 {
Chas Leichner's avatar
Chas Leichner committed
255
				return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if index >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[index]
				index++
				byteLen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			postIndex := index + byteLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Data = append(m.Data, data[index:postIndex]...)
			index = postIndex
		default:
			var sizeOfWire int
			for {
				sizeOfWire++
				wire >>= 7
				if wire == 0 {
					break
				}
			}
			index -= sizeOfWire
			skippy, err := code_google_com_p_gogoprotobuf_proto.Skip(data[index:])
			if err != nil {
				return err
			}
			if (index + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
			index += skippy
		}
	}
	return nil
}
func (this *PBLink) String() string {
	if this == nil {
		return "nil"
	}
	s := strings.Join([]string{`&PBLink{`,
303 304 305
		`Hash:` + valueToStringMerkledag(this.Hash) + `,`,
		`Name:` + valueToStringMerkledag(this.Name) + `,`,
		`Tsize:` + valueToStringMerkledag(this.Tsize) + `,`,
Chas Leichner's avatar
Chas Leichner committed
306
		`XXX_unrecognized:` + fmt1.Sprintf("%v", this.XXX_unrecognized) + `,`,
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
307 308 309 310 311 312 313 314 315
		`}`,
	}, "")
	return s
}
func (this *PBNode) String() string {
	if this == nil {
		return "nil"
	}
	s := strings.Join([]string{`&PBNode{`,
Chas Leichner's avatar
Chas Leichner committed
316
		`Links:` + strings.Replace(fmt1.Sprintf("%v", this.Links), "PBLink", "PBLink", 1) + `,`,
317
		`Data:` + valueToStringMerkledag(this.Data) + `,`,
Chas Leichner's avatar
Chas Leichner committed
318
		`XXX_unrecognized:` + fmt1.Sprintf("%v", this.XXX_unrecognized) + `,`,
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
319 320 321 322
		`}`,
	}, "")
	return s
}
323
func valueToStringMerkledag(v interface{}) string {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
324 325 326 327 328
	rv := reflect.ValueOf(v)
	if rv.IsNil() {
		return "nil"
	}
	pv := reflect.Indirect(rv).Interface()
Chas Leichner's avatar
Chas Leichner committed
329
	return fmt1.Sprintf("*%v", pv)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
330 331 332 333 334 335
}
func (m *PBLink) Size() (n int) {
	var l int
	_ = l
	if m.Hash != nil {
		l = len(m.Hash)
336
		n += 1 + l + sovMerkledag(uint64(l))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
337 338 339
	}
	if m.Name != nil {
		l = len(*m.Name)
340
		n += 1 + l + sovMerkledag(uint64(l))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
341 342
	}
	if m.Tsize != nil {
343
		n += 1 + sovMerkledag(uint64(*m.Tsize))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
344 345 346 347 348 349 350 351 352 353 354 355
	}
	if m.XXX_unrecognized != nil {
		n += len(m.XXX_unrecognized)
	}
	return n
}
func (m *PBNode) Size() (n int) {
	var l int
	_ = l
	if len(m.Links) > 0 {
		for _, e := range m.Links {
			l = e.Size()
356
			n += 1 + l + sovMerkledag(uint64(l))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
357 358 359 360
		}
	}
	if m.Data != nil {
		l = len(m.Data)
361
		n += 1 + l + sovMerkledag(uint64(l))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
362 363 364 365 366 367 368
	}
	if m.XXX_unrecognized != nil {
		n += len(m.XXX_unrecognized)
	}
	return n
}

369
func sovMerkledag(x uint64) (n int) {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
370 371 372 373 374 375 376 377 378
	for {
		n++
		x >>= 7
		if x == 0 {
			break
		}
	}
	return n
}
379 380
func sozMerkledag(x uint64) (n int) {
	return sovMerkledag(uint64((x << 1) ^ uint64((int64(x) >> 63))))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
381
}
382
func NewPopulatedPBLink(r randyMerkledag, easy bool) *PBLink {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
383 384 385 386 387 388 389 390 391
	this := &PBLink{}
	if r.Intn(10) != 0 {
		v1 := r.Intn(100)
		this.Hash = make([]byte, v1)
		for i := 0; i < v1; i++ {
			this.Hash[i] = byte(r.Intn(256))
		}
	}
	if r.Intn(10) != 0 {
392
		v2 := randStringMerkledag(r)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
393 394 395 396 397 398 399
		this.Name = &v2
	}
	if r.Intn(10) != 0 {
		v3 := uint64(r.Uint32())
		this.Tsize = &v3
	}
	if !easy && r.Intn(10) != 0 {
400
		this.XXX_unrecognized = randUnrecognizedMerkledag(r, 4)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
401 402 403 404
	}
	return this
}

405
func NewPopulatedPBNode(r randyMerkledag, easy bool) *PBNode {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
	this := &PBNode{}
	if r.Intn(10) != 0 {
		v4 := r.Intn(10)
		this.Links = make([]*PBLink, v4)
		for i := 0; i < v4; i++ {
			this.Links[i] = NewPopulatedPBLink(r, easy)
		}
	}
	if r.Intn(10) != 0 {
		v5 := r.Intn(100)
		this.Data = make([]byte, v5)
		for i := 0; i < v5; i++ {
			this.Data[i] = byte(r.Intn(256))
		}
	}
	if !easy && r.Intn(10) != 0 {
422
		this.XXX_unrecognized = randUnrecognizedMerkledag(r, 3)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
423 424 425 426
	}
	return this
}

427
type randyMerkledag interface {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
428 429 430 431 432 433 434 435
	Float32() float32
	Float64() float64
	Int63() int64
	Int31() int32
	Uint32() uint32
	Intn(n int) int
}

436
func randUTF8RuneMerkledag(r randyMerkledag) rune {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
437 438 439 440 441 442
	res := rune(r.Uint32() % 1112064)
	if 55296 <= res {
		res += 2047
	}
	return res
}
443
func randStringMerkledag(r randyMerkledag) string {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
444 445 446
	v6 := r.Intn(100)
	tmps := make([]rune, v6)
	for i := 0; i < v6; i++ {
447
		tmps[i] = randUTF8RuneMerkledag(r)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
448 449 450
	}
	return string(tmps)
}
451
func randUnrecognizedMerkledag(r randyMerkledag, maxFieldNumber int) (data []byte) {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
452 453 454 455 456 457 458
	l := r.Intn(5)
	for i := 0; i < l; i++ {
		wire := r.Intn(4)
		if wire == 3 {
			wire = 5
		}
		fieldNumber := maxFieldNumber + r.Intn(100)
459
		data = randFieldMerkledag(data, r, fieldNumber, wire)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
460 461 462
	}
	return data
}
463
func randFieldMerkledag(data []byte, r randyMerkledag, fieldNumber int, wire int) []byte {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
464 465 466
	key := uint32(fieldNumber)<<3 | uint32(wire)
	switch wire {
	case 0:
467
		data = encodeVarintPopulateMerkledag(data, uint64(key))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
468 469 470 471
		v7 := r.Int63()
		if r.Intn(2) == 0 {
			v7 *= -1
		}
472
		data = encodeVarintPopulateMerkledag(data, uint64(v7))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
473
	case 1:
474
		data = encodeVarintPopulateMerkledag(data, uint64(key))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
475 476
		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:
477
		data = encodeVarintPopulateMerkledag(data, uint64(key))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
478
		ll := r.Intn(100)
479
		data = encodeVarintPopulateMerkledag(data, uint64(ll))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
480 481 482 483
		for j := 0; j < ll; j++ {
			data = append(data, byte(r.Intn(256)))
		}
	default:
484
		data = encodeVarintPopulateMerkledag(data, uint64(key))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
485 486 487 488
		data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
	}
	return data
}
489
func encodeVarintPopulateMerkledag(data []byte, v uint64) []byte {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514
	for v >= 1<<7 {
		data = append(data, uint8(uint64(v)&0x7f|0x80))
		v >>= 7
	}
	data = append(data, uint8(v))
	return data
}
func (m *PBLink) Marshal() (data []byte, err error) {
	size := m.Size()
	data = make([]byte, size)
	n, err := m.MarshalTo(data)
	if err != nil {
		return nil, err
	}
	return data[:n], nil
}

func (m *PBLink) MarshalTo(data []byte) (n int, err error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Hash != nil {
		data[i] = 0xa
		i++
515
		i = encodeVarintMerkledag(data, i, uint64(len(m.Hash)))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
516 517 518 519 520
		i += copy(data[i:], m.Hash)
	}
	if m.Name != nil {
		data[i] = 0x12
		i++
521
		i = encodeVarintMerkledag(data, i, uint64(len(*m.Name)))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
522 523 524 525 526
		i += copy(data[i:], *m.Name)
	}
	if m.Tsize != nil {
		data[i] = 0x18
		i++
527
		i = encodeVarintMerkledag(data, i, uint64(*m.Tsize))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
func (m *PBNode) Marshal() (data []byte, err error) {
	size := m.Size()
	data = make([]byte, size)
	n, err := m.MarshalTo(data)
	if err != nil {
		return nil, err
	}
	return data[:n], nil
}

func (m *PBNode) MarshalTo(data []byte) (n int, err error) {
	var i int
	_ = i
	var l int
	_ = l
	if len(m.Links) > 0 {
		for _, msg := range m.Links {
			data[i] = 0x12
			i++
553
			i = encodeVarintMerkledag(data, i, uint64(msg.Size()))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
554 555 556 557 558 559 560 561 562 563
			n, err := msg.MarshalTo(data[i:])
			if err != nil {
				return 0, err
			}
			i += n
		}
	}
	if m.Data != nil {
		data[i] = 0xa
		i++
564
		i = encodeVarintMerkledag(data, i, uint64(len(m.Data)))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
565 566 567 568 569 570 571
		i += copy(data[i:], m.Data)
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
572
func encodeFixed64Merkledag(data []byte, offset int, v uint64) int {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
573 574 575 576 577 578 579 580 581 582
	data[offset] = uint8(v)
	data[offset+1] = uint8(v >> 8)
	data[offset+2] = uint8(v >> 16)
	data[offset+3] = uint8(v >> 24)
	data[offset+4] = uint8(v >> 32)
	data[offset+5] = uint8(v >> 40)
	data[offset+6] = uint8(v >> 48)
	data[offset+7] = uint8(v >> 56)
	return offset + 8
}
583
func encodeFixed32Merkledag(data []byte, offset int, v uint32) int {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
584 585 586 587 588 589
	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
}
590
func encodeVarintMerkledag(data []byte, offset int, v uint64) int {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
591 592 593 594 595 596 597 598 599 600 601 602
	for v >= 1<<7 {
		data[offset] = uint8(v&0x7f | 0x80)
		v >>= 7
		offset++
	}
	data[offset] = uint8(v)
	return offset + 1
}
func (this *PBLink) GoString() string {
	if this == nil {
		return "nil"
	}
603
	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) + `}`}, ", ")
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
604 605 606 607 608 609
	return s
}
func (this *PBNode) GoString() string {
	if this == nil {
		return "nil"
	}
610
	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) + `}`}, ", ")
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
611 612
	return s
}
613
func valueToGoStringMerkledag(v interface{}, typ string) string {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
614 615 616 617 618
	rv := reflect1.ValueOf(v)
	if rv.IsNil() {
		return "nil"
	}
	pv := reflect1.Indirect(rv).Interface()
Chas Leichner's avatar
Chas Leichner committed
619
	return fmt2.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
620
}
621
func extensionToGoStringMerkledag(e map[int32]code_google_com_p_gogoprotobuf_proto1.Extension) string {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642
	if e == nil {
		return "nil"
	}
	s := "map[int32]proto.Extension{"
	keys := make([]int, 0, len(e))
	for k := range e {
		keys = append(keys, int(k))
	}
	sort.Ints(keys)
	ss := []string{}
	for _, k := range keys {
		ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString())
	}
	s += strings1.Join(ss, ",") + "}"
	return s
}
func (this *PBLink) VerboseEqual(that interface{}) error {
	if that == nil {
		if this == nil {
			return nil
		}
Chas Leichner's avatar
Chas Leichner committed
643
		return fmt3.Errorf("that == nil && this != nil")
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
644 645 646 647
	}

	that1, ok := that.(*PBLink)
	if !ok {
Chas Leichner's avatar
Chas Leichner committed
648
		return fmt3.Errorf("that is not of type *PBLink")
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
649 650 651 652 653
	}
	if that1 == nil {
		if this == nil {
			return nil
		}
Chas Leichner's avatar
Chas Leichner committed
654
		return fmt3.Errorf("that is type *PBLink but is nil && this != nil")
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
655
	} else if this == nil {
Chas Leichner's avatar
Chas Leichner committed
656
		return fmt3.Errorf("that is type *PBLinkbut is not nil && this == nil")
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
657 658
	}
	if !bytes.Equal(this.Hash, that1.Hash) {
Chas Leichner's avatar
Chas Leichner committed
659
		return fmt3.Errorf("Hash this(%v) Not Equal that(%v)", this.Hash, that1.Hash)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
660 661 662
	}
	if this.Name != nil && that1.Name != nil {
		if *this.Name != *that1.Name {
Chas Leichner's avatar
Chas Leichner committed
663
			return fmt3.Errorf("Name this(%v) Not Equal that(%v)", *this.Name, *that1.Name)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
664 665
		}
	} else if this.Name != nil {
Chas Leichner's avatar
Chas Leichner committed
666
		return fmt3.Errorf("this.Name == nil && that.Name != nil")
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
667
	} else if that1.Name != nil {
Chas Leichner's avatar
Chas Leichner committed
668
		return fmt3.Errorf("Name this(%v) Not Equal that(%v)", this.Name, that1.Name)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
669 670 671
	}
	if this.Tsize != nil && that1.Tsize != nil {
		if *this.Tsize != *that1.Tsize {
Chas Leichner's avatar
Chas Leichner committed
672
			return fmt3.Errorf("Tsize this(%v) Not Equal that(%v)", *this.Tsize, *that1.Tsize)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
673 674
		}
	} else if this.Tsize != nil {
Chas Leichner's avatar
Chas Leichner committed
675
		return fmt3.Errorf("this.Tsize == nil && that.Tsize != nil")
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
676
	} else if that1.Tsize != nil {
Chas Leichner's avatar
Chas Leichner committed
677
		return fmt3.Errorf("Tsize this(%v) Not Equal that(%v)", this.Tsize, that1.Tsize)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
678 679
	}
	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
Chas Leichner's avatar
Chas Leichner committed
680
		return fmt3.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734
	}
	return nil
}
func (this *PBLink) Equal(that interface{}) bool {
	if that == nil {
		if this == nil {
			return true
		}
		return false
	}

	that1, ok := that.(*PBLink)
	if !ok {
		return false
	}
	if that1 == nil {
		if this == nil {
			return true
		}
		return false
	} else if this == nil {
		return false
	}
	if !bytes.Equal(this.Hash, that1.Hash) {
		return false
	}
	if this.Name != nil && that1.Name != nil {
		if *this.Name != *that1.Name {
			return false
		}
	} else if this.Name != nil {
		return false
	} else if that1.Name != nil {
		return false
	}
	if this.Tsize != nil && that1.Tsize != nil {
		if *this.Tsize != *that1.Tsize {
			return false
		}
	} else if this.Tsize != nil {
		return false
	} else if that1.Tsize != nil {
		return false
	}
	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
		return false
	}
	return true
}
func (this *PBNode) VerboseEqual(that interface{}) error {
	if that == nil {
		if this == nil {
			return nil
		}
Chas Leichner's avatar
Chas Leichner committed
735
		return fmt3.Errorf("that == nil && this != nil")
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
736 737 738 739
	}

	that1, ok := that.(*PBNode)
	if !ok {
Chas Leichner's avatar
Chas Leichner committed
740
		return fmt3.Errorf("that is not of type *PBNode")
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
741 742 743 744 745
	}
	if that1 == nil {
		if this == nil {
			return nil
		}
Chas Leichner's avatar
Chas Leichner committed
746
		return fmt3.Errorf("that is type *PBNode but is nil && this != nil")
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
747
	} else if this == nil {
Chas Leichner's avatar
Chas Leichner committed
748
		return fmt3.Errorf("that is type *PBNodebut is not nil && this == nil")
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
749 750
	}
	if len(this.Links) != len(that1.Links) {
Chas Leichner's avatar
Chas Leichner committed
751
		return fmt3.Errorf("Links this(%v) Not Equal that(%v)", len(this.Links), len(that1.Links))
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
752 753 754
	}
	for i := range this.Links {
		if !this.Links[i].Equal(that1.Links[i]) {
Chas Leichner's avatar
Chas Leichner committed
755
			return fmt3.Errorf("Links this[%v](%v) Not Equal that[%v](%v)", i, this.Links[i], i, that1.Links[i])
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
756 757 758
		}
	}
	if !bytes.Equal(this.Data, that1.Data) {
Chas Leichner's avatar
Chas Leichner committed
759
		return fmt3.Errorf("Data this(%v) Not Equal that(%v)", this.Data, that1.Data)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
760 761
	}
	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
Chas Leichner's avatar
Chas Leichner committed
762
		return fmt3.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801
	}
	return nil
}
func (this *PBNode) Equal(that interface{}) bool {
	if that == nil {
		if this == nil {
			return true
		}
		return false
	}

	that1, ok := that.(*PBNode)
	if !ok {
		return false
	}
	if that1 == nil {
		if this == nil {
			return true
		}
		return false
	} else if this == nil {
		return false
	}
	if len(this.Links) != len(that1.Links) {
		return false
	}
	for i := range this.Links {
		if !this.Links[i].Equal(that1.Links[i]) {
			return false
		}
	}
	if !bytes.Equal(this.Data, that1.Data) {
		return false
	}
	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
		return false
	}
	return true
}