lease.pb.go 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. // Code generated by protoc-gen-gogo.
  2. // source: lease.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package leasepb is a generated protocol buffer package.
  6. It is generated from these files:
  7. lease.proto
  8. It has these top-level messages:
  9. Lease
  10. */
  11. package leasepb
  12. import (
  13. "fmt"
  14. proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
  15. )
  16. import math "math"
  17. import io "io"
  18. // Reference imports to suppress errors if they are not otherwise used.
  19. var _ = proto.Marshal
  20. var _ = fmt.Errorf
  21. var _ = math.Inf
  22. type Lease struct {
  23. ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
  24. TTL int64 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"`
  25. }
  26. func (m *Lease) Reset() { *m = Lease{} }
  27. func (m *Lease) String() string { return proto.CompactTextString(m) }
  28. func (*Lease) ProtoMessage() {}
  29. func init() {
  30. proto.RegisterType((*Lease)(nil), "leasepb.Lease")
  31. }
  32. func (m *Lease) Marshal() (data []byte, err error) {
  33. size := m.Size()
  34. data = make([]byte, size)
  35. n, err := m.MarshalTo(data)
  36. if err != nil {
  37. return nil, err
  38. }
  39. return data[:n], nil
  40. }
  41. func (m *Lease) MarshalTo(data []byte) (int, error) {
  42. var i int
  43. _ = i
  44. var l int
  45. _ = l
  46. if m.ID != 0 {
  47. data[i] = 0x8
  48. i++
  49. i = encodeVarintLease(data, i, uint64(m.ID))
  50. }
  51. if m.TTL != 0 {
  52. data[i] = 0x10
  53. i++
  54. i = encodeVarintLease(data, i, uint64(m.TTL))
  55. }
  56. return i, nil
  57. }
  58. func encodeFixed64Lease(data []byte, offset int, v uint64) int {
  59. data[offset] = uint8(v)
  60. data[offset+1] = uint8(v >> 8)
  61. data[offset+2] = uint8(v >> 16)
  62. data[offset+3] = uint8(v >> 24)
  63. data[offset+4] = uint8(v >> 32)
  64. data[offset+5] = uint8(v >> 40)
  65. data[offset+6] = uint8(v >> 48)
  66. data[offset+7] = uint8(v >> 56)
  67. return offset + 8
  68. }
  69. func encodeFixed32Lease(data []byte, offset int, v uint32) int {
  70. data[offset] = uint8(v)
  71. data[offset+1] = uint8(v >> 8)
  72. data[offset+2] = uint8(v >> 16)
  73. data[offset+3] = uint8(v >> 24)
  74. return offset + 4
  75. }
  76. func encodeVarintLease(data []byte, offset int, v uint64) int {
  77. for v >= 1<<7 {
  78. data[offset] = uint8(v&0x7f | 0x80)
  79. v >>= 7
  80. offset++
  81. }
  82. data[offset] = uint8(v)
  83. return offset + 1
  84. }
  85. func (m *Lease) Size() (n int) {
  86. var l int
  87. _ = l
  88. if m.ID != 0 {
  89. n += 1 + sovLease(uint64(m.ID))
  90. }
  91. if m.TTL != 0 {
  92. n += 1 + sovLease(uint64(m.TTL))
  93. }
  94. return n
  95. }
  96. func sovLease(x uint64) (n int) {
  97. for {
  98. n++
  99. x >>= 7
  100. if x == 0 {
  101. break
  102. }
  103. }
  104. return n
  105. }
  106. func sozLease(x uint64) (n int) {
  107. return sovLease(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  108. }
  109. func (m *Lease) Unmarshal(data []byte) error {
  110. l := len(data)
  111. iNdEx := 0
  112. for iNdEx < l {
  113. preIndex := iNdEx
  114. var wire uint64
  115. for shift := uint(0); ; shift += 7 {
  116. if shift >= 64 {
  117. return ErrIntOverflowLease
  118. }
  119. if iNdEx >= l {
  120. return io.ErrUnexpectedEOF
  121. }
  122. b := data[iNdEx]
  123. iNdEx++
  124. wire |= (uint64(b) & 0x7F) << shift
  125. if b < 0x80 {
  126. break
  127. }
  128. }
  129. fieldNum := int32(wire >> 3)
  130. wireType := int(wire & 0x7)
  131. if wireType == 4 {
  132. return fmt.Errorf("proto: Lease: wiretype end group for non-group")
  133. }
  134. if fieldNum <= 0 {
  135. return fmt.Errorf("proto: Lease: illegal tag %d (wire type %d)", fieldNum, wire)
  136. }
  137. switch fieldNum {
  138. case 1:
  139. if wireType != 0 {
  140. return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
  141. }
  142. m.ID = 0
  143. for shift := uint(0); ; shift += 7 {
  144. if shift >= 64 {
  145. return ErrIntOverflowLease
  146. }
  147. if iNdEx >= l {
  148. return io.ErrUnexpectedEOF
  149. }
  150. b := data[iNdEx]
  151. iNdEx++
  152. m.ID |= (int64(b) & 0x7F) << shift
  153. if b < 0x80 {
  154. break
  155. }
  156. }
  157. case 2:
  158. if wireType != 0 {
  159. return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType)
  160. }
  161. m.TTL = 0
  162. for shift := uint(0); ; shift += 7 {
  163. if shift >= 64 {
  164. return ErrIntOverflowLease
  165. }
  166. if iNdEx >= l {
  167. return io.ErrUnexpectedEOF
  168. }
  169. b := data[iNdEx]
  170. iNdEx++
  171. m.TTL |= (int64(b) & 0x7F) << shift
  172. if b < 0x80 {
  173. break
  174. }
  175. }
  176. default:
  177. iNdEx = preIndex
  178. skippy, err := skipLease(data[iNdEx:])
  179. if err != nil {
  180. return err
  181. }
  182. if skippy < 0 {
  183. return ErrInvalidLengthLease
  184. }
  185. if (iNdEx + skippy) > l {
  186. return io.ErrUnexpectedEOF
  187. }
  188. iNdEx += skippy
  189. }
  190. }
  191. if iNdEx > l {
  192. return io.ErrUnexpectedEOF
  193. }
  194. return nil
  195. }
  196. func skipLease(data []byte) (n int, err error) {
  197. l := len(data)
  198. iNdEx := 0
  199. for iNdEx < l {
  200. var wire uint64
  201. for shift := uint(0); ; shift += 7 {
  202. if shift >= 64 {
  203. return 0, ErrIntOverflowLease
  204. }
  205. if iNdEx >= l {
  206. return 0, io.ErrUnexpectedEOF
  207. }
  208. b := data[iNdEx]
  209. iNdEx++
  210. wire |= (uint64(b) & 0x7F) << shift
  211. if b < 0x80 {
  212. break
  213. }
  214. }
  215. wireType := int(wire & 0x7)
  216. switch wireType {
  217. case 0:
  218. for shift := uint(0); ; shift += 7 {
  219. if shift >= 64 {
  220. return 0, ErrIntOverflowLease
  221. }
  222. if iNdEx >= l {
  223. return 0, io.ErrUnexpectedEOF
  224. }
  225. iNdEx++
  226. if data[iNdEx-1] < 0x80 {
  227. break
  228. }
  229. }
  230. return iNdEx, nil
  231. case 1:
  232. iNdEx += 8
  233. return iNdEx, nil
  234. case 2:
  235. var length int
  236. for shift := uint(0); ; shift += 7 {
  237. if shift >= 64 {
  238. return 0, ErrIntOverflowLease
  239. }
  240. if iNdEx >= l {
  241. return 0, io.ErrUnexpectedEOF
  242. }
  243. b := data[iNdEx]
  244. iNdEx++
  245. length |= (int(b) & 0x7F) << shift
  246. if b < 0x80 {
  247. break
  248. }
  249. }
  250. iNdEx += length
  251. if length < 0 {
  252. return 0, ErrInvalidLengthLease
  253. }
  254. return iNdEx, nil
  255. case 3:
  256. for {
  257. var innerWire uint64
  258. var start int = iNdEx
  259. for shift := uint(0); ; shift += 7 {
  260. if shift >= 64 {
  261. return 0, ErrIntOverflowLease
  262. }
  263. if iNdEx >= l {
  264. return 0, io.ErrUnexpectedEOF
  265. }
  266. b := data[iNdEx]
  267. iNdEx++
  268. innerWire |= (uint64(b) & 0x7F) << shift
  269. if b < 0x80 {
  270. break
  271. }
  272. }
  273. innerWireType := int(innerWire & 0x7)
  274. if innerWireType == 4 {
  275. break
  276. }
  277. next, err := skipLease(data[start:])
  278. if err != nil {
  279. return 0, err
  280. }
  281. iNdEx = start + next
  282. }
  283. return iNdEx, nil
  284. case 4:
  285. return iNdEx, nil
  286. case 5:
  287. iNdEx += 4
  288. return iNdEx, nil
  289. default:
  290. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  291. }
  292. }
  293. panic("unreachable")
  294. }
  295. var (
  296. ErrInvalidLengthLease = fmt.Errorf("proto: negative length found during unmarshaling")
  297. ErrIntOverflowLease = fmt.Errorf("proto: integer overflow")
  298. )