573 lines
16 KiB
Plaintext
573 lines
16 KiB
Plaintext
//go:build example
|
|
// +build example
|
|
|
|
// Code generated by proto-gen-rpc-glue. DO NOT EDIT.
|
|
|
|
package e2e
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/hashicorp/consul/agent/structs"
|
|
)
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ structs.RPCInfo
|
|
var _ time.Month
|
|
|
|
// AllowStaleRead implements structs.RPCInfo
|
|
func (msg *ExampleWriteRequest) AllowStaleRead() bool {
|
|
return false
|
|
}
|
|
|
|
// HasTimedOut implements structs.RPCInfo
|
|
func (msg *ExampleWriteRequest) HasTimedOut(start time.Time, rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) (bool, error) {
|
|
if msg == nil || msg.WriteRequest == nil {
|
|
return false, nil
|
|
}
|
|
return msg.WriteRequest.HasTimedOut(start, rpcHoldTimeout, a, b)
|
|
}
|
|
|
|
// Timeout implements structs.RPCInfo
|
|
func (msg *ExampleWriteRequest) Timeout(rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) time.Duration {
|
|
if msg == nil || msg.WriteRequest == nil {
|
|
return 0
|
|
}
|
|
return msg.WriteRequest.Timeout(rpcHoldTimeout, a, b)
|
|
}
|
|
|
|
// IsRead implements structs.RPCInfo
|
|
func (msg *ExampleWriteRequest) IsRead() bool {
|
|
return false
|
|
}
|
|
|
|
// SetTokenSecret implements structs.RPCInfo
|
|
func (msg *ExampleWriteRequest) SetTokenSecret(s string) {
|
|
// TODO: initialize if nil
|
|
msg.WriteRequest.SetTokenSecret(s)
|
|
}
|
|
|
|
// TokenSecret implements structs.RPCInfo
|
|
func (msg *ExampleWriteRequest) TokenSecret() string {
|
|
if msg == nil || msg.WriteRequest == nil {
|
|
return ""
|
|
}
|
|
return msg.WriteRequest.TokenSecret()
|
|
}
|
|
|
|
// Token implements structs.RPCInfo
|
|
func (msg *ExampleWriteRequest) Token() string {
|
|
if msg.WriteRequest == nil {
|
|
return ""
|
|
}
|
|
return msg.WriteRequest.Token
|
|
}
|
|
|
|
// RequestDatacenter implements structs.RPCInfo
|
|
func (msg *ExampleWriteRequest) RequestDatacenter() string {
|
|
if msg == nil || msg.TargetDatacenter == nil {
|
|
return ""
|
|
}
|
|
return msg.TargetDatacenter.GetDatacenter()
|
|
}
|
|
|
|
// IsRead implements structs.RPCInfo
|
|
func (msg *ExampleReadRequest) IsRead() bool {
|
|
return true
|
|
}
|
|
|
|
// AllowStaleRead implements structs.RPCInfo
|
|
func (msg *ExampleReadRequest) AllowStaleRead() bool {
|
|
// TODO: initialize if nil
|
|
return msg.ReadRequest.AllowStaleRead()
|
|
}
|
|
|
|
// HasTimedOut implements structs.RPCInfo
|
|
func (msg *ExampleReadRequest) HasTimedOut(start time.Time, rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) (bool, error) {
|
|
if msg == nil || msg.ReadRequest == nil {
|
|
return false, nil
|
|
}
|
|
return msg.ReadRequest.HasTimedOut(start, rpcHoldTimeout, a, b)
|
|
}
|
|
|
|
// Timeout implements structs.RPCInfo
|
|
func (msg *ExampleReadRequest) Timeout(rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) time.Duration {
|
|
if msg == nil || msg.ReadRequest == nil {
|
|
return 0
|
|
}
|
|
return msg.ReadRequest.Timeout(rpcHoldTimeout, a, b)
|
|
}
|
|
|
|
// SetTokenSecret implements structs.RPCInfo
|
|
func (msg *ExampleReadRequest) SetTokenSecret(s string) {
|
|
// TODO: initialize if nil
|
|
msg.ReadRequest.SetTokenSecret(s)
|
|
}
|
|
|
|
// TokenSecret implements structs.RPCInfo
|
|
func (msg *ExampleReadRequest) TokenSecret() string {
|
|
if msg == nil || msg.ReadRequest == nil {
|
|
return ""
|
|
}
|
|
return msg.ReadRequest.TokenSecret()
|
|
}
|
|
|
|
// Token implements structs.RPCInfo
|
|
func (msg *ExampleReadRequest) Token() string {
|
|
if msg.ReadRequest == nil {
|
|
return ""
|
|
}
|
|
return msg.ReadRequest.Token
|
|
}
|
|
|
|
// RequestDatacenter implements structs.RPCInfo
|
|
func (msg *ExampleReadRequest) RequestDatacenter() string {
|
|
if msg == nil || msg.TargetDatacenter == nil {
|
|
return ""
|
|
}
|
|
return msg.TargetDatacenter.GetDatacenter()
|
|
}
|
|
|
|
// RequestDatacenter implements structs.RPCInfo
|
|
func (msg *ExampleQueryOptions) RequestDatacenter() string {
|
|
if msg == nil || msg.TargetDatacenter == nil {
|
|
return ""
|
|
}
|
|
return msg.TargetDatacenter.GetDatacenter()
|
|
}
|
|
|
|
// IsRead implements structs.RPCInfo
|
|
func (msg *ExampleQueryOptions) IsRead() bool {
|
|
return true
|
|
}
|
|
|
|
// AllowStaleRead implements structs.RPCInfo
|
|
func (msg *ExampleQueryOptions) AllowStaleRead() bool {
|
|
return msg.QueryOptions.AllowStaleRead()
|
|
}
|
|
|
|
// HasTimedOut implements structs.RPCInfo
|
|
func (msg *ExampleQueryOptions) HasTimedOut(start time.Time, rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) (bool, error) {
|
|
if msg == nil || msg.QueryOptions == nil {
|
|
return false, nil
|
|
}
|
|
return msg.QueryOptions.HasTimedOut(start, rpcHoldTimeout, a, b)
|
|
}
|
|
|
|
// Timeout implements structs.RPCInfo
|
|
func (msg *ExampleQueryOptions) Timeout(rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) time.Duration {
|
|
if msg == nil || msg.QueryOptions == nil {
|
|
return 0
|
|
}
|
|
return msg.QueryOptions.Timeout(rpcHoldTimeout, a, b)
|
|
}
|
|
|
|
// SetTokenSecret implements structs.RPCInfo
|
|
func (msg *ExampleQueryOptions) SetTokenSecret(s string) {
|
|
// TODO: initialize if nil
|
|
msg.QueryOptions.SetTokenSecret(s)
|
|
}
|
|
|
|
// TokenSecret implements structs.RPCInfo
|
|
func (msg *ExampleQueryOptions) TokenSecret() string {
|
|
if msg == nil || msg.QueryOptions == nil {
|
|
return ""
|
|
}
|
|
return msg.QueryOptions.TokenSecret()
|
|
}
|
|
|
|
// Token implements structs.RPCInfo
|
|
func (msg *ExampleQueryOptions) Token() string {
|
|
if msg.QueryOptions == nil {
|
|
return ""
|
|
}
|
|
return msg.QueryOptions.Token
|
|
}
|
|
|
|
// GetToken is required to implement blockingQueryOptions
|
|
func (msg *ExampleQueryOptions) GetToken() string {
|
|
if msg == nil || msg.QueryOptions == nil {
|
|
return ""
|
|
}
|
|
|
|
return msg.QueryOptions.GetToken()
|
|
}
|
|
|
|
// GetMinQueryIndex is required to implement blockingQueryOptions
|
|
func (msg *ExampleQueryOptions) GetMinQueryIndex() uint64 {
|
|
if msg == nil || msg.QueryOptions == nil {
|
|
return 0
|
|
}
|
|
|
|
return msg.QueryOptions.GetMinQueryIndex()
|
|
}
|
|
|
|
// GetMaxQueryTime is required to implement blockingQueryOptions
|
|
func (msg *ExampleQueryOptions) GetMaxQueryTime() (time.Duration, error) {
|
|
if msg == nil || msg.QueryOptions == nil {
|
|
return 0, nil
|
|
}
|
|
|
|
return structs.DurationFromProto(msg.QueryOptions.GetMaxQueryTime()), nil
|
|
}
|
|
|
|
// GetRequireConsistent is required to implement blockingQueryOptions
|
|
func (msg *ExampleQueryOptions) GetRequireConsistent() bool {
|
|
if msg == nil || msg.QueryOptions == nil {
|
|
return false
|
|
}
|
|
return msg.QueryOptions.RequireConsistent
|
|
}
|
|
|
|
// SetLastContact is required to implement blockingQueryResponseMeta
|
|
func (msg *ExampleQueryMeta) SetLastContact(d time.Duration) {
|
|
if msg == nil || msg.QueryMeta == nil {
|
|
return
|
|
}
|
|
msg.QueryMeta.SetLastContact(d)
|
|
}
|
|
|
|
// SetKnownLeader is required to implement blockingQueryResponseMeta
|
|
func (msg *ExampleQueryMeta) SetKnownLeader(b bool) {
|
|
if msg == nil || msg.QueryMeta == nil {
|
|
return
|
|
}
|
|
msg.QueryMeta.SetKnownLeader(b)
|
|
}
|
|
|
|
// GetIndex is required to implement blockingQueryResponseMeta
|
|
func (msg *ExampleQueryMeta) GetIndex() uint64 {
|
|
if msg == nil || msg.QueryMeta == nil {
|
|
return 0
|
|
}
|
|
return msg.QueryMeta.GetIndex()
|
|
}
|
|
|
|
// SetIndex is required to implement blockingQueryResponseMeta
|
|
func (msg *ExampleQueryMeta) SetIndex(i uint64) {
|
|
if msg == nil || msg.QueryMeta == nil {
|
|
return
|
|
}
|
|
msg.QueryMeta.SetIndex(i)
|
|
}
|
|
|
|
// SetResultsFilteredByACLs is required to implement blockingQueryResponseMeta
|
|
func (msg *ExampleQueryMeta) SetResultsFilteredByACLs(b bool) {
|
|
if msg == nil || msg.QueryMeta == nil {
|
|
return
|
|
}
|
|
msg.QueryMeta.SetResultsFilteredByACLs(b)
|
|
}
|
|
|
|
// RequestDatacenter implements structs.RPCInfo
|
|
func (msg *ExampleDatacenter) RequestDatacenter() string {
|
|
if msg == nil {
|
|
return ""
|
|
}
|
|
return msg.Datacenter
|
|
}
|
|
|
|
// IsRead implements structs.RPCInfo
|
|
func (msg *ExampleReadTODO) IsRead() bool {
|
|
// TODO(peering): figure out read semantics here
|
|
return true
|
|
}
|
|
|
|
// AllowStaleRead implements structs.RPCInfo
|
|
func (msg *ExampleReadTODO) AllowStaleRead() bool {
|
|
// TODO(peering): figure out read semantics here
|
|
return false
|
|
}
|
|
|
|
// HasTimedOut implements structs.RPCInfo
|
|
func (msg *ExampleReadTODO) HasTimedOut(start time.Time, rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) (bool, error) {
|
|
// TODO(peering): figure out read semantics here
|
|
return time.Since(start) > rpcHoldTimeout, nil
|
|
}
|
|
|
|
// Timeout implements structs.RPCInfo
|
|
func (msg *ExampleReadTODO) Timeout(rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) time.Duration {
|
|
// TODO(peering): figure out read semantics here
|
|
return rpcHoldTimeout
|
|
}
|
|
|
|
// SetTokenSecret implements structs.RPCInfo
|
|
func (msg *ExampleReadTODO) SetTokenSecret(s string) {
|
|
// TODO(peering): figure out read semantics here
|
|
}
|
|
|
|
// TokenSecret implements structs.RPCInfo
|
|
func (msg *ExampleReadTODO) TokenSecret() string {
|
|
// TODO(peering): figure out read semantics here
|
|
return ""
|
|
}
|
|
|
|
// Token implements structs.RPCInfo
|
|
func (msg *ExampleReadTODO) Token() string {
|
|
// TODO(peering): figure out read semantics here
|
|
return ""
|
|
}
|
|
|
|
// IsRead implements structs.RPCInfo
|
|
func (msg *ExampleWriteTODO) IsRead() bool {
|
|
// TODO(peering): figure out write semantics here
|
|
return false
|
|
}
|
|
|
|
// AllowStaleRead implements structs.RPCInfo
|
|
func (msg *ExampleWriteTODO) AllowStaleRead() bool {
|
|
// TODO(peering): figure out write semantics here
|
|
return false
|
|
}
|
|
|
|
// HasTimedOut implements structs.RPCInfo
|
|
func (msg *ExampleWriteTODO) HasTimedOut(start time.Time, rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) (bool, error) {
|
|
// TODO(peering): figure out write semantics here
|
|
return time.Since(start) > rpcHoldTimeout, nil
|
|
}
|
|
|
|
// Timeout implements structs.RPCInfo
|
|
func (msg *ExampleWriteTODO) Timeout(rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) time.Duration {
|
|
// TODO(peering): figure out write semantics here
|
|
return rpcHoldTimeout
|
|
}
|
|
|
|
// SetTokenSecret implements structs.RPCInfo
|
|
func (msg *ExampleWriteTODO) SetTokenSecret(s string) {
|
|
// TODO(peering): figure out write semantics here
|
|
}
|
|
|
|
// TokenSecret implements structs.RPCInfo
|
|
func (msg *ExampleWriteTODO) TokenSecret() string {
|
|
// TODO(peering): figure out write semantics here
|
|
return ""
|
|
}
|
|
|
|
// AllowStaleRead implements structs.RPCInfo
|
|
func (msg *AltExampleWriteRequest) AllowStaleRead() bool {
|
|
return false
|
|
}
|
|
|
|
// HasTimedOut implements structs.RPCInfo
|
|
func (msg *AltExampleWriteRequest) HasTimedOut(start time.Time, rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) (bool, error) {
|
|
if msg == nil || msg.AltWriteRequest == nil {
|
|
return false, nil
|
|
}
|
|
return msg.AltWriteRequest.HasTimedOut(start, rpcHoldTimeout, a, b)
|
|
}
|
|
|
|
// Timeout implements structs.RPCInfo
|
|
func (msg *AltExampleWriteRequest) Timeout(rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) time.Duration {
|
|
if msg == nil || msg.AltWriteRequest == nil {
|
|
return 0
|
|
}
|
|
return msg.AltWriteRequest.Timeout(rpcHoldTimeout, a, b)
|
|
}
|
|
|
|
// IsRead implements structs.RPCInfo
|
|
func (msg *AltExampleWriteRequest) IsRead() bool {
|
|
return false
|
|
}
|
|
|
|
// SetTokenSecret implements structs.RPCInfo
|
|
func (msg *AltExampleWriteRequest) SetTokenSecret(s string) {
|
|
// TODO: initialize if nil
|
|
msg.AltWriteRequest.SetTokenSecret(s)
|
|
}
|
|
|
|
// TokenSecret implements structs.RPCInfo
|
|
func (msg *AltExampleWriteRequest) TokenSecret() string {
|
|
if msg == nil || msg.AltWriteRequest == nil {
|
|
return ""
|
|
}
|
|
return msg.AltWriteRequest.TokenSecret()
|
|
}
|
|
|
|
// Token implements structs.RPCInfo
|
|
func (msg *AltExampleWriteRequest) Token() string {
|
|
if msg.AltWriteRequest == nil {
|
|
return ""
|
|
}
|
|
return msg.AltWriteRequest.Token
|
|
}
|
|
|
|
// IsRead implements structs.RPCInfo
|
|
func (msg *AltExampleReadRequest) IsRead() bool {
|
|
return true
|
|
}
|
|
|
|
// AllowStaleRead implements structs.RPCInfo
|
|
func (msg *AltExampleReadRequest) AllowStaleRead() bool {
|
|
// TODO: initialize if nil
|
|
return msg.AltReadRequest.AllowStaleRead()
|
|
}
|
|
|
|
// HasTimedOut implements structs.RPCInfo
|
|
func (msg *AltExampleReadRequest) HasTimedOut(start time.Time, rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) (bool, error) {
|
|
if msg == nil || msg.AltReadRequest == nil {
|
|
return false, nil
|
|
}
|
|
return msg.AltReadRequest.HasTimedOut(start, rpcHoldTimeout, a, b)
|
|
}
|
|
|
|
// Timeout implements structs.RPCInfo
|
|
func (msg *AltExampleReadRequest) Timeout(rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) time.Duration {
|
|
if msg == nil || msg.AltReadRequest == nil {
|
|
return 0
|
|
}
|
|
return msg.AltReadRequest.Timeout(rpcHoldTimeout, a, b)
|
|
}
|
|
|
|
// SetTokenSecret implements structs.RPCInfo
|
|
func (msg *AltExampleReadRequest) SetTokenSecret(s string) {
|
|
// TODO: initialize if nil
|
|
msg.AltReadRequest.SetTokenSecret(s)
|
|
}
|
|
|
|
// TokenSecret implements structs.RPCInfo
|
|
func (msg *AltExampleReadRequest) TokenSecret() string {
|
|
if msg == nil || msg.AltReadRequest == nil {
|
|
return ""
|
|
}
|
|
return msg.AltReadRequest.TokenSecret()
|
|
}
|
|
|
|
// Token implements structs.RPCInfo
|
|
func (msg *AltExampleReadRequest) Token() string {
|
|
if msg.AltReadRequest == nil {
|
|
return ""
|
|
}
|
|
return msg.AltReadRequest.Token
|
|
}
|
|
|
|
// IsRead implements structs.RPCInfo
|
|
func (msg *AltExampleQueryOptions) IsRead() bool {
|
|
return true
|
|
}
|
|
|
|
// AllowStaleRead implements structs.RPCInfo
|
|
func (msg *AltExampleQueryOptions) AllowStaleRead() bool {
|
|
return msg.AltQueryOptions.AllowStaleRead()
|
|
}
|
|
|
|
// HasTimedOut implements structs.RPCInfo
|
|
func (msg *AltExampleQueryOptions) HasTimedOut(start time.Time, rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) (bool, error) {
|
|
if msg == nil || msg.AltQueryOptions == nil {
|
|
return false, nil
|
|
}
|
|
return msg.AltQueryOptions.HasTimedOut(start, rpcHoldTimeout, a, b)
|
|
}
|
|
|
|
// Timeout implements structs.RPCInfo
|
|
func (msg *AltExampleQueryOptions) Timeout(rpcHoldTimeout time.Duration, a time.Duration, b time.Duration) time.Duration {
|
|
if msg == nil || msg.AltQueryOptions == nil {
|
|
return 0
|
|
}
|
|
return msg.AltQueryOptions.Timeout(rpcHoldTimeout, a, b)
|
|
}
|
|
|
|
// SetTokenSecret implements structs.RPCInfo
|
|
func (msg *AltExampleQueryOptions) SetTokenSecret(s string) {
|
|
// TODO: initialize if nil
|
|
msg.AltQueryOptions.SetTokenSecret(s)
|
|
}
|
|
|
|
// TokenSecret implements structs.RPCInfo
|
|
func (msg *AltExampleQueryOptions) TokenSecret() string {
|
|
if msg == nil || msg.AltQueryOptions == nil {
|
|
return ""
|
|
}
|
|
return msg.AltQueryOptions.TokenSecret()
|
|
}
|
|
|
|
// Token implements structs.RPCInfo
|
|
func (msg *AltExampleQueryOptions) Token() string {
|
|
if msg.AltQueryOptions == nil {
|
|
return ""
|
|
}
|
|
return msg.AltQueryOptions.Token
|
|
}
|
|
|
|
// GetToken is required to implement blockingQueryOptions
|
|
func (msg *AltExampleQueryOptions) GetToken() string {
|
|
if msg == nil || msg.AltQueryOptions == nil {
|
|
return ""
|
|
}
|
|
|
|
return msg.AltQueryOptions.GetToken()
|
|
}
|
|
|
|
// GetMinQueryIndex is required to implement blockingQueryOptions
|
|
func (msg *AltExampleQueryOptions) GetMinQueryIndex() uint64 {
|
|
if msg == nil || msg.AltQueryOptions == nil {
|
|
return 0
|
|
}
|
|
|
|
return msg.AltQueryOptions.GetMinQueryIndex()
|
|
}
|
|
|
|
// GetMaxQueryTime is required to implement blockingQueryOptions
|
|
func (msg *AltExampleQueryOptions) GetMaxQueryTime() (time.Duration, error) {
|
|
if msg == nil || msg.AltQueryOptions == nil {
|
|
return 0, nil
|
|
}
|
|
|
|
return structs.DurationFromProto(msg.AltQueryOptions.GetMaxQueryTime()), nil
|
|
}
|
|
|
|
// GetRequireConsistent is required to implement blockingQueryOptions
|
|
func (msg *AltExampleQueryOptions) GetRequireConsistent() bool {
|
|
if msg == nil || msg.AltQueryOptions == nil {
|
|
return false
|
|
}
|
|
return msg.AltQueryOptions.RequireConsistent
|
|
}
|
|
|
|
// SetLastContact is required to implement blockingQueryResponseMeta
|
|
func (msg *AltExampleQueryMeta) SetLastContact(d time.Duration) {
|
|
if msg == nil || msg.AltQueryMeta == nil {
|
|
return
|
|
}
|
|
msg.AltQueryMeta.SetLastContact(d)
|
|
}
|
|
|
|
// SetKnownLeader is required to implement blockingQueryResponseMeta
|
|
func (msg *AltExampleQueryMeta) SetKnownLeader(b bool) {
|
|
if msg == nil || msg.AltQueryMeta == nil {
|
|
return
|
|
}
|
|
msg.AltQueryMeta.SetKnownLeader(b)
|
|
}
|
|
|
|
// GetIndex is required to implement blockingQueryResponseMeta
|
|
func (msg *AltExampleQueryMeta) GetIndex() uint64 {
|
|
if msg == nil || msg.AltQueryMeta == nil {
|
|
return 0
|
|
}
|
|
return msg.AltQueryMeta.GetIndex()
|
|
}
|
|
|
|
// SetIndex is required to implement blockingQueryResponseMeta
|
|
func (msg *AltExampleQueryMeta) SetIndex(i uint64) {
|
|
if msg == nil || msg.AltQueryMeta == nil {
|
|
return
|
|
}
|
|
msg.AltQueryMeta.SetIndex(i)
|
|
}
|
|
|
|
// SetResultsFilteredByACLs is required to implement blockingQueryResponseMeta
|
|
func (msg *AltExampleQueryMeta) SetResultsFilteredByACLs(b bool) {
|
|
if msg == nil || msg.AltQueryMeta == nil {
|
|
return
|
|
}
|
|
msg.AltQueryMeta.SetResultsFilteredByACLs(b)
|
|
}
|
|
|
|
// RequestDatacenter implements structs.RPCInfo
|
|
func (msg *AltExampleDatacenter) RequestDatacenter() string {
|
|
if msg == nil {
|
|
return ""
|
|
}
|
|
return msg.Datacenter
|
|
}
|