github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/kv/kvserver/kvserverpb/lease_status.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: kv/kvserver/kvserverpb/lease_status.proto 3 4 package kvserverpb 5 6 import proto "github.com/gogo/protobuf/proto" 7 import fmt "fmt" 8 import math "math" 9 import roachpb "github.com/cockroachdb/cockroach/pkg/roachpb" 10 import hlc "github.com/cockroachdb/cockroach/pkg/util/hlc" 11 12 import io "io" 13 14 // Reference imports to suppress errors if they are not otherwise used. 15 var _ = proto.Marshal 16 var _ = fmt.Errorf 17 var _ = math.Inf 18 19 // This is a compile-time assertion to ensure that this generated file 20 // is compatible with the proto package it is being compiled against. 21 // A compilation error at this line likely means your copy of the 22 // proto package needs to be updated. 23 const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package 24 25 type LeaseState int32 26 27 const ( 28 // ERROR indicates that the lease can't be used or acquired. 29 LeaseState_ERROR LeaseState = 0 30 // VALID indicates that the lease can be used. 31 LeaseState_VALID LeaseState = 1 32 // STASIS indicates that the lease has not expired, but can't be 33 // used because it is close to expiration (a stasis period at the 34 // end of each lease is one of the ways we handle clock 35 // uncertainty). A lease in STASIS may become VALID for the same 36 // leaseholder after a successful RequestLease (for expiration-based 37 // leases) or Heartbeat (for epoch-based leases). A lease may not 38 // change hands while it is in stasis; would-be acquirers must wait 39 // for the stasis period to expire. 40 // 41 // The point of the stasis period is to prevent reads on the old leaseholder 42 // (the one whose stasis we're talking about) from missing to see writes 43 // performed under the next lease (held by someone else) when these writes 44 // should fall in the uncertainty window. Even without the stasis, writes 45 // performed by the new leaseholder are guaranteed to have higher timestamps 46 // than any reads served by the old leaseholder. However, a read at timestamp 47 // T needs to observe all writes at timestamps [T, T+maxOffset] and so, 48 // without the stasis, only the new leaseholder might have some of these 49 // writes. In other words, without the stasis, a new leaseholder with a fast 50 // clock could start performing writes ordered in real time before the old 51 // leaseholder considers its lease to have expired. 52 LeaseState_STASIS LeaseState = 2 53 // EXPIRED indicates that the lease can't be used. An expired lease 54 // may become VALID for the same leaseholder on RequestLease or 55 // Heartbeat, or it may be replaced by a new leaseholder with a 56 // RequestLease (for expiration-based leases) or 57 // IncrementEpoch+RequestLease (for epoch-based leases). 58 LeaseState_EXPIRED LeaseState = 3 59 // PROSCRIBED indicates that the lease's proposed timestamp is 60 // earlier than allowed. This is used to detect node restarts: a 61 // node that has restarted will see its former incarnation's leases 62 // as PROSCRIBED so it will renew them before using them. Note that 63 // the PROSCRIBED state is only visible to the leaseholder; other 64 // nodes will see this as a VALID lease. 65 LeaseState_PROSCRIBED LeaseState = 4 66 ) 67 68 var LeaseState_name = map[int32]string{ 69 0: "ERROR", 70 1: "VALID", 71 2: "STASIS", 72 3: "EXPIRED", 73 4: "PROSCRIBED", 74 } 75 var LeaseState_value = map[string]int32{ 76 "ERROR": 0, 77 "VALID": 1, 78 "STASIS": 2, 79 "EXPIRED": 3, 80 "PROSCRIBED": 4, 81 } 82 83 func (x LeaseState) String() string { 84 return proto.EnumName(LeaseState_name, int32(x)) 85 } 86 func (LeaseState) EnumDescriptor() ([]byte, []int) { 87 return fileDescriptor_lease_status_c8125d34c8e4ebdc, []int{0} 88 } 89 90 // LeaseStatus holds the lease state, the timestamp at which the state 91 // is accurate, the lease and optionally the liveness if the lease is 92 // epoch-based. 93 type LeaseStatus struct { 94 // Lease which this status describes. 95 Lease roachpb.Lease `protobuf:"bytes,1,opt,name=lease,proto3" json:"lease"` 96 // Timestamp that the lease was evaluated at. 97 Timestamp hlc.Timestamp `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp"` 98 // State of the lease at timestamp. 99 State LeaseState `protobuf:"varint,3,opt,name=state,proto3,enum=cockroach.kv.kvserver.storagepb.LeaseState" json:"state,omitempty"` 100 // Liveness if this is an epoch-based lease. 101 Liveness Liveness `protobuf:"bytes,4,opt,name=liveness,proto3" json:"liveness"` 102 } 103 104 func (m *LeaseStatus) Reset() { *m = LeaseStatus{} } 105 func (m *LeaseStatus) String() string { return proto.CompactTextString(m) } 106 func (*LeaseStatus) ProtoMessage() {} 107 func (*LeaseStatus) Descriptor() ([]byte, []int) { 108 return fileDescriptor_lease_status_c8125d34c8e4ebdc, []int{0} 109 } 110 func (m *LeaseStatus) XXX_Unmarshal(b []byte) error { 111 return m.Unmarshal(b) 112 } 113 func (m *LeaseStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 114 b = b[:cap(b)] 115 n, err := m.MarshalTo(b) 116 if err != nil { 117 return nil, err 118 } 119 return b[:n], nil 120 } 121 func (dst *LeaseStatus) XXX_Merge(src proto.Message) { 122 xxx_messageInfo_LeaseStatus.Merge(dst, src) 123 } 124 func (m *LeaseStatus) XXX_Size() int { 125 return m.Size() 126 } 127 func (m *LeaseStatus) XXX_DiscardUnknown() { 128 xxx_messageInfo_LeaseStatus.DiscardUnknown(m) 129 } 130 131 var xxx_messageInfo_LeaseStatus proto.InternalMessageInfo 132 133 func init() { 134 proto.RegisterType((*LeaseStatus)(nil), "cockroach.kv.kvserver.storagepb.LeaseStatus") 135 proto.RegisterEnum("cockroach.kv.kvserver.storagepb.LeaseState", LeaseState_name, LeaseState_value) 136 } 137 func (m *LeaseStatus) Marshal() (dAtA []byte, err error) { 138 size := m.Size() 139 dAtA = make([]byte, size) 140 n, err := m.MarshalTo(dAtA) 141 if err != nil { 142 return nil, err 143 } 144 return dAtA[:n], nil 145 } 146 147 func (m *LeaseStatus) MarshalTo(dAtA []byte) (int, error) { 148 var i int 149 _ = i 150 var l int 151 _ = l 152 dAtA[i] = 0xa 153 i++ 154 i = encodeVarintLeaseStatus(dAtA, i, uint64(m.Lease.Size())) 155 n1, err := m.Lease.MarshalTo(dAtA[i:]) 156 if err != nil { 157 return 0, err 158 } 159 i += n1 160 dAtA[i] = 0x12 161 i++ 162 i = encodeVarintLeaseStatus(dAtA, i, uint64(m.Timestamp.Size())) 163 n2, err := m.Timestamp.MarshalTo(dAtA[i:]) 164 if err != nil { 165 return 0, err 166 } 167 i += n2 168 if m.State != 0 { 169 dAtA[i] = 0x18 170 i++ 171 i = encodeVarintLeaseStatus(dAtA, i, uint64(m.State)) 172 } 173 dAtA[i] = 0x22 174 i++ 175 i = encodeVarintLeaseStatus(dAtA, i, uint64(m.Liveness.Size())) 176 n3, err := m.Liveness.MarshalTo(dAtA[i:]) 177 if err != nil { 178 return 0, err 179 } 180 i += n3 181 return i, nil 182 } 183 184 func encodeVarintLeaseStatus(dAtA []byte, offset int, v uint64) int { 185 for v >= 1<<7 { 186 dAtA[offset] = uint8(v&0x7f | 0x80) 187 v >>= 7 188 offset++ 189 } 190 dAtA[offset] = uint8(v) 191 return offset + 1 192 } 193 func (m *LeaseStatus) Size() (n int) { 194 if m == nil { 195 return 0 196 } 197 var l int 198 _ = l 199 l = m.Lease.Size() 200 n += 1 + l + sovLeaseStatus(uint64(l)) 201 l = m.Timestamp.Size() 202 n += 1 + l + sovLeaseStatus(uint64(l)) 203 if m.State != 0 { 204 n += 1 + sovLeaseStatus(uint64(m.State)) 205 } 206 l = m.Liveness.Size() 207 n += 1 + l + sovLeaseStatus(uint64(l)) 208 return n 209 } 210 211 func sovLeaseStatus(x uint64) (n int) { 212 for { 213 n++ 214 x >>= 7 215 if x == 0 { 216 break 217 } 218 } 219 return n 220 } 221 func sozLeaseStatus(x uint64) (n int) { 222 return sovLeaseStatus(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 223 } 224 func (m *LeaseStatus) Unmarshal(dAtA []byte) error { 225 l := len(dAtA) 226 iNdEx := 0 227 for iNdEx < l { 228 preIndex := iNdEx 229 var wire uint64 230 for shift := uint(0); ; shift += 7 { 231 if shift >= 64 { 232 return ErrIntOverflowLeaseStatus 233 } 234 if iNdEx >= l { 235 return io.ErrUnexpectedEOF 236 } 237 b := dAtA[iNdEx] 238 iNdEx++ 239 wire |= (uint64(b) & 0x7F) << shift 240 if b < 0x80 { 241 break 242 } 243 } 244 fieldNum := int32(wire >> 3) 245 wireType := int(wire & 0x7) 246 if wireType == 4 { 247 return fmt.Errorf("proto: LeaseStatus: wiretype end group for non-group") 248 } 249 if fieldNum <= 0 { 250 return fmt.Errorf("proto: LeaseStatus: illegal tag %d (wire type %d)", fieldNum, wire) 251 } 252 switch fieldNum { 253 case 1: 254 if wireType != 2 { 255 return fmt.Errorf("proto: wrong wireType = %d for field Lease", wireType) 256 } 257 var msglen int 258 for shift := uint(0); ; shift += 7 { 259 if shift >= 64 { 260 return ErrIntOverflowLeaseStatus 261 } 262 if iNdEx >= l { 263 return io.ErrUnexpectedEOF 264 } 265 b := dAtA[iNdEx] 266 iNdEx++ 267 msglen |= (int(b) & 0x7F) << shift 268 if b < 0x80 { 269 break 270 } 271 } 272 if msglen < 0 { 273 return ErrInvalidLengthLeaseStatus 274 } 275 postIndex := iNdEx + msglen 276 if postIndex > l { 277 return io.ErrUnexpectedEOF 278 } 279 if err := m.Lease.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 280 return err 281 } 282 iNdEx = postIndex 283 case 2: 284 if wireType != 2 { 285 return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) 286 } 287 var msglen int 288 for shift := uint(0); ; shift += 7 { 289 if shift >= 64 { 290 return ErrIntOverflowLeaseStatus 291 } 292 if iNdEx >= l { 293 return io.ErrUnexpectedEOF 294 } 295 b := dAtA[iNdEx] 296 iNdEx++ 297 msglen |= (int(b) & 0x7F) << shift 298 if b < 0x80 { 299 break 300 } 301 } 302 if msglen < 0 { 303 return ErrInvalidLengthLeaseStatus 304 } 305 postIndex := iNdEx + msglen 306 if postIndex > l { 307 return io.ErrUnexpectedEOF 308 } 309 if err := m.Timestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 310 return err 311 } 312 iNdEx = postIndex 313 case 3: 314 if wireType != 0 { 315 return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) 316 } 317 m.State = 0 318 for shift := uint(0); ; shift += 7 { 319 if shift >= 64 { 320 return ErrIntOverflowLeaseStatus 321 } 322 if iNdEx >= l { 323 return io.ErrUnexpectedEOF 324 } 325 b := dAtA[iNdEx] 326 iNdEx++ 327 m.State |= (LeaseState(b) & 0x7F) << shift 328 if b < 0x80 { 329 break 330 } 331 } 332 case 4: 333 if wireType != 2 { 334 return fmt.Errorf("proto: wrong wireType = %d for field Liveness", wireType) 335 } 336 var msglen int 337 for shift := uint(0); ; shift += 7 { 338 if shift >= 64 { 339 return ErrIntOverflowLeaseStatus 340 } 341 if iNdEx >= l { 342 return io.ErrUnexpectedEOF 343 } 344 b := dAtA[iNdEx] 345 iNdEx++ 346 msglen |= (int(b) & 0x7F) << shift 347 if b < 0x80 { 348 break 349 } 350 } 351 if msglen < 0 { 352 return ErrInvalidLengthLeaseStatus 353 } 354 postIndex := iNdEx + msglen 355 if postIndex > l { 356 return io.ErrUnexpectedEOF 357 } 358 if err := m.Liveness.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 359 return err 360 } 361 iNdEx = postIndex 362 default: 363 iNdEx = preIndex 364 skippy, err := skipLeaseStatus(dAtA[iNdEx:]) 365 if err != nil { 366 return err 367 } 368 if skippy < 0 { 369 return ErrInvalidLengthLeaseStatus 370 } 371 if (iNdEx + skippy) > l { 372 return io.ErrUnexpectedEOF 373 } 374 iNdEx += skippy 375 } 376 } 377 378 if iNdEx > l { 379 return io.ErrUnexpectedEOF 380 } 381 return nil 382 } 383 func skipLeaseStatus(dAtA []byte) (n int, err error) { 384 l := len(dAtA) 385 iNdEx := 0 386 for iNdEx < l { 387 var wire uint64 388 for shift := uint(0); ; shift += 7 { 389 if shift >= 64 { 390 return 0, ErrIntOverflowLeaseStatus 391 } 392 if iNdEx >= l { 393 return 0, io.ErrUnexpectedEOF 394 } 395 b := dAtA[iNdEx] 396 iNdEx++ 397 wire |= (uint64(b) & 0x7F) << shift 398 if b < 0x80 { 399 break 400 } 401 } 402 wireType := int(wire & 0x7) 403 switch wireType { 404 case 0: 405 for shift := uint(0); ; shift += 7 { 406 if shift >= 64 { 407 return 0, ErrIntOverflowLeaseStatus 408 } 409 if iNdEx >= l { 410 return 0, io.ErrUnexpectedEOF 411 } 412 iNdEx++ 413 if dAtA[iNdEx-1] < 0x80 { 414 break 415 } 416 } 417 return iNdEx, nil 418 case 1: 419 iNdEx += 8 420 return iNdEx, nil 421 case 2: 422 var length int 423 for shift := uint(0); ; shift += 7 { 424 if shift >= 64 { 425 return 0, ErrIntOverflowLeaseStatus 426 } 427 if iNdEx >= l { 428 return 0, io.ErrUnexpectedEOF 429 } 430 b := dAtA[iNdEx] 431 iNdEx++ 432 length |= (int(b) & 0x7F) << shift 433 if b < 0x80 { 434 break 435 } 436 } 437 iNdEx += length 438 if length < 0 { 439 return 0, ErrInvalidLengthLeaseStatus 440 } 441 return iNdEx, nil 442 case 3: 443 for { 444 var innerWire uint64 445 var start int = iNdEx 446 for shift := uint(0); ; shift += 7 { 447 if shift >= 64 { 448 return 0, ErrIntOverflowLeaseStatus 449 } 450 if iNdEx >= l { 451 return 0, io.ErrUnexpectedEOF 452 } 453 b := dAtA[iNdEx] 454 iNdEx++ 455 innerWire |= (uint64(b) & 0x7F) << shift 456 if b < 0x80 { 457 break 458 } 459 } 460 innerWireType := int(innerWire & 0x7) 461 if innerWireType == 4 { 462 break 463 } 464 next, err := skipLeaseStatus(dAtA[start:]) 465 if err != nil { 466 return 0, err 467 } 468 iNdEx = start + next 469 } 470 return iNdEx, nil 471 case 4: 472 return iNdEx, nil 473 case 5: 474 iNdEx += 4 475 return iNdEx, nil 476 default: 477 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 478 } 479 } 480 panic("unreachable") 481 } 482 483 var ( 484 ErrInvalidLengthLeaseStatus = fmt.Errorf("proto: negative length found during unmarshaling") 485 ErrIntOverflowLeaseStatus = fmt.Errorf("proto: integer overflow") 486 ) 487 488 func init() { 489 proto.RegisterFile("kv/kvserver/kvserverpb/lease_status.proto", fileDescriptor_lease_status_c8125d34c8e4ebdc) 490 } 491 492 var fileDescriptor_lease_status_c8125d34c8e4ebdc = []byte{ 493 // 367 bytes of a gzipped FileDescriptorProto 494 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xcf, 0x6a, 0xea, 0x40, 495 0x18, 0xc5, 0x33, 0xfe, 0xbb, 0xd7, 0x11, 0x24, 0x0c, 0x77, 0x11, 0x84, 0x3b, 0x4a, 0xa1, 0xa0, 496 0x6d, 0x99, 0x80, 0xed, 0x0b, 0xc4, 0x9a, 0x45, 0x50, 0x50, 0x26, 0x52, 0x4a, 0x37, 0x25, 0x49, 497 0x07, 0x95, 0xc4, 0x26, 0x24, 0x63, 0x9e, 0xa3, 0xab, 0x3e, 0x93, 0x4b, 0x97, 0xae, 0x4a, 0x1b, 498 0x5f, 0xa4, 0x64, 0x12, 0x93, 0x6e, 0x8a, 0xbb, 0xc3, 0xcc, 0x39, 0xe7, 0xfb, 0xf1, 0x7d, 0x70, 499 0xe0, 0xc6, 0xaa, 0x1b, 0x47, 0x2c, 0x8c, 0x59, 0x58, 0x88, 0xc0, 0x56, 0x3d, 0x66, 0x45, 0xec, 500 0x39, 0xe2, 0x16, 0xdf, 0x46, 0x24, 0x08, 0x7d, 0xee, 0xa3, 0xae, 0xe3, 0x3b, 0x6e, 0xe8, 0x5b, 501 0xce, 0x8a, 0xb8, 0x31, 0x39, 0x79, 0x49, 0xc4, 0xfd, 0xd0, 0x5a, 0xb2, 0xc0, 0xee, 0x20, 0xf1, 502 0x19, 0xd8, 0xea, 0x8b, 0xc5, 0xad, 0x2c, 0xd4, 0xb9, 0xfc, 0xad, 0x7f, 0x1d, 0xb3, 0x57, 0x16, 503 0xe5, 0xdd, 0x1d, 0x65, 0xcb, 0xd7, 0x9e, 0xba, 0xf2, 0x1c, 0x95, 0xaf, 0x37, 0x2c, 0xe2, 0xd6, 504 0x26, 0xc8, 0x7f, 0xfe, 0x2d, 0xfd, 0xa5, 0x2f, 0xa4, 0x9a, 0xaa, 0xec, 0xf5, 0xe2, 0xbd, 0x02, 505 0x5b, 0xd3, 0x14, 0xd1, 0x14, 0x84, 0xe8, 0x0e, 0xd6, 0x05, 0xb1, 0x02, 0x7a, 0xa0, 0xdf, 0x1a, 506 0x2a, 0xa4, 0x64, 0xcd, 0xa1, 0x88, 0xb0, 0x8f, 0x6a, 0xbb, 0x8f, 0xae, 0x44, 0x33, 0x33, 0xd2, 507 0x60, 0xb3, 0x18, 0xa7, 0x54, 0x44, 0xf2, 0xff, 0x8f, 0x64, 0xca, 0x44, 0x56, 0x9e, 0x43, 0x16, 508 0x27, 0x53, 0x1e, 0x2f, 0x53, 0x48, 0x83, 0xf5, 0x74, 0x49, 0x4c, 0xa9, 0xf6, 0x40, 0xbf, 0x3d, 509 0xbc, 0x26, 0x67, 0x96, 0x44, 0x0a, 0x6a, 0x46, 0xb3, 0x24, 0x9a, 0xc0, 0xbf, 0xa7, 0x6d, 0x28, 510 0x35, 0x01, 0x31, 0x38, 0xdf, 0x92, 0x07, 0x72, 0xa0, 0xa2, 0xe0, 0x6a, 0x02, 0x61, 0x39, 0x01, 511 0x35, 0x61, 0x5d, 0xa7, 0x74, 0x46, 0x65, 0x29, 0x95, 0x0f, 0xda, 0xd4, 0x18, 0xcb, 0x00, 0x41, 512 0xd8, 0x30, 0x17, 0x9a, 0x69, 0x98, 0x72, 0x05, 0xb5, 0xe0, 0x1f, 0xfd, 0x71, 0x6e, 0x50, 0x7d, 513 0x2c, 0x57, 0x51, 0x1b, 0xc2, 0x39, 0x9d, 0x99, 0xf7, 0xd4, 0x18, 0xe9, 0x63, 0xb9, 0x36, 0xba, 514 0xd9, 0x7d, 0x61, 0x69, 0x97, 0x60, 0xb0, 0x4f, 0x30, 0x38, 0x24, 0x18, 0x7c, 0x26, 0x18, 0xbc, 515 0x1d, 0xb1, 0xb4, 0x3f, 0x62, 0xe9, 0x70, 0xc4, 0xd2, 0x13, 0x2c, 0x4f, 0x6a, 0x37, 0xc4, 0x69, 516 0x6e, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x2c, 0xd3, 0xba, 0xbd, 0x53, 0x02, 0x00, 0x00, 517 }