// Code generated by protoc-gen-gogo.
// source: append_entries_responses.proto
// DO NOT EDIT!

package protobuf

import proto "github.com/coreos/etcd/third_party/code.google.com/p/gogoprotobuf/proto"
import json "encoding/json"
import math "math"

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

import io2 "io"
import code_google_com_p_gogoprotobuf_proto4 "github.com/coreos/etcd/third_party/code.google.com/p/gogoprotobuf/proto"

import fmt6 "fmt"
import strings4 "strings"
import reflect4 "reflect"

import fmt7 "fmt"
import strings5 "strings"
import code_google_com_p_gogoprotobuf_proto5 "github.com/coreos/etcd/third_party/code.google.com/p/gogoprotobuf/proto"
import sort2 "sort"
import strconv2 "strconv"
import reflect5 "reflect"

import fmt8 "fmt"
import bytes2 "bytes"

// Reference proto, json, and math imports to suppress error if they are not otherwise used.
var _ = proto.Marshal
var _ = &json.SyntaxError{}
var _ = math.Inf

type AppendEntriesResponse struct {
	Term             *uint64 `protobuf:"varint,1,req" json:"Term,omitempty"`
	Index            *uint64 `protobuf:"varint,2,req" json:"Index,omitempty"`
	CommitIndex      *uint64 `protobuf:"varint,3,req" json:"CommitIndex,omitempty"`
	Success          *bool   `protobuf:"varint,4,req" json:"Success,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

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

func (m *AppendEntriesResponse) GetTerm() uint64 {
	if m != nil && m.Term != nil {
		return *m.Term
	}
	return 0
}

func (m *AppendEntriesResponse) GetIndex() uint64 {
	if m != nil && m.Index != nil {
		return *m.Index
	}
	return 0
}

func (m *AppendEntriesResponse) GetCommitIndex() uint64 {
	if m != nil && m.CommitIndex != nil {
		return *m.CommitIndex
	}
	return 0
}

func (m *AppendEntriesResponse) GetSuccess() bool {
	if m != nil && m.Success != nil {
		return *m.Success
	}
	return false
}

func init() {
}
func (m *AppendEntriesResponse) 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 io2.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 != 0 {
				return proto.ErrWrongType
			}
			var v uint64
			for shift := uint(0); ; shift += 7 {
				if index >= l {
					return io2.ErrUnexpectedEOF
				}
				b := data[index]
				index++
				v |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			m.Term = &v
		case 2:
			if wireType != 0 {
				return proto.ErrWrongType
			}
			var v uint64
			for shift := uint(0); ; shift += 7 {
				if index >= l {
					return io2.ErrUnexpectedEOF
				}
				b := data[index]
				index++
				v |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			m.Index = &v
		case 3:
			if wireType != 0 {
				return proto.ErrWrongType
			}
			var v uint64
			for shift := uint(0); ; shift += 7 {
				if index >= l {
					return io2.ErrUnexpectedEOF
				}
				b := data[index]
				index++
				v |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			m.CommitIndex = &v
		case 4:
			if wireType != 0 {
				return proto.ErrWrongType
			}
			var v int
			for shift := uint(0); ; shift += 7 {
				if index >= l {
					return io2.ErrUnexpectedEOF
				}
				b := data[index]
				index++
				v |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			b := bool(v != 0)
			m.Success = &b
		default:
			var sizeOfWire int
			for {
				sizeOfWire++
				wire >>= 7
				if wire == 0 {
					break
				}
			}
			index -= sizeOfWire
			skippy, err := code_google_com_p_gogoprotobuf_proto4.Skip(data[index:])
			if err != nil {
				return err
			}
			m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
			index += skippy
		}
	}
	return nil
}
func (this *AppendEntriesResponse) String() string {
	if this == nil {
		return "nil"
	}
	s := strings4.Join([]string{`&AppendEntriesResponse{`,
		`Term:` + valueToStringAppendEntriesResponses(this.Term) + `,`,
		`Index:` + valueToStringAppendEntriesResponses(this.Index) + `,`,
		`CommitIndex:` + valueToStringAppendEntriesResponses(this.CommitIndex) + `,`,
		`Success:` + valueToStringAppendEntriesResponses(this.Success) + `,`,
		`XXX_unrecognized:` + fmt6.Sprintf("%v", this.XXX_unrecognized) + `,`,
		`}`,
	}, "")
	return s
}
func valueToStringAppendEntriesResponses(v interface{}) string {
	rv := reflect4.ValueOf(v)
	if rv.IsNil() {
		return "nil"
	}
	pv := reflect4.Indirect(rv).Interface()
	return fmt6.Sprintf("*%v", pv)
}
func (m *AppendEntriesResponse) Size() (n int) {
	var l int
	_ = l
	if m.Term != nil {
		n += 1 + sovAppendEntriesResponses(uint64(*m.Term))
	}
	if m.Index != nil {
		n += 1 + sovAppendEntriesResponses(uint64(*m.Index))
	}
	if m.CommitIndex != nil {
		n += 1 + sovAppendEntriesResponses(uint64(*m.CommitIndex))
	}
	if m.Success != nil {
		n += 2
	}
	if m.XXX_unrecognized != nil {
		n += len(m.XXX_unrecognized)
	}
	return n
}

func sovAppendEntriesResponses(x uint64) (n int) {
	for {
		n++
		x >>= 7
		if x == 0 {
			break
		}
	}
	return n
}
func sozAppendEntriesResponses(x uint64) (n int) {
	return sovAppendEntriesResponses(uint64((x << 1) ^ uint64((int64(x) >> 63))))
	return sovAppendEntriesResponses(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func NewPopulatedAppendEntriesResponse(r randyAppendEntriesResponses, easy bool) *AppendEntriesResponse {
	this := &AppendEntriesResponse{}
	v1 := uint64(r.Uint32())
	this.Term = &v1
	v2 := uint64(r.Uint32())
	this.Index = &v2
	v3 := uint64(r.Uint32())
	this.CommitIndex = &v3
	v4 := bool(r.Intn(2) == 0)
	this.Success = &v4
	if !easy && r.Intn(10) != 0 {
		this.XXX_unrecognized = randUnrecognizedAppendEntriesResponses(r, 5)
	}
	return this
}

type randyAppendEntriesResponses interface {
	Float32() float32
	Float64() float64
	Int63() int64
	Int31() int32
	Uint32() uint32
	Intn(n int) int
}

func randUTF8RuneAppendEntriesResponses(r randyAppendEntriesResponses) rune {
	res := rune(r.Uint32() % 1112064)
	if 55296 <= res {
		res += 2047
	}
	return res
}
func randStringAppendEntriesResponses(r randyAppendEntriesResponses) string {
	v5 := r.Intn(100)
	tmps := make([]rune, v5)
	for i := 0; i < v5; i++ {
		tmps[i] = randUTF8RuneAppendEntriesResponses(r)
	}
	return string(tmps)
}
func randUnrecognizedAppendEntriesResponses(r randyAppendEntriesResponses, maxFieldNumber int) (data []byte) {
	l := r.Intn(5)
	for i := 0; i < l; i++ {
		wire := r.Intn(4)
		if wire == 3 {
			wire = 5
		}
		fieldNumber := maxFieldNumber + r.Intn(100)
		data = randFieldAppendEntriesResponses(data, r, fieldNumber, wire)
	}
	return data
}
func randFieldAppendEntriesResponses(data []byte, r randyAppendEntriesResponses, fieldNumber int, wire int) []byte {
	key := uint32(fieldNumber)<<3 | uint32(wire)
	switch wire {
	case 0:
		data = encodeVarintPopulateAppendEntriesResponses(data, uint64(key))
		data = encodeVarintPopulateAppendEntriesResponses(data, uint64(r.Int63()))
	case 1:
		data = encodeVarintPopulateAppendEntriesResponses(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 = encodeVarintPopulateAppendEntriesResponses(data, uint64(key))
		ll := r.Intn(100)
		data = encodeVarintPopulateAppendEntriesResponses(data, uint64(ll))
		for j := 0; j < ll; j++ {
			data = append(data, byte(r.Intn(256)))
		}
	default:
		data = encodeVarintPopulateAppendEntriesResponses(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 encodeVarintPopulateAppendEntriesResponses(data []byte, v uint64) []byte {
	for v >= 1<<7 {
		data = append(data, uint8(uint64(v)&0x7f|0x80))
		v >>= 7
	}
	data = append(data, uint8(v))
	return data
}
func (m *AppendEntriesResponse) 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 *AppendEntriesResponse) MarshalTo(data []byte) (n int, err error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Term != nil {
		data[i] = 0x8
		i++
		i = encodeVarintAppendEntriesResponses(data, i, uint64(*m.Term))
	}
	if m.Index != nil {
		data[i] = 0x10
		i++
		i = encodeVarintAppendEntriesResponses(data, i, uint64(*m.Index))
	}
	if m.CommitIndex != nil {
		data[i] = 0x18
		i++
		i = encodeVarintAppendEntriesResponses(data, i, uint64(*m.CommitIndex))
	}
	if m.Success != nil {
		data[i] = 0x20
		i++
		if *m.Success {
			data[i] = 1
		} else {
			data[i] = 0
		}
		i++
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
func encodeFixed64AppendEntriesResponses(data []byte, offset int, v uint64) int {
	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
}
func encodeFixed32AppendEntriesResponses(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 encodeVarintAppendEntriesResponses(data []byte, offset int, v uint64) int {
	for v >= 1<<7 {
		data[offset] = uint8(v&0x7f | 0x80)
		v >>= 7
		offset++
	}
	data[offset] = uint8(v)
	return offset + 1
}
func (this *AppendEntriesResponse) GoString() string {
	if this == nil {
		return "nil"
	}
	s := strings5.Join([]string{`&protobuf.AppendEntriesResponse{` + `Term:` + valueToGoStringAppendEntriesResponses(this.Term, "uint64"), `Index:` + valueToGoStringAppendEntriesResponses(this.Index, "uint64"), `CommitIndex:` + valueToGoStringAppendEntriesResponses(this.CommitIndex, "uint64"), `Success:` + valueToGoStringAppendEntriesResponses(this.Success, "bool"), `XXX_unrecognized:` + fmt7.Sprintf("%#v", this.XXX_unrecognized) + `}`}, ", ")
	return s
}
func valueToGoStringAppendEntriesResponses(v interface{}, typ string) string {
	rv := reflect5.ValueOf(v)
	if rv.IsNil() {
		return "nil"
	}
	pv := reflect5.Indirect(rv).Interface()
	return fmt7.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
}
func extensionToGoStringAppendEntriesResponses(e map[int32]code_google_com_p_gogoprotobuf_proto5.Extension) string {
	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))
	}
	sort2.Ints(keys)
	ss := []string{}
	for _, k := range keys {
		ss = append(ss, strconv2.Itoa(k)+": "+e[int32(k)].GoString())
	}
	s += strings5.Join(ss, ",") + "}"
	return s
}
func (this *AppendEntriesResponse) VerboseEqual(that interface{}) error {
	if that == nil {
		if this == nil {
			return nil
		}
		return fmt8.Errorf("that == nil && this != nil")
	}

	that1, ok := that.(*AppendEntriesResponse)
	if !ok {
		return fmt8.Errorf("that is not of type *AppendEntriesResponse")
	}
	if that1 == nil {
		if this == nil {
			return nil
		}
		return fmt8.Errorf("that is type *AppendEntriesResponse but is nil && this != nil")
	} else if this == nil {
		return fmt8.Errorf("that is type *AppendEntriesResponsebut is not nil && this == nil")
	}
	if this.Term != nil && that1.Term != nil {
		if *this.Term != *that1.Term {
			return fmt8.Errorf("Term this(%v) Not Equal that(%v)", *this.Term, *that1.Term)
		}
	} else if this.Term != nil {
		return fmt8.Errorf("this.Term == nil && that.Term != nil")
	} else if that1.Term != nil {
		return fmt8.Errorf("Term this(%v) Not Equal that(%v)", this.Term, that1.Term)
	}
	if this.Index != nil && that1.Index != nil {
		if *this.Index != *that1.Index {
			return fmt8.Errorf("Index this(%v) Not Equal that(%v)", *this.Index, *that1.Index)
		}
	} else if this.Index != nil {
		return fmt8.Errorf("this.Index == nil && that.Index != nil")
	} else if that1.Index != nil {
		return fmt8.Errorf("Index this(%v) Not Equal that(%v)", this.Index, that1.Index)
	}
	if this.CommitIndex != nil && that1.CommitIndex != nil {
		if *this.CommitIndex != *that1.CommitIndex {
			return fmt8.Errorf("CommitIndex this(%v) Not Equal that(%v)", *this.CommitIndex, *that1.CommitIndex)
		}
	} else if this.CommitIndex != nil {
		return fmt8.Errorf("this.CommitIndex == nil && that.CommitIndex != nil")
	} else if that1.CommitIndex != nil {
		return fmt8.Errorf("CommitIndex this(%v) Not Equal that(%v)", this.CommitIndex, that1.CommitIndex)
	}
	if this.Success != nil && that1.Success != nil {
		if *this.Success != *that1.Success {
			return fmt8.Errorf("Success this(%v) Not Equal that(%v)", *this.Success, *that1.Success)
		}
	} else if this.Success != nil {
		return fmt8.Errorf("this.Success == nil && that.Success != nil")
	} else if that1.Success != nil {
		return fmt8.Errorf("Success this(%v) Not Equal that(%v)", this.Success, that1.Success)
	}
	if !bytes2.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
		return fmt8.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
	}
	return nil
}
func (this *AppendEntriesResponse) Equal(that interface{}) bool {
	if that == nil {
		if this == nil {
			return true
		}
		return false
	}

	that1, ok := that.(*AppendEntriesResponse)
	if !ok {
		return false
	}
	if that1 == nil {
		if this == nil {
			return true
		}
		return false
	} else if this == nil {
		return false
	}
	if this.Term != nil && that1.Term != nil {
		if *this.Term != *that1.Term {
			return false
		}
	} else if this.Term != nil {
		return false
	} else if that1.Term != nil {
		return false
	}
	if this.Index != nil && that1.Index != nil {
		if *this.Index != *that1.Index {
			return false
		}
	} else if this.Index != nil {
		return false
	} else if that1.Index != nil {
		return false
	}
	if this.CommitIndex != nil && that1.CommitIndex != nil {
		if *this.CommitIndex != *that1.CommitIndex {
			return false
		}
	} else if this.CommitIndex != nil {
		return false
	} else if that1.CommitIndex != nil {
		return false
	}
	if this.Success != nil && that1.Success != nil {
		if *this.Success != *that1.Success {
			return false
		}
	} else if this.Success != nil {
		return false
	} else if that1.Success != nil {
		return false
	}
	if !bytes2.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
		return false
	}
	return true
}
