github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/sqlbase/privilege.pb.go (about)

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: sql/sqlbase/privilege.proto
     3  
     4  package sqlbase
     5  
     6  import proto "github.com/gogo/protobuf/proto"
     7  import fmt "fmt"
     8  import math "math"
     9  
    10  import io "io"
    11  
    12  // Reference imports to suppress errors if they are not otherwise used.
    13  var _ = proto.Marshal
    14  var _ = fmt.Errorf
    15  var _ = math.Inf
    16  
    17  // This is a compile-time assertion to ensure that this generated file
    18  // is compatible with the proto package it is being compiled against.
    19  // A compilation error at this line likely means your copy of the
    20  // proto package needs to be updated.
    21  const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
    22  
    23  // UserPrivileges describes the list of privileges available for a given user.
    24  type UserPrivileges struct {
    25  	User string `protobuf:"bytes,1,opt,name=user" json:"user"`
    26  	// privileges is a bitfield of 1<<Privilege values.
    27  	Privileges uint32 `protobuf:"varint,2,opt,name=privileges" json:"privileges"`
    28  }
    29  
    30  func (m *UserPrivileges) Reset()         { *m = UserPrivileges{} }
    31  func (m *UserPrivileges) String() string { return proto.CompactTextString(m) }
    32  func (*UserPrivileges) ProtoMessage()    {}
    33  func (*UserPrivileges) Descriptor() ([]byte, []int) {
    34  	return fileDescriptor_privilege_75243489d6de4ea3, []int{0}
    35  }
    36  func (m *UserPrivileges) XXX_Unmarshal(b []byte) error {
    37  	return m.Unmarshal(b)
    38  }
    39  func (m *UserPrivileges) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    40  	b = b[:cap(b)]
    41  	n, err := m.MarshalTo(b)
    42  	if err != nil {
    43  		return nil, err
    44  	}
    45  	return b[:n], nil
    46  }
    47  func (dst *UserPrivileges) XXX_Merge(src proto.Message) {
    48  	xxx_messageInfo_UserPrivileges.Merge(dst, src)
    49  }
    50  func (m *UserPrivileges) XXX_Size() int {
    51  	return m.Size()
    52  }
    53  func (m *UserPrivileges) XXX_DiscardUnknown() {
    54  	xxx_messageInfo_UserPrivileges.DiscardUnknown(m)
    55  }
    56  
    57  var xxx_messageInfo_UserPrivileges proto.InternalMessageInfo
    58  
    59  // PrivilegeDescriptor describes a list of users and attached
    60  // privileges. The list should be sorted by user for fast access.
    61  type PrivilegeDescriptor struct {
    62  	Users []UserPrivileges `protobuf:"bytes,1,rep,name=users" json:"users"`
    63  }
    64  
    65  func (m *PrivilegeDescriptor) Reset()         { *m = PrivilegeDescriptor{} }
    66  func (m *PrivilegeDescriptor) String() string { return proto.CompactTextString(m) }
    67  func (*PrivilegeDescriptor) ProtoMessage()    {}
    68  func (*PrivilegeDescriptor) Descriptor() ([]byte, []int) {
    69  	return fileDescriptor_privilege_75243489d6de4ea3, []int{1}
    70  }
    71  func (m *PrivilegeDescriptor) XXX_Unmarshal(b []byte) error {
    72  	return m.Unmarshal(b)
    73  }
    74  func (m *PrivilegeDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    75  	b = b[:cap(b)]
    76  	n, err := m.MarshalTo(b)
    77  	if err != nil {
    78  		return nil, err
    79  	}
    80  	return b[:n], nil
    81  }
    82  func (dst *PrivilegeDescriptor) XXX_Merge(src proto.Message) {
    83  	xxx_messageInfo_PrivilegeDescriptor.Merge(dst, src)
    84  }
    85  func (m *PrivilegeDescriptor) XXX_Size() int {
    86  	return m.Size()
    87  }
    88  func (m *PrivilegeDescriptor) XXX_DiscardUnknown() {
    89  	xxx_messageInfo_PrivilegeDescriptor.DiscardUnknown(m)
    90  }
    91  
    92  var xxx_messageInfo_PrivilegeDescriptor proto.InternalMessageInfo
    93  
    94  func init() {
    95  	proto.RegisterType((*UserPrivileges)(nil), "cockroach.sql.sqlbase.UserPrivileges")
    96  	proto.RegisterType((*PrivilegeDescriptor)(nil), "cockroach.sql.sqlbase.PrivilegeDescriptor")
    97  }
    98  func (this *UserPrivileges) Equal(that interface{}) bool {
    99  	if that == nil {
   100  		return this == nil
   101  	}
   102  
   103  	that1, ok := that.(*UserPrivileges)
   104  	if !ok {
   105  		that2, ok := that.(UserPrivileges)
   106  		if ok {
   107  			that1 = &that2
   108  		} else {
   109  			return false
   110  		}
   111  	}
   112  	if that1 == nil {
   113  		return this == nil
   114  	} else if this == nil {
   115  		return false
   116  	}
   117  	if this.User != that1.User {
   118  		return false
   119  	}
   120  	if this.Privileges != that1.Privileges {
   121  		return false
   122  	}
   123  	return true
   124  }
   125  func (this *PrivilegeDescriptor) Equal(that interface{}) bool {
   126  	if that == nil {
   127  		return this == nil
   128  	}
   129  
   130  	that1, ok := that.(*PrivilegeDescriptor)
   131  	if !ok {
   132  		that2, ok := that.(PrivilegeDescriptor)
   133  		if ok {
   134  			that1 = &that2
   135  		} else {
   136  			return false
   137  		}
   138  	}
   139  	if that1 == nil {
   140  		return this == nil
   141  	} else if this == nil {
   142  		return false
   143  	}
   144  	if len(this.Users) != len(that1.Users) {
   145  		return false
   146  	}
   147  	for i := range this.Users {
   148  		if !this.Users[i].Equal(&that1.Users[i]) {
   149  			return false
   150  		}
   151  	}
   152  	return true
   153  }
   154  func (m *UserPrivileges) Marshal() (dAtA []byte, err error) {
   155  	size := m.Size()
   156  	dAtA = make([]byte, size)
   157  	n, err := m.MarshalTo(dAtA)
   158  	if err != nil {
   159  		return nil, err
   160  	}
   161  	return dAtA[:n], nil
   162  }
   163  
   164  func (m *UserPrivileges) MarshalTo(dAtA []byte) (int, error) {
   165  	var i int
   166  	_ = i
   167  	var l int
   168  	_ = l
   169  	dAtA[i] = 0xa
   170  	i++
   171  	i = encodeVarintPrivilege(dAtA, i, uint64(len(m.User)))
   172  	i += copy(dAtA[i:], m.User)
   173  	dAtA[i] = 0x10
   174  	i++
   175  	i = encodeVarintPrivilege(dAtA, i, uint64(m.Privileges))
   176  	return i, nil
   177  }
   178  
   179  func (m *PrivilegeDescriptor) Marshal() (dAtA []byte, err error) {
   180  	size := m.Size()
   181  	dAtA = make([]byte, size)
   182  	n, err := m.MarshalTo(dAtA)
   183  	if err != nil {
   184  		return nil, err
   185  	}
   186  	return dAtA[:n], nil
   187  }
   188  
   189  func (m *PrivilegeDescriptor) MarshalTo(dAtA []byte) (int, error) {
   190  	var i int
   191  	_ = i
   192  	var l int
   193  	_ = l
   194  	if len(m.Users) > 0 {
   195  		for _, msg := range m.Users {
   196  			dAtA[i] = 0xa
   197  			i++
   198  			i = encodeVarintPrivilege(dAtA, i, uint64(msg.Size()))
   199  			n, err := msg.MarshalTo(dAtA[i:])
   200  			if err != nil {
   201  				return 0, err
   202  			}
   203  			i += n
   204  		}
   205  	}
   206  	return i, nil
   207  }
   208  
   209  func encodeVarintPrivilege(dAtA []byte, offset int, v uint64) int {
   210  	for v >= 1<<7 {
   211  		dAtA[offset] = uint8(v&0x7f | 0x80)
   212  		v >>= 7
   213  		offset++
   214  	}
   215  	dAtA[offset] = uint8(v)
   216  	return offset + 1
   217  }
   218  func (m *UserPrivileges) Size() (n int) {
   219  	if m == nil {
   220  		return 0
   221  	}
   222  	var l int
   223  	_ = l
   224  	l = len(m.User)
   225  	n += 1 + l + sovPrivilege(uint64(l))
   226  	n += 1 + sovPrivilege(uint64(m.Privileges))
   227  	return n
   228  }
   229  
   230  func (m *PrivilegeDescriptor) Size() (n int) {
   231  	if m == nil {
   232  		return 0
   233  	}
   234  	var l int
   235  	_ = l
   236  	if len(m.Users) > 0 {
   237  		for _, e := range m.Users {
   238  			l = e.Size()
   239  			n += 1 + l + sovPrivilege(uint64(l))
   240  		}
   241  	}
   242  	return n
   243  }
   244  
   245  func sovPrivilege(x uint64) (n int) {
   246  	for {
   247  		n++
   248  		x >>= 7
   249  		if x == 0 {
   250  			break
   251  		}
   252  	}
   253  	return n
   254  }
   255  func sozPrivilege(x uint64) (n int) {
   256  	return sovPrivilege(uint64((x << 1) ^ uint64((int64(x) >> 63))))
   257  }
   258  func (m *UserPrivileges) Unmarshal(dAtA []byte) error {
   259  	l := len(dAtA)
   260  	iNdEx := 0
   261  	for iNdEx < l {
   262  		preIndex := iNdEx
   263  		var wire uint64
   264  		for shift := uint(0); ; shift += 7 {
   265  			if shift >= 64 {
   266  				return ErrIntOverflowPrivilege
   267  			}
   268  			if iNdEx >= l {
   269  				return io.ErrUnexpectedEOF
   270  			}
   271  			b := dAtA[iNdEx]
   272  			iNdEx++
   273  			wire |= (uint64(b) & 0x7F) << shift
   274  			if b < 0x80 {
   275  				break
   276  			}
   277  		}
   278  		fieldNum := int32(wire >> 3)
   279  		wireType := int(wire & 0x7)
   280  		if wireType == 4 {
   281  			return fmt.Errorf("proto: UserPrivileges: wiretype end group for non-group")
   282  		}
   283  		if fieldNum <= 0 {
   284  			return fmt.Errorf("proto: UserPrivileges: illegal tag %d (wire type %d)", fieldNum, wire)
   285  		}
   286  		switch fieldNum {
   287  		case 1:
   288  			if wireType != 2 {
   289  				return fmt.Errorf("proto: wrong wireType = %d for field User", wireType)
   290  			}
   291  			var stringLen uint64
   292  			for shift := uint(0); ; shift += 7 {
   293  				if shift >= 64 {
   294  					return ErrIntOverflowPrivilege
   295  				}
   296  				if iNdEx >= l {
   297  					return io.ErrUnexpectedEOF
   298  				}
   299  				b := dAtA[iNdEx]
   300  				iNdEx++
   301  				stringLen |= (uint64(b) & 0x7F) << shift
   302  				if b < 0x80 {
   303  					break
   304  				}
   305  			}
   306  			intStringLen := int(stringLen)
   307  			if intStringLen < 0 {
   308  				return ErrInvalidLengthPrivilege
   309  			}
   310  			postIndex := iNdEx + intStringLen
   311  			if postIndex > l {
   312  				return io.ErrUnexpectedEOF
   313  			}
   314  			m.User = string(dAtA[iNdEx:postIndex])
   315  			iNdEx = postIndex
   316  		case 2:
   317  			if wireType != 0 {
   318  				return fmt.Errorf("proto: wrong wireType = %d for field Privileges", wireType)
   319  			}
   320  			m.Privileges = 0
   321  			for shift := uint(0); ; shift += 7 {
   322  				if shift >= 64 {
   323  					return ErrIntOverflowPrivilege
   324  				}
   325  				if iNdEx >= l {
   326  					return io.ErrUnexpectedEOF
   327  				}
   328  				b := dAtA[iNdEx]
   329  				iNdEx++
   330  				m.Privileges |= (uint32(b) & 0x7F) << shift
   331  				if b < 0x80 {
   332  					break
   333  				}
   334  			}
   335  		default:
   336  			iNdEx = preIndex
   337  			skippy, err := skipPrivilege(dAtA[iNdEx:])
   338  			if err != nil {
   339  				return err
   340  			}
   341  			if skippy < 0 {
   342  				return ErrInvalidLengthPrivilege
   343  			}
   344  			if (iNdEx + skippy) > l {
   345  				return io.ErrUnexpectedEOF
   346  			}
   347  			iNdEx += skippy
   348  		}
   349  	}
   350  
   351  	if iNdEx > l {
   352  		return io.ErrUnexpectedEOF
   353  	}
   354  	return nil
   355  }
   356  func (m *PrivilegeDescriptor) Unmarshal(dAtA []byte) error {
   357  	l := len(dAtA)
   358  	iNdEx := 0
   359  	for iNdEx < l {
   360  		preIndex := iNdEx
   361  		var wire uint64
   362  		for shift := uint(0); ; shift += 7 {
   363  			if shift >= 64 {
   364  				return ErrIntOverflowPrivilege
   365  			}
   366  			if iNdEx >= l {
   367  				return io.ErrUnexpectedEOF
   368  			}
   369  			b := dAtA[iNdEx]
   370  			iNdEx++
   371  			wire |= (uint64(b) & 0x7F) << shift
   372  			if b < 0x80 {
   373  				break
   374  			}
   375  		}
   376  		fieldNum := int32(wire >> 3)
   377  		wireType := int(wire & 0x7)
   378  		if wireType == 4 {
   379  			return fmt.Errorf("proto: PrivilegeDescriptor: wiretype end group for non-group")
   380  		}
   381  		if fieldNum <= 0 {
   382  			return fmt.Errorf("proto: PrivilegeDescriptor: illegal tag %d (wire type %d)", fieldNum, wire)
   383  		}
   384  		switch fieldNum {
   385  		case 1:
   386  			if wireType != 2 {
   387  				return fmt.Errorf("proto: wrong wireType = %d for field Users", wireType)
   388  			}
   389  			var msglen int
   390  			for shift := uint(0); ; shift += 7 {
   391  				if shift >= 64 {
   392  					return ErrIntOverflowPrivilege
   393  				}
   394  				if iNdEx >= l {
   395  					return io.ErrUnexpectedEOF
   396  				}
   397  				b := dAtA[iNdEx]
   398  				iNdEx++
   399  				msglen |= (int(b) & 0x7F) << shift
   400  				if b < 0x80 {
   401  					break
   402  				}
   403  			}
   404  			if msglen < 0 {
   405  				return ErrInvalidLengthPrivilege
   406  			}
   407  			postIndex := iNdEx + msglen
   408  			if postIndex > l {
   409  				return io.ErrUnexpectedEOF
   410  			}
   411  			m.Users = append(m.Users, UserPrivileges{})
   412  			if err := m.Users[len(m.Users)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
   413  				return err
   414  			}
   415  			iNdEx = postIndex
   416  		default:
   417  			iNdEx = preIndex
   418  			skippy, err := skipPrivilege(dAtA[iNdEx:])
   419  			if err != nil {
   420  				return err
   421  			}
   422  			if skippy < 0 {
   423  				return ErrInvalidLengthPrivilege
   424  			}
   425  			if (iNdEx + skippy) > l {
   426  				return io.ErrUnexpectedEOF
   427  			}
   428  			iNdEx += skippy
   429  		}
   430  	}
   431  
   432  	if iNdEx > l {
   433  		return io.ErrUnexpectedEOF
   434  	}
   435  	return nil
   436  }
   437  func skipPrivilege(dAtA []byte) (n int, err error) {
   438  	l := len(dAtA)
   439  	iNdEx := 0
   440  	for iNdEx < l {
   441  		var wire uint64
   442  		for shift := uint(0); ; shift += 7 {
   443  			if shift >= 64 {
   444  				return 0, ErrIntOverflowPrivilege
   445  			}
   446  			if iNdEx >= l {
   447  				return 0, io.ErrUnexpectedEOF
   448  			}
   449  			b := dAtA[iNdEx]
   450  			iNdEx++
   451  			wire |= (uint64(b) & 0x7F) << shift
   452  			if b < 0x80 {
   453  				break
   454  			}
   455  		}
   456  		wireType := int(wire & 0x7)
   457  		switch wireType {
   458  		case 0:
   459  			for shift := uint(0); ; shift += 7 {
   460  				if shift >= 64 {
   461  					return 0, ErrIntOverflowPrivilege
   462  				}
   463  				if iNdEx >= l {
   464  					return 0, io.ErrUnexpectedEOF
   465  				}
   466  				iNdEx++
   467  				if dAtA[iNdEx-1] < 0x80 {
   468  					break
   469  				}
   470  			}
   471  			return iNdEx, nil
   472  		case 1:
   473  			iNdEx += 8
   474  			return iNdEx, nil
   475  		case 2:
   476  			var length int
   477  			for shift := uint(0); ; shift += 7 {
   478  				if shift >= 64 {
   479  					return 0, ErrIntOverflowPrivilege
   480  				}
   481  				if iNdEx >= l {
   482  					return 0, io.ErrUnexpectedEOF
   483  				}
   484  				b := dAtA[iNdEx]
   485  				iNdEx++
   486  				length |= (int(b) & 0x7F) << shift
   487  				if b < 0x80 {
   488  					break
   489  				}
   490  			}
   491  			iNdEx += length
   492  			if length < 0 {
   493  				return 0, ErrInvalidLengthPrivilege
   494  			}
   495  			return iNdEx, nil
   496  		case 3:
   497  			for {
   498  				var innerWire uint64
   499  				var start int = iNdEx
   500  				for shift := uint(0); ; shift += 7 {
   501  					if shift >= 64 {
   502  						return 0, ErrIntOverflowPrivilege
   503  					}
   504  					if iNdEx >= l {
   505  						return 0, io.ErrUnexpectedEOF
   506  					}
   507  					b := dAtA[iNdEx]
   508  					iNdEx++
   509  					innerWire |= (uint64(b) & 0x7F) << shift
   510  					if b < 0x80 {
   511  						break
   512  					}
   513  				}
   514  				innerWireType := int(innerWire & 0x7)
   515  				if innerWireType == 4 {
   516  					break
   517  				}
   518  				next, err := skipPrivilege(dAtA[start:])
   519  				if err != nil {
   520  					return 0, err
   521  				}
   522  				iNdEx = start + next
   523  			}
   524  			return iNdEx, nil
   525  		case 4:
   526  			return iNdEx, nil
   527  		case 5:
   528  			iNdEx += 4
   529  			return iNdEx, nil
   530  		default:
   531  			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
   532  		}
   533  	}
   534  	panic("unreachable")
   535  }
   536  
   537  var (
   538  	ErrInvalidLengthPrivilege = fmt.Errorf("proto: negative length found during unmarshaling")
   539  	ErrIntOverflowPrivilege   = fmt.Errorf("proto: integer overflow")
   540  )
   541  
   542  func init() {
   543  	proto.RegisterFile("sql/sqlbase/privilege.proto", fileDescriptor_privilege_75243489d6de4ea3)
   544  }
   545  
   546  var fileDescriptor_privilege_75243489d6de4ea3 = []byte{
   547  	// 227 bytes of a gzipped FileDescriptorProto
   548  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2e, 0x2e, 0xcc, 0xd1,
   549  	0x2f, 0x2e, 0xcc, 0x49, 0x4a, 0x2c, 0x4e, 0xd5, 0x2f, 0x28, 0xca, 0x2c, 0xcb, 0xcc, 0x49, 0x4d,
   550  	0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x4d, 0xce, 0x4f, 0xce, 0x2e, 0xca, 0x4f,
   551  	0x4c, 0xce, 0xd0, 0x2b, 0x2e, 0xcc, 0xd1, 0x83, 0x2a, 0x93, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07,
   552  	0xab, 0xd0, 0x07, 0xb1, 0x20, 0x8a, 0x95, 0xc2, 0xb8, 0xf8, 0x42, 0x8b, 0x53, 0x8b, 0x02, 0x60,
   553  	0x66, 0x14, 0x0b, 0x49, 0x70, 0xb1, 0x94, 0x16, 0xa7, 0x16, 0x49, 0x30, 0x2a, 0x30, 0x6a, 0x70,
   554  	0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0x16, 0x11, 0x52, 0xe1, 0xe2, 0x82, 0xdb, 0x55,
   555  	0x2c, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x0b, 0x95, 0x47, 0x12, 0xb7, 0x62, 0x79, 0xb1, 0x40, 0x9e,
   556  	0x51, 0x29, 0x8e, 0x4b, 0x18, 0x6e, 0xa6, 0x4b, 0x6a, 0x71, 0x72, 0x51, 0x66, 0x41, 0x49, 0x7e,
   557  	0x91, 0x90, 0x23, 0x17, 0x2b, 0xc8, 0xa8, 0x62, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x6e, 0x23, 0x55,
   558  	0x3d, 0xac, 0x6e, 0xd5, 0x43, 0x75, 0x12, 0xd4, 0x12, 0x88, 0x4e, 0x88, 0xf9, 0x4e, 0x9a, 0x27,
   559  	0x1e, 0xca, 0x31, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x8d, 0x47, 0x72, 0x8c,
   560  	0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72,
   561  	0x0c, 0x51, 0xec, 0x50, 0xc3, 0x00, 0x01, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xbf, 0x60, 0xab, 0x2d,
   562  	0x01, 0x00, 0x00,
   563  }