mirror of https://github.com/status-im/consul.git
Expand the QueryOptions and QueryMeta interfaces (#6545)
In a previous PR I made it so that we had interfaces that would work enough to allow blockingQueries to work. However to complete this we need all fields to be settable and gettable. Notes: • If Go ever gets contracts/generics then we could get rid of all the Getters/Setters • protoc / protoc-gen-gogo are going to generate all the getters for us. • I copied all the getters/setters from the protobuf funcs into agent/structs/protobuf_compat.go • Also added JSON marshaling funcs that use jsonpb for protobuf types.
This commit is contained in:
parent
fdd10dd8b8
commit
76cf54068b
|
@ -14,68 +14,99 @@ func (q *QueryOptions) AllowStaleRead() bool {
|
|||
return q.AllowStale
|
||||
}
|
||||
|
||||
// TokenSecret returns the token to be used to authorize the request
|
||||
func (q *QueryOptions) TokenSecret() string {
|
||||
return q.Token
|
||||
}
|
||||
|
||||
// GetMinQueryIndex implements the interface necessary to be used
|
||||
// in a blocking query
|
||||
func (q *QueryOptions) GetMinQueryIndex() uint64 {
|
||||
return q.MinQueryIndex
|
||||
// SetToken is needed to implement the structs.QueryOptionsCompat interface
|
||||
func (q *QueryOptions) SetToken(token string) {
|
||||
q.Token = token
|
||||
}
|
||||
|
||||
// GetMaxQueryTime implements the interface necessary to be used
|
||||
// in a blocking query
|
||||
func (q *QueryOptions) GetMaxQueryTime() time.Duration {
|
||||
return q.MaxQueryTime
|
||||
// SetMinQueryIndex is needed to implement the structs.QueryOptionsCompat interface
|
||||
func (q *QueryOptions) SetMinQueryIndex(minQueryIndex uint64) {
|
||||
q.MinQueryIndex = minQueryIndex
|
||||
}
|
||||
|
||||
// GetRequireConsistent implements the interface necessary to be used
|
||||
// in a blocking query
|
||||
func (q *QueryOptions) GetRequireConsistent() bool {
|
||||
return q.RequireConsistent
|
||||
// SetMaxQueryTime is needed to implement the structs.QueryOptionsCompat interface
|
||||
func (q *QueryOptions) SetMaxQueryTime(maxQueryTime time.Duration) {
|
||||
q.MaxQueryTime = maxQueryTime
|
||||
}
|
||||
|
||||
// SetLastContact implements the interface necessary to be used
|
||||
// in a blocking query
|
||||
// SetAllowStale is needed to implement the structs.QueryOptionsCompat interface
|
||||
func (q *QueryOptions) SetAllowStale(allowStale bool) {
|
||||
q.AllowStale = allowStale
|
||||
}
|
||||
|
||||
// SetRequireConsistent is needed to implement the structs.QueryOptionsCompat interface
|
||||
func (q *QueryOptions) SetRequireConsistent(requireConsistent bool) {
|
||||
q.RequireConsistent = requireConsistent
|
||||
}
|
||||
|
||||
// SetUseCache is needed to implement the structs.QueryOptionsCompat interface
|
||||
func (q *QueryOptions) SetUseCache(useCache bool) {
|
||||
q.UseCache = useCache
|
||||
}
|
||||
|
||||
// SetMaxStaleDuration is needed to implement the structs.QueryOptionsCompat interface
|
||||
func (q *QueryOptions) SetMaxStaleDuration(maxStaleDuration time.Duration) {
|
||||
q.MaxStaleDuration = maxStaleDuration
|
||||
}
|
||||
|
||||
// SetMaxAge is needed to implement the structs.QueryOptionsCompat interface
|
||||
func (q *QueryOptions) SetMaxAge(maxAge time.Duration) {
|
||||
q.MaxAge = maxAge
|
||||
}
|
||||
|
||||
// SetMustRevalidate is needed to implement the structs.QueryOptionsCompat interface
|
||||
func (q *QueryOptions) SetMustRevalidate(mustRevalidate bool) {
|
||||
q.MustRevalidate = mustRevalidate
|
||||
}
|
||||
|
||||
// SetStaleIfError is needed to implement the structs.QueryOptionsCompat interface
|
||||
func (q *QueryOptions) SetStaleIfError(staleIfError time.Duration) {
|
||||
q.StaleIfError = staleIfError
|
||||
}
|
||||
|
||||
// SetFilter is needed to implement the structs.QueryOptionsCompat interface
|
||||
func (q *QueryOptions) SetFilter(filter string) {
|
||||
q.Filter = filter
|
||||
}
|
||||
|
||||
// SetLastContact is needed to implement the structs.QueryMetaCompat interface
|
||||
func (q *QueryMeta) SetLastContact(lastContact time.Duration) {
|
||||
q.LastContact = lastContact
|
||||
}
|
||||
|
||||
// SetKnownLeader implements the interface necessary to be used
|
||||
// in a blocking query
|
||||
// SetKnownLeader is needed to implement the structs.QueryMetaCompat interface
|
||||
func (q *QueryMeta) SetKnownLeader(knownLeader bool) {
|
||||
q.KnownLeader = knownLeader
|
||||
}
|
||||
|
||||
// GetIndex implements the interface necessary to be used
|
||||
// in a blocking query
|
||||
func (q *QueryMeta) GetIndex() uint64 {
|
||||
return q.Index
|
||||
}
|
||||
|
||||
// SetIndex implements the interface necessary to be used
|
||||
// in a blocking query
|
||||
// SetIndex is needed to implement the structs.QueryMetaCompat interface
|
||||
func (q *QueryMeta) SetIndex(index uint64) {
|
||||
q.Index = index
|
||||
}
|
||||
|
||||
// SetConsistencyLevel is needed to implement the structs.QueryMetaCompat interface
|
||||
func (q *QueryMeta) SetConsistencyLevel(consistencyLevel string) {
|
||||
q.ConsistencyLevel = consistencyLevel
|
||||
}
|
||||
|
||||
// WriteRequest only applies to writes, always false
|
||||
func (w WriteRequest) IsRead() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (w WriteRequest) TokenSecret() string {
|
||||
return w.Token
|
||||
}
|
||||
|
||||
// AllowStaleRead returns whether a stale read should be allowed
|
||||
func (w WriteRequest) AllowStaleRead() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// TokenSecret returns the token to be used to authorize the request
|
||||
func (w WriteRequest) TokenSecret() string {
|
||||
return w.Token
|
||||
}
|
||||
|
||||
func (td TargetDatacenter) RequestDatacenter() string {
|
||||
return td.Datacenter
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
proto "github.com/golang/protobuf/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
time "time"
|
||||
)
|
||||
|
||||
|
@ -24,7 +25,7 @@ var _ = time.Kitchen
|
|||
// 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.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
// RaftIndex is used to track the index used while creating
|
||||
// or modifying a given struct type.
|
||||
|
@ -47,7 +48,7 @@ func (m *RaftIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|||
return xxx_messageInfo_RaftIndex.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalTo(b)
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -86,7 +87,7 @@ func (m *TargetDatacenter) XXX_Marshal(b []byte, deterministic bool) ([]byte, er
|
|||
return xxx_messageInfo_TargetDatacenter.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalTo(b)
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -125,7 +126,7 @@ func (m *WriteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
|
|||
return xxx_messageInfo_WriteRequest.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalTo(b)
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -144,6 +145,13 @@ func (m *WriteRequest) XXX_DiscardUnknown() {
|
|||
|
||||
var xxx_messageInfo_WriteRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *WriteRequest) GetToken() string {
|
||||
if m != nil {
|
||||
return m.Token
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// QueryOptions is used to specify various flags for read queries
|
||||
type QueryOptions struct {
|
||||
// Token is the ACL token ID. If not provided, the 'anonymous'
|
||||
|
@ -211,7 +219,7 @@ func (m *QueryOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
|
|||
return xxx_messageInfo_QueryOptions.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalTo(b)
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -230,6 +238,83 @@ func (m *QueryOptions) XXX_DiscardUnknown() {
|
|||
|
||||
var xxx_messageInfo_QueryOptions proto.InternalMessageInfo
|
||||
|
||||
func (m *QueryOptions) GetToken() string {
|
||||
if m != nil {
|
||||
return m.Token
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *QueryOptions) GetMinQueryIndex() uint64 {
|
||||
if m != nil {
|
||||
return m.MinQueryIndex
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *QueryOptions) GetMaxQueryTime() time.Duration {
|
||||
if m != nil {
|
||||
return m.MaxQueryTime
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *QueryOptions) GetAllowStale() bool {
|
||||
if m != nil {
|
||||
return m.AllowStale
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *QueryOptions) GetRequireConsistent() bool {
|
||||
if m != nil {
|
||||
return m.RequireConsistent
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *QueryOptions) GetUseCache() bool {
|
||||
if m != nil {
|
||||
return m.UseCache
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *QueryOptions) GetMaxStaleDuration() time.Duration {
|
||||
if m != nil {
|
||||
return m.MaxStaleDuration
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *QueryOptions) GetMaxAge() time.Duration {
|
||||
if m != nil {
|
||||
return m.MaxAge
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *QueryOptions) GetMustRevalidate() bool {
|
||||
if m != nil {
|
||||
return m.MustRevalidate
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *QueryOptions) GetStaleIfError() time.Duration {
|
||||
if m != nil {
|
||||
return m.StaleIfError
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *QueryOptions) GetFilter() string {
|
||||
if m != nil {
|
||||
return m.Filter
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// QueryMeta allows a query response to include potentially
|
||||
// useful metadata about a query
|
||||
type QueryMeta struct {
|
||||
|
@ -261,7 +346,7 @@ func (m *QueryMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|||
return xxx_messageInfo_QueryMeta.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalTo(b)
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -280,6 +365,34 @@ func (m *QueryMeta) XXX_DiscardUnknown() {
|
|||
|
||||
var xxx_messageInfo_QueryMeta proto.InternalMessageInfo
|
||||
|
||||
func (m *QueryMeta) GetIndex() uint64 {
|
||||
if m != nil {
|
||||
return m.Index
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *QueryMeta) GetLastContact() time.Duration {
|
||||
if m != nil {
|
||||
return m.LastContact
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *QueryMeta) GetKnownLeader() bool {
|
||||
if m != nil {
|
||||
return m.KnownLeader
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *QueryMeta) GetConsistencyLevel() string {
|
||||
if m != nil {
|
||||
return m.ConsistencyLevel
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*RaftIndex)(nil), "agentpb.RaftIndex")
|
||||
proto.RegisterType((*TargetDatacenter)(nil), "agentpb.TargetDatacenter")
|
||||
|
@ -291,47 +404,47 @@ func init() {
|
|||
func init() { proto.RegisterFile("common.proto", fileDescriptor_555bd8c177793206) }
|
||||
|
||||
var fileDescriptor_555bd8c177793206 = []byte{
|
||||
// 529 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x41, 0x6f, 0x12, 0x4f,
|
||||
0x1c, 0xdd, 0xfd, 0xff, 0x29, 0x65, 0x7f, 0x50, 0x83, 0x93, 0xc6, 0xac, 0x1c, 0x06, 0xb2, 0x69,
|
||||
0x0c, 0x31, 0x0a, 0x49, 0xbd, 0xe9, 0xa9, 0xd0, 0x6a, 0x1a, 0xd9, 0x34, 0x8e, 0x18, 0xcf, 0x03,
|
||||
0xfc, 0x58, 0x37, 0x2e, 0x33, 0x38, 0x3b, 0xb4, 0xf0, 0x2d, 0x3c, 0x78, 0xe8, 0x27, 0xf1, 0x33,
|
||||
0x70, 0xec, 0xd1, 0x53, 0x55, 0xf8, 0x06, 0x7e, 0x02, 0xb3, 0xb3, 0x50, 0xb7, 0xd2, 0x03, 0xde,
|
||||
0xf6, 0xbd, 0x7d, 0x6f, 0xe6, 0xcd, 0xef, 0xf7, 0xa0, 0xd4, 0x97, 0xa3, 0x91, 0x14, 0x8d, 0xb1,
|
||||
0x92, 0x5a, 0x92, 0x5d, 0x1e, 0xa0, 0xd0, 0xe3, 0x5e, 0x85, 0x06, 0x52, 0x06, 0x11, 0x36, 0x0d,
|
||||
0xdd, 0x9b, 0x0c, 0x9b, 0x83, 0x89, 0xe2, 0x3a, 0x5c, 0x0b, 0x2b, 0xfb, 0x81, 0x0c, 0xa4, 0xf9,
|
||||
0x6c, 0x26, 0x5f, 0x29, 0xeb, 0x8d, 0xc0, 0x61, 0x7c, 0xa8, 0x4f, 0xc5, 0x00, 0xa7, 0xa4, 0x09,
|
||||
0xc5, 0xb6, 0x42, 0xae, 0xd1, 0x40, 0xd7, 0xae, 0xd9, 0xf5, 0x5c, 0x6b, 0xef, 0xd7, 0x75, 0xd5,
|
||||
0xe9, 0xe1, 0x74, 0xac, 0x9e, 0x7b, 0x4f, 0x3d, 0x96, 0x55, 0x24, 0x06, 0x5f, 0x0e, 0xc2, 0xe1,
|
||||
0x2c, 0x35, 0xfc, 0x77, 0xa7, 0x21, 0xa3, 0xf0, 0x0e, 0xa1, 0xdc, 0xe5, 0x2a, 0x40, 0x7d, 0xcc,
|
||||
0x35, 0xef, 0xa3, 0xd0, 0xa8, 0x08, 0x05, 0xf8, 0x83, 0xcc, 0xa5, 0x0e, 0xcb, 0x30, 0xde, 0x01,
|
||||
0x94, 0xde, 0xab, 0x50, 0x23, 0xc3, 0x4f, 0x13, 0x8c, 0x35, 0xd9, 0x87, 0x9d, 0xae, 0xfc, 0x88,
|
||||
0x62, 0x25, 0x4d, 0x81, 0xf7, 0x25, 0x07, 0xa5, 0x37, 0x13, 0x54, 0xb3, 0xb3, 0x71, 0xf2, 0xe8,
|
||||
0xf8, 0x6e, 0x19, 0x39, 0x80, 0x3d, 0x3f, 0x14, 0x46, 0x98, 0xc9, 0xcc, 0x6e, 0x93, 0xe4, 0x15,
|
||||
0x94, 0x7c, 0x3e, 0x35, 0x44, 0x37, 0x1c, 0xa1, 0xfb, 0x7f, 0xcd, 0xae, 0x17, 0x0f, 0x1f, 0x36,
|
||||
0xd2, 0x11, 0x37, 0xd6, 0x23, 0x6e, 0x1c, 0xaf, 0x46, 0xdc, 0x2a, 0xcc, 0xaf, 0xab, 0xd6, 0xe5,
|
||||
0xf7, 0xaa, 0xcd, 0x6e, 0x19, 0x93, 0xb7, 0x1d, 0x45, 0x91, 0xbc, 0x78, 0xab, 0x79, 0x84, 0x6e,
|
||||
0xae, 0x66, 0xd7, 0x0b, 0x2c, 0xc3, 0x90, 0x27, 0x70, 0x3f, 0x79, 0x56, 0xa8, 0xb0, 0x2d, 0x45,
|
||||
0x1c, 0xc6, 0x1a, 0x85, 0x76, 0x77, 0x8c, 0x6c, 0xf3, 0x07, 0xa9, 0x40, 0xe1, 0x5d, 0x8c, 0x6d,
|
||||
0xde, 0xff, 0x80, 0x6e, 0xde, 0x88, 0x6e, 0x30, 0x39, 0x83, 0xb2, 0xcf, 0xa7, 0xe6, 0xd4, 0x75,
|
||||
0x2a, 0x77, 0x77, 0xfb, 0xd8, 0x1b, 0x66, 0xf2, 0x02, 0xf2, 0x3e, 0x9f, 0x1e, 0x05, 0xe8, 0x16,
|
||||
0xb6, 0x3f, 0x66, 0x65, 0x21, 0x8f, 0xe0, 0x9e, 0x3f, 0x89, 0x35, 0xc3, 0x73, 0x1e, 0x85, 0x03,
|
||||
0xae, 0xd1, 0x75, 0x4c, 0xde, 0xbf, 0xd8, 0x64, 0xd0, 0xe6, 0xd6, 0xd3, 0xe1, 0x89, 0x52, 0x52,
|
||||
0xb9, 0xf0, 0x0f, 0x83, 0xce, 0x1a, 0xc9, 0x03, 0xc8, 0xbf, 0x0c, 0xa3, 0xa4, 0x40, 0x45, 0xb3,
|
||||
0xee, 0x15, 0xf2, 0xbe, 0xda, 0xe0, 0x98, 0x75, 0xf8, 0xa8, 0x79, 0xd2, 0x89, 0x4c, 0xb5, 0x59,
|
||||
0x0a, 0xc8, 0x09, 0x14, 0x3b, 0x3c, 0xd6, 0x6d, 0x29, 0x34, 0xef, 0x6b, 0xd3, 0x88, 0x2d, 0x33,
|
||||
0x64, 0x7d, 0xa4, 0x06, 0xc5, 0xd7, 0x42, 0x5e, 0x88, 0x0e, 0xf2, 0x01, 0x2a, 0xd3, 0x99, 0x02,
|
||||
0xcb, 0x52, 0xe4, 0x31, 0x94, 0x6f, 0xb6, 0xd9, 0x9f, 0x75, 0xf0, 0x1c, 0x23, 0xd3, 0x09, 0x87,
|
||||
0x6d, 0xf0, 0xad, 0xda, 0xfc, 0x27, 0xb5, 0xe6, 0x0b, 0x6a, 0x5f, 0x2d, 0xa8, 0xfd, 0x63, 0x41,
|
||||
0xed, 0xcf, 0x4b, 0x6a, 0x5d, 0x2e, 0xa9, 0x75, 0xb5, 0xa4, 0xd6, 0xb7, 0x25, 0xb5, 0x7a, 0x79,
|
||||
0x93, 0xec, 0xd9, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x68, 0x40, 0xc8, 0x10, 0x04, 0x00,
|
||||
0x00,
|
||||
// 538 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0xc1, 0x6e, 0xd3, 0x40,
|
||||
0x14, 0xb4, 0x21, 0x4d, 0xe3, 0x97, 0x14, 0x85, 0x55, 0x85, 0x4c, 0x0e, 0x4e, 0x64, 0x21, 0x14,
|
||||
0x55, 0x90, 0x48, 0xe5, 0x56, 0x4e, 0x4d, 0x5a, 0x50, 0x45, 0xac, 0x8a, 0x25, 0x88, 0xf3, 0x26,
|
||||
0x79, 0x31, 0x16, 0xce, 0x6e, 0x58, 0x6f, 0xda, 0xe4, 0x0f, 0x38, 0x72, 0xac, 0x38, 0xf1, 0x21,
|
||||
0x7c, 0x40, 0x8e, 0x3d, 0x72, 0x2a, 0x90, 0xfc, 0x01, 0x5f, 0x80, 0xbc, 0x76, 0x8a, 0x4b, 0x7a,
|
||||
0x08, 0x37, 0xcf, 0x78, 0x66, 0x77, 0xf6, 0xbd, 0x81, 0x52, 0x5f, 0x8c, 0x46, 0x82, 0x37, 0xc6,
|
||||
0x52, 0x28, 0x41, 0xb6, 0x99, 0x8f, 0x5c, 0x8d, 0x7b, 0x15, 0xc7, 0x17, 0xc2, 0x0f, 0xb1, 0xa9,
|
||||
0xe9, 0xde, 0x64, 0xd8, 0x1c, 0x4c, 0x24, 0x53, 0xc1, 0x4a, 0x58, 0xd9, 0xf5, 0x85, 0x2f, 0xf4,
|
||||
0x67, 0x33, 0xfe, 0x4a, 0x58, 0x77, 0x04, 0x16, 0x65, 0x43, 0x75, 0xc2, 0x07, 0x38, 0x25, 0x4d,
|
||||
0x28, 0xb6, 0x25, 0x32, 0x85, 0x1a, 0xda, 0x66, 0xcd, 0xac, 0xe7, 0x5a, 0x3b, 0xbf, 0xaf, 0xaa,
|
||||
0x56, 0x0f, 0xa7, 0x63, 0x79, 0xe0, 0x3e, 0x75, 0x69, 0x56, 0x11, 0x1b, 0x3c, 0x31, 0x08, 0x86,
|
||||
0xb3, 0xc4, 0x70, 0xe7, 0x56, 0x43, 0x46, 0xe1, 0xee, 0x43, 0xb9, 0xcb, 0xa4, 0x8f, 0xea, 0x88,
|
||||
0x29, 0xd6, 0x47, 0xae, 0x50, 0x12, 0x07, 0xe0, 0x2f, 0xd2, 0x97, 0x5a, 0x34, 0xc3, 0xb8, 0x7b,
|
||||
0x50, 0x7a, 0x27, 0x03, 0x85, 0x14, 0x3f, 0x4e, 0x30, 0x52, 0x64, 0x17, 0xb6, 0xba, 0xe2, 0x03,
|
||||
0xf2, 0x54, 0x9a, 0x80, 0x83, 0xdc, 0xa7, 0xaf, 0x55, 0xd3, 0xfd, 0x92, 0x83, 0xd2, 0xeb, 0x09,
|
||||
0xca, 0xd9, 0xe9, 0x38, 0x7e, 0x7a, 0x74, 0xbb, 0x98, 0x3c, 0x82, 0x1d, 0x2f, 0xe0, 0x5a, 0x98,
|
||||
0x49, 0x4e, 0x6f, 0x92, 0xe4, 0x25, 0x94, 0x3c, 0x36, 0xd5, 0x44, 0x37, 0x18, 0xa1, 0x7d, 0xb7,
|
||||
0x66, 0xd6, 0x8b, 0xfb, 0x0f, 0x1b, 0xc9, 0xa0, 0x1b, 0xab, 0x41, 0x37, 0x8e, 0xd2, 0x41, 0xb7,
|
||||
0x0a, 0xf3, 0xab, 0xaa, 0x71, 0xf1, 0xa3, 0x6a, 0xd2, 0x1b, 0xc6, 0xf8, 0x85, 0x87, 0x61, 0x28,
|
||||
0xce, 0xdf, 0x28, 0x16, 0xa2, 0x9d, 0xab, 0x99, 0xf5, 0x02, 0xcd, 0x30, 0xe4, 0x09, 0xdc, 0x8f,
|
||||
0x1f, 0x17, 0x48, 0x6c, 0x0b, 0x1e, 0x05, 0x91, 0x42, 0xae, 0xec, 0x2d, 0x2d, 0x5b, 0xff, 0x41,
|
||||
0x2a, 0x50, 0x78, 0x1b, 0x61, 0x9b, 0xf5, 0xdf, 0xa3, 0x9d, 0xd7, 0xa2, 0x6b, 0x4c, 0x4e, 0xa1,
|
||||
0xec, 0xb1, 0xa9, 0x3e, 0x75, 0x95, 0xca, 0xde, 0xde, 0x3c, 0xf6, 0x9a, 0x99, 0x3c, 0x87, 0xbc,
|
||||
0xc7, 0xa6, 0x87, 0x3e, 0xda, 0x85, 0xcd, 0x8f, 0x49, 0x2d, 0xe4, 0x31, 0xdc, 0xf3, 0x26, 0x91,
|
||||
0xa2, 0x78, 0xc6, 0xc2, 0x60, 0xc0, 0x14, 0xda, 0x96, 0xce, 0xfb, 0x0f, 0x1b, 0x0f, 0x5a, 0xdf,
|
||||
0x7a, 0x32, 0x3c, 0x96, 0x52, 0x48, 0x1b, 0xfe, 0x63, 0xd0, 0x59, 0x23, 0x79, 0x00, 0xf9, 0x17,
|
||||
0x41, 0x18, 0xd7, 0xa8, 0xa8, 0xd7, 0x9d, 0xa2, 0xb4, 0x1c, 0xdf, 0x4c, 0xb0, 0xf4, 0x52, 0x3c,
|
||||
0x54, 0x2c, 0x6e, 0x46, 0xa6, 0xe6, 0x34, 0x01, 0xe4, 0x18, 0x8a, 0x1d, 0x16, 0xa9, 0xb6, 0xe0,
|
||||
0x8a, 0xf5, 0x95, 0xee, 0xc5, 0x86, 0x49, 0xb2, 0x3e, 0x52, 0x83, 0xe2, 0x2b, 0x2e, 0xce, 0x79,
|
||||
0x07, 0xd9, 0x00, 0xa5, 0x6e, 0x4e, 0x81, 0x66, 0x29, 0xb2, 0x07, 0xe5, 0xeb, 0x9d, 0xf6, 0x67,
|
||||
0x1d, 0x3c, 0xc3, 0x50, 0x37, 0xc3, 0xa2, 0x6b, 0x7c, 0x12, 0xbf, 0x55, 0x9b, 0xff, 0x72, 0x8c,
|
||||
0xf9, 0xc2, 0x31, 0x2f, 0x17, 0x8e, 0xf9, 0x73, 0xe1, 0x98, 0x9f, 0x97, 0x8e, 0x71, 0xb1, 0x74,
|
||||
0x8c, 0xcb, 0xa5, 0x63, 0x7c, 0x5f, 0x3a, 0x46, 0x2f, 0xaf, 0xf3, 0x3d, 0xfb, 0x13, 0x00, 0x00,
|
||||
0xff, 0xff, 0x1c, 0x85, 0xfc, 0x3b, 0x22, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *RaftIndex) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -339,27 +452,32 @@ func (m *RaftIndex) Marshal() (dAtA []byte, err error) {
|
|||
}
|
||||
|
||||
func (m *RaftIndex) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *RaftIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.CreateIndex != 0 {
|
||||
dAtA[i] = 0x8
|
||||
i++
|
||||
i = encodeVarintCommon(dAtA, i, uint64(m.CreateIndex))
|
||||
}
|
||||
if m.ModifyIndex != 0 {
|
||||
dAtA[i] = 0x10
|
||||
i++
|
||||
i = encodeVarintCommon(dAtA, i, uint64(m.ModifyIndex))
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
}
|
||||
return i, nil
|
||||
if m.CreateIndex != 0 {
|
||||
i = encodeVarintCommon(dAtA, i, uint64(m.CreateIndex))
|
||||
i--
|
||||
dAtA[i] = 0x8
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *TargetDatacenter) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -367,23 +485,29 @@ func (m *TargetDatacenter) Marshal() (dAtA []byte, err error) {
|
|||
}
|
||||
|
||||
func (m *TargetDatacenter) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *TargetDatacenter) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Datacenter) > 0 {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i -= len(m.Datacenter)
|
||||
copy(dAtA[i:], m.Datacenter)
|
||||
i = encodeVarintCommon(dAtA, i, uint64(len(m.Datacenter)))
|
||||
i += copy(dAtA[i:], m.Datacenter)
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return i, nil
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *WriteRequest) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -391,23 +515,29 @@ func (m *WriteRequest) Marshal() (dAtA []byte, err error) {
|
|||
}
|
||||
|
||||
func (m *WriteRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *WriteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Token) > 0 {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i -= len(m.Token)
|
||||
copy(dAtA[i:], m.Token)
|
||||
i = encodeVarintCommon(dAtA, i, uint64(len(m.Token)))
|
||||
i += copy(dAtA[i:], m.Token)
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return i, nil
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *QueryOptions) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -415,106 +545,113 @@ func (m *QueryOptions) Marshal() (dAtA []byte, err error) {
|
|||
}
|
||||
|
||||
func (m *QueryOptions) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Token) > 0 {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintCommon(dAtA, i, uint64(len(m.Token)))
|
||||
i += copy(dAtA[i:], m.Token)
|
||||
if len(m.Filter) > 0 {
|
||||
i -= len(m.Filter)
|
||||
copy(dAtA[i:], m.Filter)
|
||||
i = encodeVarintCommon(dAtA, i, uint64(len(m.Filter)))
|
||||
i--
|
||||
dAtA[i] = 0x5a
|
||||
}
|
||||
if m.MinQueryIndex != 0 {
|
||||
dAtA[i] = 0x10
|
||||
i++
|
||||
i = encodeVarintCommon(dAtA, i, uint64(m.MinQueryIndex))
|
||||
n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.StaleIfError, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.StaleIfError):])
|
||||
if err1 != nil {
|
||||
return 0, err1
|
||||
}
|
||||
dAtA[i] = 0x1a
|
||||
i++
|
||||
i = encodeVarintCommon(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxQueryTime)))
|
||||
n1, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxQueryTime, dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n1
|
||||
if m.AllowStale {
|
||||
dAtA[i] = 0x20
|
||||
i++
|
||||
if m.AllowStale {
|
||||
dAtA[i] = 1
|
||||
} else {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i++
|
||||
}
|
||||
if m.RequireConsistent {
|
||||
dAtA[i] = 0x28
|
||||
i++
|
||||
if m.RequireConsistent {
|
||||
dAtA[i] = 1
|
||||
} else {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i++
|
||||
}
|
||||
if m.UseCache {
|
||||
dAtA[i] = 0x30
|
||||
i++
|
||||
if m.UseCache {
|
||||
dAtA[i] = 1
|
||||
} else {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i++
|
||||
}
|
||||
dAtA[i] = 0x3a
|
||||
i++
|
||||
i = encodeVarintCommon(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxStaleDuration)))
|
||||
n2, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxStaleDuration, dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n2
|
||||
dAtA[i] = 0x42
|
||||
i++
|
||||
i = encodeVarintCommon(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAge)))
|
||||
n3, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxAge, dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n3
|
||||
i -= n1
|
||||
i = encodeVarintCommon(dAtA, i, uint64(n1))
|
||||
i--
|
||||
dAtA[i] = 0x52
|
||||
if m.MustRevalidate {
|
||||
dAtA[i] = 0x48
|
||||
i++
|
||||
i--
|
||||
if m.MustRevalidate {
|
||||
dAtA[i] = 1
|
||||
} else {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i++
|
||||
i--
|
||||
dAtA[i] = 0x48
|
||||
}
|
||||
dAtA[i] = 0x52
|
||||
i++
|
||||
i = encodeVarintCommon(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.StaleIfError)))
|
||||
n4, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.StaleIfError, dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxAge, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAge):])
|
||||
if err2 != nil {
|
||||
return 0, err2
|
||||
}
|
||||
i += n4
|
||||
if len(m.Filter) > 0 {
|
||||
dAtA[i] = 0x5a
|
||||
i++
|
||||
i = encodeVarintCommon(dAtA, i, uint64(len(m.Filter)))
|
||||
i += copy(dAtA[i:], m.Filter)
|
||||
i -= n2
|
||||
i = encodeVarintCommon(dAtA, i, uint64(n2))
|
||||
i--
|
||||
dAtA[i] = 0x42
|
||||
n3, err3 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxStaleDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxStaleDuration):])
|
||||
if err3 != nil {
|
||||
return 0, err3
|
||||
}
|
||||
return i, nil
|
||||
i -= n3
|
||||
i = encodeVarintCommon(dAtA, i, uint64(n3))
|
||||
i--
|
||||
dAtA[i] = 0x3a
|
||||
if m.UseCache {
|
||||
i--
|
||||
if m.UseCache {
|
||||
dAtA[i] = 1
|
||||
} else {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x30
|
||||
}
|
||||
if m.RequireConsistent {
|
||||
i--
|
||||
if m.RequireConsistent {
|
||||
dAtA[i] = 1
|
||||
} else {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x28
|
||||
}
|
||||
if m.AllowStale {
|
||||
i--
|
||||
if m.AllowStale {
|
||||
dAtA[i] = 1
|
||||
} else {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x20
|
||||
}
|
||||
n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxQueryTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxQueryTime):])
|
||||
if err4 != nil {
|
||||
return 0, err4
|
||||
}
|
||||
i -= n4
|
||||
i = encodeVarintCommon(dAtA, i, uint64(n4))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
if m.MinQueryIndex != 0 {
|
||||
i = encodeVarintCommon(dAtA, i, uint64(m.MinQueryIndex))
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
}
|
||||
if len(m.Token) > 0 {
|
||||
i -= len(m.Token)
|
||||
copy(dAtA[i:], m.Token)
|
||||
i = encodeVarintCommon(dAtA, i, uint64(len(m.Token)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *QueryMeta) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -522,50 +659,58 @@ func (m *QueryMeta) Marshal() (dAtA []byte, err error) {
|
|||
}
|
||||
|
||||
func (m *QueryMeta) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Index != 0 {
|
||||
dAtA[i] = 0x8
|
||||
i++
|
||||
i = encodeVarintCommon(dAtA, i, uint64(m.Index))
|
||||
if len(m.ConsistencyLevel) > 0 {
|
||||
i -= len(m.ConsistencyLevel)
|
||||
copy(dAtA[i:], m.ConsistencyLevel)
|
||||
i = encodeVarintCommon(dAtA, i, uint64(len(m.ConsistencyLevel)))
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
}
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintCommon(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.LastContact)))
|
||||
n5, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.LastContact, dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n5
|
||||
if m.KnownLeader {
|
||||
dAtA[i] = 0x18
|
||||
i++
|
||||
i--
|
||||
if m.KnownLeader {
|
||||
dAtA[i] = 1
|
||||
} else {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i++
|
||||
i--
|
||||
dAtA[i] = 0x18
|
||||
}
|
||||
if len(m.ConsistencyLevel) > 0 {
|
||||
dAtA[i] = 0x22
|
||||
i++
|
||||
i = encodeVarintCommon(dAtA, i, uint64(len(m.ConsistencyLevel)))
|
||||
i += copy(dAtA[i:], m.ConsistencyLevel)
|
||||
n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.LastContact, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.LastContact):])
|
||||
if err5 != nil {
|
||||
return 0, err5
|
||||
}
|
||||
return i, nil
|
||||
i -= n5
|
||||
i = encodeVarintCommon(dAtA, i, uint64(n5))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
if m.Index != 0 {
|
||||
i = encodeVarintCommon(dAtA, i, uint64(m.Index))
|
||||
i--
|
||||
dAtA[i] = 0x8
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintCommon(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovCommon(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return offset + 1
|
||||
return base
|
||||
}
|
||||
func (m *RaftIndex) Size() (n int) {
|
||||
if m == nil {
|
||||
|
@ -670,14 +815,7 @@ func (m *QueryMeta) Size() (n int) {
|
|||
}
|
||||
|
||||
func sovCommon(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozCommon(x uint64) (n int) {
|
||||
return sovCommon(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
|
|
|
@ -29,6 +29,8 @@ message TargetDatacenter {
|
|||
}
|
||||
|
||||
message WriteRequest {
|
||||
option (gogoproto.goproto_getters) = true;
|
||||
|
||||
// Token is the ACL token ID. If not provided, the 'anonymous'
|
||||
// token is assumed for backwards compatibility.
|
||||
string Token = 1;
|
||||
|
@ -36,6 +38,10 @@ message WriteRequest {
|
|||
|
||||
// QueryOptions is used to specify various flags for read queries
|
||||
message QueryOptions {
|
||||
// The autogenerated getters will implement half of the
|
||||
// structs.QueryOptionsCompat interface
|
||||
option (gogoproto.goproto_getters) = true;
|
||||
|
||||
// Token is the ACL token ID. If not provided, the 'anonymous'
|
||||
// token is assumed for backwards compatibility.
|
||||
string Token = 1;
|
||||
|
@ -104,6 +110,10 @@ message QueryOptions {
|
|||
// QueryMeta allows a query response to include potentially
|
||||
// useful metadata about a query
|
||||
message QueryMeta {
|
||||
// The auto-generated getters will implement half of the
|
||||
// structs.QueryMetaCompat interface
|
||||
option (gogoproto.goproto_getters) = true;
|
||||
|
||||
// This is the index associated with the read
|
||||
uint64 Index = 1;
|
||||
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package agentpb
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/gogo/protobuf/jsonpb"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/hashicorp/consul/agent/structs"
|
||||
)
|
||||
|
||||
|
@ -33,3 +37,27 @@ func Decode(buf []byte, out ProtoMarshaller) error {
|
|||
// Note that this assumes the leading byte indicating the type has already been stripped off
|
||||
return out.Unmarshal(buf)
|
||||
}
|
||||
|
||||
func MarshalJSON(msg proto.Message) ([]byte, error) {
|
||||
m := jsonpb.Marshaler{
|
||||
EmitDefaults: false,
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
if err := m.Marshal(&buf, msg); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
func UnmarshalJSON(r io.Reader, msg proto.Message) error {
|
||||
u := jsonpb.Unmarshaler{
|
||||
AllowUnknownFields: true,
|
||||
}
|
||||
|
||||
return u.Unmarshal(r, msg)
|
||||
}
|
||||
|
||||
func UnmarshalJSONBytes(b []byte, msg proto.Message) error {
|
||||
return UnmarshalJSON(bytes.NewReader(b), msg)
|
||||
}
|
||||
|
|
|
@ -454,25 +454,8 @@ func (s *Server) raftApplyWithEncoder(t structs.MessageType, msg interface{}, en
|
|||
// a snapshot.
|
||||
type queryFn func(memdb.WatchSet, *state.Store) error
|
||||
|
||||
// we specify this as an interface so that we can allow a our legacy structs.QueryOptions
|
||||
// and the protobuf defined QueryOptions struct to both be used here.
|
||||
type queryOptions interface {
|
||||
GetMinQueryIndex() uint64
|
||||
GetMaxQueryTime() time.Duration
|
||||
GetRequireConsistent() bool
|
||||
}
|
||||
|
||||
// we specify this as an interface so that we can allow a our legacy structs.QueryMeta
|
||||
// and the protobuf defined QueryMeta struct to both be used here.
|
||||
type queryMeta interface {
|
||||
SetLastContact(time.Duration)
|
||||
SetKnownLeader(bool)
|
||||
GetIndex() uint64
|
||||
SetIndex(uint64)
|
||||
}
|
||||
|
||||
// blockingQuery is used to process a potentially blocking query operation.
|
||||
func (s *Server) blockingQuery(queryOpts queryOptions, queryMeta queryMeta, fn queryFn) error {
|
||||
func (s *Server) blockingQuery(queryOpts structs.QueryOptionsCompat, queryMeta structs.QueryMetaCompat, fn queryFn) error {
|
||||
var timeout *time.Timer
|
||||
var queryTimeout time.Duration
|
||||
|
||||
|
@ -557,7 +540,7 @@ RUN_QUERY:
|
|||
}
|
||||
|
||||
// setQueryMeta is used to populate the QueryMeta data for an RPC call
|
||||
func (s *Server) setQueryMeta(m queryMeta) {
|
||||
func (s *Server) setQueryMeta(m structs.QueryMetaCompat) {
|
||||
if s.IsLeader() {
|
||||
m.SetLastContact(0)
|
||||
m.SetKnownLeader(true)
|
||||
|
|
|
@ -682,11 +682,11 @@ func setLastContact(resp http.ResponseWriter, last time.Duration) {
|
|||
}
|
||||
|
||||
// setMeta is used to set the query response meta data
|
||||
func setMeta(resp http.ResponseWriter, m *structs.QueryMeta) {
|
||||
setIndex(resp, m.Index)
|
||||
setLastContact(resp, m.LastContact)
|
||||
setKnownLeader(resp, m.KnownLeader)
|
||||
setConsistency(resp, m.ConsistencyLevel)
|
||||
func setMeta(resp http.ResponseWriter, m structs.QueryMetaCompat) {
|
||||
setIndex(resp, m.GetIndex())
|
||||
setLastContact(resp, m.GetLastContact())
|
||||
setKnownLeader(resp, m.GetKnownLeader())
|
||||
setConsistency(resp, m.GetConsistencyLevel())
|
||||
}
|
||||
|
||||
// setCacheMeta sets http response headers to indicate cache status.
|
||||
|
@ -713,7 +713,7 @@ func setHeaders(resp http.ResponseWriter, headers map[string]string) {
|
|||
|
||||
// parseWait is used to parse the ?wait and ?index query params
|
||||
// Returns true on error
|
||||
func parseWait(resp http.ResponseWriter, req *http.Request, b *structs.QueryOptions) bool {
|
||||
func parseWait(resp http.ResponseWriter, req *http.Request, b structs.QueryOptionsCompat) bool {
|
||||
query := req.URL.Query()
|
||||
if wait := query.Get("wait"); wait != "" {
|
||||
dur, err := time.ParseDuration(wait)
|
||||
|
@ -722,7 +722,7 @@ func parseWait(resp http.ResponseWriter, req *http.Request, b *structs.QueryOpti
|
|||
fmt.Fprint(resp, "Invalid wait time")
|
||||
return true
|
||||
}
|
||||
b.MaxQueryTime = dur
|
||||
b.SetMaxQueryTime(dur)
|
||||
}
|
||||
if idx := query.Get("index"); idx != "" {
|
||||
index, err := strconv.ParseUint(idx, 10, 64)
|
||||
|
@ -731,14 +731,14 @@ func parseWait(resp http.ResponseWriter, req *http.Request, b *structs.QueryOpti
|
|||
fmt.Fprint(resp, "Invalid index")
|
||||
return true
|
||||
}
|
||||
b.MinQueryIndex = index
|
||||
b.SetMinQueryIndex(index)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// parseCacheControl parses the CacheControl HTTP header value. So far we only
|
||||
// support maxage directive.
|
||||
func parseCacheControl(resp http.ResponseWriter, req *http.Request, b *structs.QueryOptions) bool {
|
||||
func parseCacheControl(resp http.ResponseWriter, req *http.Request, b structs.QueryOptionsCompat) bool {
|
||||
raw := strings.ToLower(req.Header.Get("Cache-Control"))
|
||||
|
||||
if raw == "" {
|
||||
|
@ -766,7 +766,7 @@ func parseCacheControl(resp http.ResponseWriter, req *http.Request, b *structs.Q
|
|||
d = strings.ToLower(strings.TrimSpace(d))
|
||||
|
||||
if d == "must-revalidate" {
|
||||
b.MustRevalidate = true
|
||||
b.SetMustRevalidate(true)
|
||||
}
|
||||
|
||||
if strings.HasPrefix(d, "max-age=") {
|
||||
|
@ -774,12 +774,12 @@ func parseCacheControl(resp http.ResponseWriter, req *http.Request, b *structs.Q
|
|||
if failed {
|
||||
return true
|
||||
}
|
||||
b.MaxAge = d
|
||||
b.SetMaxAge(d)
|
||||
if d == 0 {
|
||||
// max-age=0 specifically means that we need to consider the cache stale
|
||||
// immediately however MaxAge = 0 is indistinguishable from the default
|
||||
// where MaxAge is unset.
|
||||
b.MustRevalidate = true
|
||||
b.SetMustRevalidate(true)
|
||||
}
|
||||
}
|
||||
if strings.HasPrefix(d, "stale-if-error=") {
|
||||
|
@ -787,7 +787,7 @@ func parseCacheControl(resp http.ResponseWriter, req *http.Request, b *structs.Q
|
|||
if failed {
|
||||
return true
|
||||
}
|
||||
b.StaleIfError = d
|
||||
b.SetStaleIfError(d)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -796,22 +796,22 @@ func parseCacheControl(resp http.ResponseWriter, req *http.Request, b *structs.Q
|
|||
|
||||
// parseConsistency is used to parse the ?stale and ?consistent query params.
|
||||
// Returns true on error
|
||||
func (s *HTTPServer) parseConsistency(resp http.ResponseWriter, req *http.Request, b *structs.QueryOptions) bool {
|
||||
func (s *HTTPServer) parseConsistency(resp http.ResponseWriter, req *http.Request, b structs.QueryOptionsCompat) bool {
|
||||
query := req.URL.Query()
|
||||
defaults := true
|
||||
if _, ok := query["stale"]; ok {
|
||||
b.AllowStale = true
|
||||
b.SetAllowStale(true)
|
||||
defaults = false
|
||||
}
|
||||
if _, ok := query["consistent"]; ok {
|
||||
b.RequireConsistent = true
|
||||
b.SetRequireConsistent(true)
|
||||
defaults = false
|
||||
}
|
||||
if _, ok := query["leader"]; ok {
|
||||
defaults = false
|
||||
}
|
||||
if _, ok := query["cached"]; ok {
|
||||
b.UseCache = true
|
||||
b.SetUseCache(true)
|
||||
defaults = false
|
||||
}
|
||||
if maxStale := query.Get("max_stale"); maxStale != "" {
|
||||
|
@ -821,9 +821,9 @@ func (s *HTTPServer) parseConsistency(resp http.ResponseWriter, req *http.Reques
|
|||
fmt.Fprintf(resp, "Invalid max_stale value %q", maxStale)
|
||||
return true
|
||||
}
|
||||
b.MaxStaleDuration = dur
|
||||
b.SetMaxStaleDuration(dur)
|
||||
if dur.Nanoseconds() > 0 {
|
||||
b.AllowStale = true
|
||||
b.SetAllowStale(true)
|
||||
defaults = false
|
||||
}
|
||||
}
|
||||
|
@ -832,17 +832,17 @@ func (s *HTTPServer) parseConsistency(resp http.ResponseWriter, req *http.Reques
|
|||
path := req.URL.Path
|
||||
if strings.HasPrefix(path, "/v1/catalog") || strings.HasPrefix(path, "/v1/health") {
|
||||
if s.agent.config.DiscoveryMaxStale.Nanoseconds() > 0 {
|
||||
b.MaxStaleDuration = s.agent.config.DiscoveryMaxStale
|
||||
b.AllowStale = true
|
||||
b.SetMaxStaleDuration(s.agent.config.DiscoveryMaxStale)
|
||||
b.SetAllowStale(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
if b.AllowStale && b.RequireConsistent {
|
||||
if b.GetAllowStale() && b.GetRequireConsistent() {
|
||||
resp.WriteHeader(http.StatusBadRequest)
|
||||
fmt.Fprint(resp, "Cannot specify ?stale with ?consistent, conflicting semantics.")
|
||||
return true
|
||||
}
|
||||
if b.UseCache && b.RequireConsistent {
|
||||
if b.GetUseCache() && b.GetRequireConsistent() {
|
||||
resp.WriteHeader(http.StatusBadRequest)
|
||||
fmt.Fprint(resp, "Cannot specify ?cached with ?consistent, conflicting semantics.")
|
||||
return true
|
||||
|
@ -959,10 +959,14 @@ func (s *HTTPServer) parseMetaFilter(req *http.Request) map[string]string {
|
|||
|
||||
// parseInternal is a convenience method for endpoints that need
|
||||
// to use both parseWait and parseDC.
|
||||
func (s *HTTPServer) parseInternal(resp http.ResponseWriter, req *http.Request, dc *string, b *structs.QueryOptions) bool {
|
||||
func (s *HTTPServer) parseInternal(resp http.ResponseWriter, req *http.Request, dc *string, b structs.QueryOptionsCompat) bool {
|
||||
s.parseDC(req, dc)
|
||||
s.parseTokenInternal(req, &b.Token)
|
||||
s.parseFilter(req, &b.Filter)
|
||||
var token string
|
||||
s.parseTokenInternal(req, &token)
|
||||
b.SetToken(token)
|
||||
var filter string
|
||||
s.parseFilter(req, &filter)
|
||||
b.SetFilter(filter)
|
||||
if s.parseConsistency(resp, req, b) {
|
||||
return true
|
||||
}
|
||||
|
@ -974,7 +978,7 @@ func (s *HTTPServer) parseInternal(resp http.ResponseWriter, req *http.Request,
|
|||
|
||||
// parse is a convenience method for endpoints that need
|
||||
// to use both parseWait and parseDC.
|
||||
func (s *HTTPServer) parse(resp http.ResponseWriter, req *http.Request, dc *string, b *structs.QueryOptions) bool {
|
||||
func (s *HTTPServer) parse(resp http.ResponseWriter, req *http.Request, dc *string, b structs.QueryOptionsCompat) bool {
|
||||
return s.parseInternal(resp, req, dc, b)
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,271 @@
|
|||
package structs
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// QueryOptionsCompat is the interface that both the structs.QueryOptions
|
||||
// and the agentpb.QueryOptions structs need to implement so that they
|
||||
// can be operated on interchangeably
|
||||
type QueryOptionsCompat interface {
|
||||
GetToken() string
|
||||
SetToken(string)
|
||||
GetMinQueryIndex() uint64
|
||||
SetMinQueryIndex(uint64)
|
||||
GetMaxQueryTime() time.Duration
|
||||
SetMaxQueryTime(time.Duration)
|
||||
GetAllowStale() bool
|
||||
SetAllowStale(bool)
|
||||
GetRequireConsistent() bool
|
||||
SetRequireConsistent(bool)
|
||||
GetUseCache() bool
|
||||
SetUseCache(bool)
|
||||
GetMaxStaleDuration() time.Duration
|
||||
SetMaxStaleDuration(time.Duration)
|
||||
GetMaxAge() time.Duration
|
||||
SetMaxAge(time.Duration)
|
||||
GetMustRevalidate() bool
|
||||
SetMustRevalidate(bool)
|
||||
GetStaleIfError() time.Duration
|
||||
SetStaleIfError(time.Duration)
|
||||
GetFilter() string
|
||||
SetFilter(string)
|
||||
}
|
||||
|
||||
// QueryMetaCompat is the interface that both the structs.QueryMeta
|
||||
// and the agentpb.QueryMeta structs need to implement so that they
|
||||
// can be operated on interchangeably
|
||||
type QueryMetaCompat interface {
|
||||
GetLastContact() time.Duration
|
||||
SetLastContact(time.Duration)
|
||||
GetKnownLeader() bool
|
||||
SetKnownLeader(bool)
|
||||
GetIndex() uint64
|
||||
SetIndex(uint64)
|
||||
GetConsistencyLevel() string
|
||||
SetConsistencyLevel(string)
|
||||
}
|
||||
|
||||
// GetToken helps implement the QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.pb.go
|
||||
func (m *QueryOptions) GetToken() string {
|
||||
if m != nil {
|
||||
return m.Token
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetMinQueryIndex helps implement the QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.pb.go
|
||||
func (m *QueryOptions) GetMinQueryIndex() uint64 {
|
||||
if m != nil {
|
||||
return m.MinQueryIndex
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// GetMaxQueryTime helps implement the QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.pb.go
|
||||
func (m *QueryOptions) GetMaxQueryTime() time.Duration {
|
||||
if m != nil {
|
||||
return m.MaxQueryTime
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// GetAllowStale helps implement the QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.pb.go
|
||||
func (m *QueryOptions) GetAllowStale() bool {
|
||||
if m != nil {
|
||||
return m.AllowStale
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetRequireConsistent helps implement the QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.pb.go
|
||||
func (m *QueryOptions) GetRequireConsistent() bool {
|
||||
if m != nil {
|
||||
return m.RequireConsistent
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetUseCache helps implement the QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.pb.go
|
||||
func (m *QueryOptions) GetUseCache() bool {
|
||||
if m != nil {
|
||||
return m.UseCache
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetMaxStaleDuration helps implement the QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.pb.go
|
||||
func (m *QueryOptions) GetMaxStaleDuration() time.Duration {
|
||||
if m != nil {
|
||||
return m.MaxStaleDuration
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// GetMaxAge helps implement the QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.pb.go
|
||||
func (m *QueryOptions) GetMaxAge() time.Duration {
|
||||
if m != nil {
|
||||
return m.MaxAge
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// GetMustRevalidate helps implement the QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.pb.go
|
||||
func (m *QueryOptions) GetMustRevalidate() bool {
|
||||
if m != nil {
|
||||
return m.MustRevalidate
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetStaleIfError helps implement the QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.pb.go
|
||||
func (m *QueryOptions) GetStaleIfError() time.Duration {
|
||||
if m != nil {
|
||||
return m.StaleIfError
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// GetFilter helps implement the QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.pb.go
|
||||
func (m *QueryOptions) GetFilter() string {
|
||||
if m != nil {
|
||||
return m.Filter
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetToken is needed to implement the structs.QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.go
|
||||
func (q *QueryOptions) SetToken(token string) {
|
||||
q.Token = token
|
||||
}
|
||||
|
||||
// SetMinQueryIndex is needed to implement the structs.QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.go
|
||||
func (q *QueryOptions) SetMinQueryIndex(minQueryIndex uint64) {
|
||||
q.MinQueryIndex = minQueryIndex
|
||||
}
|
||||
|
||||
// SetMaxQueryTime is needed to implement the structs.QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.go
|
||||
func (q *QueryOptions) SetMaxQueryTime(maxQueryTime time.Duration) {
|
||||
q.MaxQueryTime = maxQueryTime
|
||||
}
|
||||
|
||||
// SetAllowStale is needed to implement the structs.QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.go
|
||||
func (q *QueryOptions) SetAllowStale(allowStale bool) {
|
||||
q.AllowStale = allowStale
|
||||
}
|
||||
|
||||
// SetRequireConsistent is needed to implement the structs.QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.go
|
||||
func (q *QueryOptions) SetRequireConsistent(requireConsistent bool) {
|
||||
q.RequireConsistent = requireConsistent
|
||||
}
|
||||
|
||||
// SetUseCache is needed to implement the structs.QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.go
|
||||
func (q *QueryOptions) SetUseCache(useCache bool) {
|
||||
q.UseCache = useCache
|
||||
}
|
||||
|
||||
// SetMaxStaleDuration is needed to implement the structs.QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.go
|
||||
func (q *QueryOptions) SetMaxStaleDuration(maxStaleDuration time.Duration) {
|
||||
q.MaxStaleDuration = maxStaleDuration
|
||||
}
|
||||
|
||||
// SetMaxAge is needed to implement the structs.QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.go
|
||||
func (q *QueryOptions) SetMaxAge(maxAge time.Duration) {
|
||||
q.MaxAge = maxAge
|
||||
}
|
||||
|
||||
// SetMustRevalidate is needed to implement the structs.QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.go
|
||||
func (q *QueryOptions) SetMustRevalidate(mustRevalidate bool) {
|
||||
q.MustRevalidate = mustRevalidate
|
||||
}
|
||||
|
||||
// SetStaleIfError is needed to implement the structs.QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.go
|
||||
func (q *QueryOptions) SetStaleIfError(staleIfError time.Duration) {
|
||||
q.StaleIfError = staleIfError
|
||||
}
|
||||
|
||||
// SetFilter is needed to implement the structs.QueryOptionsCompat interface
|
||||
// Copied from agent/agentpb/common.go
|
||||
func (q *QueryOptions) SetFilter(filter string) {
|
||||
q.Filter = filter
|
||||
}
|
||||
|
||||
//
|
||||
func (m *QueryMeta) GetIndex() uint64 {
|
||||
if m != nil {
|
||||
return m.Index
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// GetLastContact helps implement the QueryMetaCompat interface
|
||||
// Copied from agent/agentpb/common.pb.go
|
||||
func (m *QueryMeta) GetLastContact() time.Duration {
|
||||
if m != nil {
|
||||
return m.LastContact
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// GetKnownLeader helps implement the QueryMetaCompat interface
|
||||
// Copied from agent/agentpb/common.pb.go
|
||||
func (m *QueryMeta) GetKnownLeader() bool {
|
||||
if m != nil {
|
||||
return m.KnownLeader
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetConsistencyLevel helps implement the QueryMetaCompat interface
|
||||
// Copied from agent/agentpb/common.pb.go
|
||||
func (m *QueryMeta) GetConsistencyLevel() string {
|
||||
if m != nil {
|
||||
return m.ConsistencyLevel
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetLastContact is needed to implement the structs.QueryMetaCompat interface
|
||||
// Copied from agent/agentpb/common.go
|
||||
func (q *QueryMeta) SetLastContact(lastContact time.Duration) {
|
||||
q.LastContact = lastContact
|
||||
}
|
||||
|
||||
// SetKnownLeader is needed to implement the structs.QueryMetaCompat interface
|
||||
// Copied from agent/agentpb/common.go
|
||||
func (q *QueryMeta) SetKnownLeader(knownLeader bool) {
|
||||
q.KnownLeader = knownLeader
|
||||
}
|
||||
|
||||
// SetIndex is needed to implement the structs.QueryMetaCompat interface
|
||||
// Copied from agent/agentpb/common.go
|
||||
func (q *QueryMeta) SetIndex(index uint64) {
|
||||
q.Index = index
|
||||
}
|
||||
|
||||
// SetConsistencyLevel is needed to implement the structs.QueryMetaCompat interface
|
||||
// Copied from agent/agentpb/common.go
|
||||
func (q *QueryMeta) SetConsistencyLevel(consistencyLevel string) {
|
||||
q.ConsistencyLevel = consistencyLevel
|
||||
}
|
|
@ -203,18 +203,6 @@ func (q QueryOptions) TokenSecret() string {
|
|||
return q.Token
|
||||
}
|
||||
|
||||
func (q QueryOptions) GetMinQueryIndex() uint64 {
|
||||
return q.MinQueryIndex
|
||||
}
|
||||
|
||||
func (q QueryOptions) GetMaxQueryTime() time.Duration {
|
||||
return q.MaxQueryTime
|
||||
}
|
||||
|
||||
func (q QueryOptions) GetRequireConsistent() bool {
|
||||
return q.RequireConsistent
|
||||
}
|
||||
|
||||
type WriteRequest struct {
|
||||
// Token is the ACL token ID. If not provided, the 'anonymous'
|
||||
// token is assumed for backwards compatibility.
|
||||
|
@ -254,22 +242,6 @@ type QueryMeta struct {
|
|||
ConsistencyLevel string
|
||||
}
|
||||
|
||||
func (q *QueryMeta) SetLastContact(lastContact time.Duration) {
|
||||
q.LastContact = lastContact
|
||||
}
|
||||
|
||||
func (q *QueryMeta) SetKnownLeader(knownLeader bool) {
|
||||
q.KnownLeader = knownLeader
|
||||
}
|
||||
|
||||
func (q *QueryMeta) GetIndex() uint64 {
|
||||
return q.Index
|
||||
}
|
||||
|
||||
func (q *QueryMeta) SetIndex(index uint64) {
|
||||
q.Index = index
|
||||
}
|
||||
|
||||
// RegisterRequest is used for the Catalog.Register endpoint
|
||||
// to register a node as providing a service. If no service
|
||||
// is provided, the node is registered.
|
||||
|
|
|
@ -121,9 +121,9 @@ github.com/gogo/googleapis/google/rpc
|
|||
github.com/gogo/googleapis/google/api
|
||||
# github.com/gogo/protobuf v1.2.1
|
||||
github.com/gogo/protobuf/gogoproto
|
||||
github.com/gogo/protobuf/types
|
||||
github.com/gogo/protobuf/jsonpb
|
||||
github.com/gogo/protobuf/proto
|
||||
github.com/gogo/protobuf/types
|
||||
github.com/gogo/protobuf/protoc-gen-gogo/descriptor
|
||||
github.com/gogo/protobuf/sortkeys
|
||||
# github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
|
||||
|
|
Loading…
Reference in New Issue