// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: v1/config.proto

package v1

import (
	fmt "fmt"
	_ "github.com/gogo/protobuf/gogoproto"
	proto "github.com/gogo/protobuf/proto"
	_ "github.com/gogo/protobuf/types"
	github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
	io "io"
	math "math"
	math_bits "math/bits"
	time "time"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var _ = time.Kitchen

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package

type ProtocolConfig struct {
	Partitions     []PartitionConfig `protobuf:"bytes,1,rep,name=partitions,proto3" json:"partitions"`
	SessionTimeout *time.Duration    `protobuf:"bytes,2,opt,name=session_timeout,json=sessionTimeout,proto3,stdduration" json:"session_timeout,omitempty"`
}

func (m *ProtocolConfig) Reset()         { *m = ProtocolConfig{} }
func (m *ProtocolConfig) String() string { return proto.CompactTextString(m) }
func (*ProtocolConfig) ProtoMessage()    {}
func (*ProtocolConfig) Descriptor() ([]byte, []int) {
	return fileDescriptor_ac00cf9001d2bf3f, []int{0}
}
func (m *ProtocolConfig) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *ProtocolConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_ProtocolConfig.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalToSizedBuffer(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (m *ProtocolConfig) XXX_Merge(src proto.Message) {
	xxx_messageInfo_ProtocolConfig.Merge(m, src)
}
func (m *ProtocolConfig) XXX_Size() int {
	return m.Size()
}
func (m *ProtocolConfig) XXX_DiscardUnknown() {
	xxx_messageInfo_ProtocolConfig.DiscardUnknown(m)
}

var xxx_messageInfo_ProtocolConfig proto.InternalMessageInfo

func (m *ProtocolConfig) GetPartitions() []PartitionConfig {
	if m != nil {
		return m.Partitions
	}
	return nil
}

func (m *ProtocolConfig) GetSessionTimeout() *time.Duration {
	if m != nil {
		return m.SessionTimeout
	}
	return nil
}

type PartitionConfig struct {
	PartitionID PartitionID `protobuf:"varint,1,opt,name=partition_id,json=partitionId,proto3,casttype=PartitionID" json:"partitionId"`
	Leader      string      `protobuf:"bytes,2,opt,name=leader,proto3" json:"leader,omitempty"`
	Followers   []string    `protobuf:"bytes,3,rep,name=followers,proto3" json:"followers,omitempty"`
}

func (m *PartitionConfig) Reset()         { *m = PartitionConfig{} }
func (m *PartitionConfig) String() string { return proto.CompactTextString(m) }
func (*PartitionConfig) ProtoMessage()    {}
func (*PartitionConfig) Descriptor() ([]byte, []int) {
	return fileDescriptor_ac00cf9001d2bf3f, []int{1}
}
func (m *PartitionConfig) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *PartitionConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_PartitionConfig.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalToSizedBuffer(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (m *PartitionConfig) XXX_Merge(src proto.Message) {
	xxx_messageInfo_PartitionConfig.Merge(m, src)
}
func (m *PartitionConfig) XXX_Size() int {
	return m.Size()
}
func (m *PartitionConfig) XXX_DiscardUnknown() {
	xxx_messageInfo_PartitionConfig.DiscardUnknown(m)
}

var xxx_messageInfo_PartitionConfig proto.InternalMessageInfo

func (m *PartitionConfig) GetPartitionID() PartitionID {
	if m != nil {
		return m.PartitionID
	}
	return 0
}

func (m *PartitionConfig) GetLeader() string {
	if m != nil {
		return m.Leader
	}
	return ""
}

func (m *PartitionConfig) GetFollowers() []string {
	if m != nil {
		return m.Followers
	}
	return nil
}

func init() {
	proto.RegisterType((*ProtocolConfig)(nil), "atomix.protocols.rsm.v1.ProtocolConfig")
	proto.RegisterType((*PartitionConfig)(nil), "atomix.protocols.rsm.v1.PartitionConfig")
}

func init() { proto.RegisterFile("v1/config.proto", fileDescriptor_ac00cf9001d2bf3f) }

var fileDescriptor_ac00cf9001d2bf3f = []byte{
	// 315 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x4f, 0xbf, 0x4e, 0xc2, 0x40,
	0x18, 0xef, 0x09, 0x21, 0xe1, 0xaa, 0x90, 0x34, 0x46, 0x2b, 0x31, 0xd7, 0x86, 0xa9, 0x8b, 0xd7,
	0x80, 0x6f, 0x50, 0x19, 0x64, 0x31, 0xa4, 0x71, 0x27, 0x85, 0x1e, 0xcd, 0x25, 0x85, 0x8f, 0xdc,
	0x1d, 0xe8, 0x63, 0x38, 0xea, 0x2b, 0xf8, 0x24, 0x8c, 0x8c, 0x4e, 0x68, 0xca, 0xe6, 0x23, 0x38,
	0x19, 0x7a, 0xa5, 0xa2, 0x89, 0xdb, 0xf7, 0x7d, 0xbf, 0xbf, 0x1f, 0x6e, 0x2e, 0x3b, 0xfe, 0x18,
	0x66, 0x13, 0x9e, 0xd0, 0xb9, 0x00, 0x05, 0xd6, 0x79, 0xa4, 0x60, 0xca, 0x1f, 0xf5, 0x36, 0x86,
	0x54, 0x52, 0x21, 0xa7, 0x74, 0xd9, 0x69, 0x91, 0x04, 0x20, 0x49, 0x99, 0x9f, 0x03, 0xa3, 0xc5,
	0xc4, 0x8f, 0x17, 0x22, 0x52, 0x1c, 0x66, 0x9a, 0xda, 0x3a, 0x4d, 0x20, 0x81, 0x7c, 0xf4, 0x77,
	0x93, 0xbe, 0xb6, 0x5f, 0x11, 0x6e, 0x0c, 0x0a, 0xab, 0x9b, 0x3c, 0xc7, 0xba, 0xc3, 0x78, 0x1e,
	0x09, 0xc5, 0x77, 0x5a, 0x69, 0x23, 0xb7, 0xe2, 0x99, 0x5d, 0x8f, 0xfe, 0x13, 0x4b, 0x07, 0x7b,
	0xaa, 0x56, 0x07, 0xd5, 0xd5, 0xc6, 0x31, 0xc2, 0x03, 0x07, 0xeb, 0x16, 0x37, 0x25, 0x93, 0x92,
	0xc3, 0x6c, 0xa8, 0xf8, 0x94, 0xc1, 0x42, 0xd9, 0x47, 0x2e, 0xf2, 0xcc, 0xee, 0x05, 0xd5, 0x95,
	0xe9, 0xbe, 0x32, 0xed, 0x15, 0x95, 0x83, 0xea, 0xf3, 0xbb, 0x83, 0xc2, 0x46, 0xa1, 0xbb, 0xd7,
	0xb2, 0xf6, 0x0b, 0xc2, 0xcd, 0x3f, 0x79, 0xd6, 0x00, 0x1f, 0x97, 0x59, 0x43, 0x1e, 0xdb, 0xc8,
	0x45, 0xde, 0x49, 0x70, 0x95, 0x6d, 0x1c, 0xb3, 0xa4, 0xf6, 0x7b, 0x9f, 0x1b, 0xc7, 0x2c, 0x69,
	0xfd, 0xf8, 0xeb, 0x37, 0x1a, 0x1e, 0x62, 0xd6, 0x19, 0xae, 0xa5, 0x2c, 0x8a, 0x99, 0xc8, 0x6b,
	0xd6, 0xc3, 0x62, 0xb3, 0x2e, 0x71, 0x7d, 0x02, 0x69, 0x0a, 0x0f, 0x4c, 0x48, 0xbb, 0xe2, 0x56,
	0xbc, 0x7a, 0xf8, 0x73, 0x08, 0xec, 0x55, 0x46, 0xd0, 0x3a, 0x23, 0xe8, 0x23, 0x23, 0xe8, 0x69,
	0x4b, 0x8c, 0xf5, 0x96, 0x18, 0x6f, 0x5b, 0x62, 0x8c, 0x6a, 0xf9, 0x7b, 0xd7, 0xdf, 0x01, 0x00,
	0x00, 0xff, 0xff, 0xc4, 0x79, 0x18, 0xf6, 0xcb, 0x01, 0x00, 0x00,
}

func (m *ProtocolConfig) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *ProtocolConfig) MarshalTo(dAtA []byte) (int, error) {
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *ProtocolConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if m.SessionTimeout != nil {
		n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.SessionTimeout, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.SessionTimeout):])
		if err1 != nil {
			return 0, err1
		}
		i -= n1
		i = encodeVarintConfig(dAtA, i, uint64(n1))
		i--
		dAtA[i] = 0x12
	}
	if len(m.Partitions) > 0 {
		for iNdEx := len(m.Partitions) - 1; iNdEx >= 0; iNdEx-- {
			{
				size, err := m.Partitions[iNdEx].MarshalToSizedBuffer(dAtA[:i])
				if err != nil {
					return 0, err
				}
				i -= size
				i = encodeVarintConfig(dAtA, i, uint64(size))
			}
			i--
			dAtA[i] = 0xa
		}
	}
	return len(dAtA) - i, nil
}

func (m *PartitionConfig) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *PartitionConfig) MarshalTo(dAtA []byte) (int, error) {
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *PartitionConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if len(m.Followers) > 0 {
		for iNdEx := len(m.Followers) - 1; iNdEx >= 0; iNdEx-- {
			i -= len(m.Followers[iNdEx])
			copy(dAtA[i:], m.Followers[iNdEx])
			i = encodeVarintConfig(dAtA, i, uint64(len(m.Followers[iNdEx])))
			i--
			dAtA[i] = 0x1a
		}
	}
	if len(m.Leader) > 0 {
		i -= len(m.Leader)
		copy(dAtA[i:], m.Leader)
		i = encodeVarintConfig(dAtA, i, uint64(len(m.Leader)))
		i--
		dAtA[i] = 0x12
	}
	if m.PartitionID != 0 {
		i = encodeVarintConfig(dAtA, i, uint64(m.PartitionID))
		i--
		dAtA[i] = 0x8
	}
	return len(dAtA) - i, nil
}

func encodeVarintConfig(dAtA []byte, offset int, v uint64) int {
	offset -= sovConfig(v)
	base := offset
	for v >= 1<<7 {
		dAtA[offset] = uint8(v&0x7f | 0x80)
		v >>= 7
		offset++
	}
	dAtA[offset] = uint8(v)
	return base
}
func (m *ProtocolConfig) Size() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	if len(m.Partitions) > 0 {
		for _, e := range m.Partitions {
			l = e.Size()
			n += 1 + l + sovConfig(uint64(l))
		}
	}
	if m.SessionTimeout != nil {
		l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.SessionTimeout)
		n += 1 + l + sovConfig(uint64(l))
	}
	return n
}

func (m *PartitionConfig) Size() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	if m.PartitionID != 0 {
		n += 1 + sovConfig(uint64(m.PartitionID))
	}
	l = len(m.Leader)
	if l > 0 {
		n += 1 + l + sovConfig(uint64(l))
	}
	if len(m.Followers) > 0 {
		for _, s := range m.Followers {
			l = len(s)
			n += 1 + l + sovConfig(uint64(l))
		}
	}
	return n
}

func sovConfig(x uint64) (n int) {
	return (math_bits.Len64(x|1) + 6) / 7
}
func sozConfig(x uint64) (n int) {
	return sovConfig(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *ProtocolConfig) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowConfig
			}
			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)
		if wireType == 4 {
			return fmt.Errorf("proto: ProtocolConfig: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: ProtocolConfig: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Partitions", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowConfig
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthConfig
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return ErrInvalidLengthConfig
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Partitions = append(m.Partitions, PartitionConfig{})
			if err := m.Partitions[len(m.Partitions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field SessionTimeout", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowConfig
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthConfig
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return ErrInvalidLengthConfig
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.SessionTimeout == nil {
				m.SessionTimeout = new(time.Duration)
			}
			if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.SessionTimeout, dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipConfig(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if (skippy < 0) || (iNdEx+skippy) < 0 {
				return ErrInvalidLengthConfig
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *PartitionConfig) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowConfig
			}
			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)
		if wireType == 4 {
			return fmt.Errorf("proto: PartitionConfig: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: PartitionConfig: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field PartitionID", wireType)
			}
			m.PartitionID = 0
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowConfig
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				m.PartitionID |= PartitionID(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Leader", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowConfig
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= uint64(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthConfig
			}
			postIndex := iNdEx + intStringLen
			if postIndex < 0 {
				return ErrInvalidLengthConfig
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Leader = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 3:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Followers", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowConfig
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= uint64(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthConfig
			}
			postIndex := iNdEx + intStringLen
			if postIndex < 0 {
				return ErrInvalidLengthConfig
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Followers = append(m.Followers, string(dAtA[iNdEx:postIndex]))
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipConfig(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if (skippy < 0) || (iNdEx+skippy) < 0 {
				return ErrInvalidLengthConfig
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func skipConfig(dAtA []byte) (n int, err error) {
	l := len(dAtA)
	iNdEx := 0
	depth := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return 0, ErrIntOverflowConfig
			}
			if iNdEx >= l {
				return 0, io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		wireType := int(wire & 0x7)
		switch wireType {
		case 0:
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowConfig
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				iNdEx++
				if dAtA[iNdEx-1] < 0x80 {
					break
				}
			}
		case 1:
			iNdEx += 8
		case 2:
			var length int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowConfig
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				length |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if length < 0 {
				return 0, ErrInvalidLengthConfig
			}
			iNdEx += length
		case 3:
			depth++
		case 4:
			if depth == 0 {
				return 0, ErrUnexpectedEndOfGroupConfig
			}
			depth--
		case 5:
			iNdEx += 4
		default:
			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
		}
		if iNdEx < 0 {
			return 0, ErrInvalidLengthConfig
		}
		if depth == 0 {
			return iNdEx, nil
		}
	}
	return 0, io.ErrUnexpectedEOF
}

var (
	ErrInvalidLengthConfig        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowConfig          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupConfig = fmt.Errorf("proto: unexpected end of group")
)
