internal: port RPC glue changes from Enterprise (#13034)

Co-authored-by: R.B. Boyer <rb@hashicorp.com>
This commit is contained in:
Evan Culver 2022-05-11 15:03:07 -07:00 committed by GitHub
parent 499fbdabaf
commit 88449b1f1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 520 additions and 121 deletions

View File

@ -32,6 +32,22 @@ type ExampleQueryMeta struct {
QueryMeta *pbcommon.QueryMeta
}
// @consul-rpc-glue: Datacenter
type ExampleDatacenter struct {
Value string
Datacenter string
}
// @consul-rpc-glue: ReadTODO
type ExampleReadTODO struct {
Value string
}
// @consul-rpc-glue: WriteTODO
type ExampleWriteTODO struct {
Value string
}
// @consul-rpc-glue: WriteRequest=AltWriteRequest
type AltExampleWriteRequest struct {
Value int
@ -54,3 +70,9 @@ type AltExampleQueryOptions struct {
type AltExampleQueryMeta struct {
AltQueryMeta *pbcommon.QueryMeta
}
// @consul-rpc-glue: Datacenter=AltDatacenter
type AltExampleDatacenter struct {
Value string
AltDatacenter string
}

View File

@ -13,6 +13,7 @@ import (
// 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 {
@ -27,6 +28,14 @@ func (msg *ExampleWriteRequest) HasTimedOut(start time.Time, rpcHoldTimeout time
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
@ -81,6 +90,14 @@ func (msg *ExampleReadRequest) HasTimedOut(start time.Time, rpcHoldTimeout time.
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
@ -137,6 +154,14 @@ func (msg *ExampleQueryOptions) HasTimedOut(start time.Time, rpcHoldTimeout time
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
@ -234,6 +259,90 @@ func (msg *ExampleQueryMeta) SetResultsFilteredByACLs(b bool) {
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
@ -247,6 +356,14 @@ func (msg *AltExampleWriteRequest) HasTimedOut(start time.Time, rpcHoldTimeout t
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
@ -293,6 +410,14 @@ func (msg *AltExampleReadRequest) HasTimedOut(start time.Time, rpcHoldTimeout ti
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
@ -333,6 +458,14 @@ func (msg *AltExampleQueryOptions) HasTimedOut(start time.Time, rpcHoldTimeout t
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
@ -429,3 +562,11 @@ func (msg *AltExampleQueryMeta) SetResultsFilteredByACLs(b bool) {
}
msg.AltQueryMeta.SetResultsFilteredByACLs(b)
}
// RequestDatacenter implements structs.RPCInfo
func (msg *AltExampleDatacenter) RequestDatacenter() string {
if msg == nil {
return ""
}
return msg.Datacenter
}

View File

@ -102,6 +102,15 @@ func processFile(path string) error {
if ann.QueryMeta != "" {
log.Printf(" QueryMeta from %s", ann.QueryMeta)
}
if ann.Datacenter != "" {
log.Printf(" Datacenter from %s", ann.Datacenter)
}
if ann.ReadTODO != "" {
log.Printf(" ReadTODO from %s", ann.ReadTODO)
}
if ann.WriteTODO != "" {
log.Printf(" WriteTODO from %s", ann.WriteTODO)
}
}
}
@ -126,6 +135,7 @@ import (
// Reference imports to suppress errors if they are not otherwise used.
var _ structs.RPCInfo
var _ time.Month
`)
for _, typ := range v.Types {
@ -144,6 +154,15 @@ var _ structs.RPCInfo
if typ.Annotation.QueryMeta != "" {
buf.WriteString(fmt.Sprintf(tmplQueryMeta, typ.Name, typ.Annotation.QueryMeta))
}
if typ.Annotation.Datacenter != "" {
buf.WriteString(fmt.Sprintf(tmplDatacenter, typ.Name, typ.Annotation.Datacenter))
}
if typ.Annotation.ReadTODO != "" {
buf.WriteString(fmt.Sprintf(tmplReadTODO, typ.Name, typ.Annotation.ReadTODO))
}
if typ.Annotation.WriteTODO != "" {
buf.WriteString(fmt.Sprintf(tmplWriteTODO, typ.Name, typ.Annotation.WriteTODO))
}
}
// write to disk
@ -245,6 +264,9 @@ type Annotation struct {
ReadRequest string
WriteRequest string
TargetDatacenter string
Datacenter string
ReadTODO string
WriteTODO string
}
func (a Annotation) IsZero() bool {
@ -288,6 +310,16 @@ func getAnnotation(doc []*ast.Comment) (Annotation, error) {
case strings.HasPrefix(part, "QueryMeta="):
ann.QueryMeta = strings.TrimPrefix(part, "QueryMeta=")
case part == "Datacenter":
ann.Datacenter = "Datacenter"
case strings.HasPrefix(part, "Datacenter="):
ann.Datacenter = strings.TrimPrefix(part, "Datacenter=")
case part == "ReadTODO":
ann.ReadTODO = "ReadTODO"
case part == "WriteTODO":
ann.WriteTODO = "WriteTODO"
default:
return Annotation{}, fmt.Errorf("unexpected annotation part: %s", part)
}
@ -431,6 +463,86 @@ func (msg *%[1]s) Token() string {
}
`
const tmplReadTODO = `
// IsRead implements structs.RPCInfo
func (msg *%[1]s) IsRead() bool {
// TODO(peering): figure out read semantics here
return true
}
// AllowStaleRead implements structs.RPCInfo
func (msg *%[1]s) AllowStaleRead() bool {
// TODO(peering): figure out read semantics here
return false
}
// HasTimedOut implements structs.RPCInfo
func (msg *%[1]s) 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 *%[1]s) 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 *%[1]s) SetTokenSecret(s string) {
// TODO(peering): figure out read semantics here
}
// TokenSecret implements structs.RPCInfo
func (msg *%[1]s) TokenSecret() string {
// TODO(peering): figure out read semantics here
return ""
}
// Token implements structs.RPCInfo
func (msg *%[1]s) Token() string {
// TODO(peering): figure out read semantics here
return ""
}
`
const tmplWriteTODO = `
// IsRead implements structs.RPCInfo
func (msg *%[1]s) IsRead() bool {
// TODO(peering): figure out write semantics here
return false
}
// AllowStaleRead implements structs.RPCInfo
func (msg *%[1]s) AllowStaleRead() bool {
// TODO(peering): figure out write semantics here
return false
}
// HasTimedOut implements structs.RPCInfo
func (msg *%[1]s) 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 *%[1]s) 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 *%[1]s) SetTokenSecret(s string) {
// TODO(peering): figure out write semantics here
}
// TokenSecret implements structs.RPCInfo
func (msg *%[1]s) TokenSecret() string {
// TODO(peering): figure out write semantics here
return ""
}
`
const tmplTargetDatacenter = `
// RequestDatacenter implements structs.RPCInfo
func (msg *%[1]s) RequestDatacenter() string {
@ -441,6 +553,16 @@ func (msg *%[1]s) RequestDatacenter() string {
}
`
const tmplDatacenter = `
// RequestDatacenter implements structs.RPCInfo
func (msg *%[1]s) RequestDatacenter() string {
if msg == nil {
return ""
}
return msg.Datacenter
}
`
const tmplQueryOptions = `
// IsRead implements structs.RPCInfo
func (msg *%[1]s) IsRead() bool {

View File

@ -7,122 +7,6 @@ import "time"
// Hoping to replace them with 1 or 2 methods per request
// using https://github.com/hashicorp/consul/pull/12507
func (msg *PeeringReadRequest) RequestDatacenter() string {
return msg.Datacenter
}
func (msg *PeeringReadRequest) IsRead() bool {
return true
}
func (msg *PeeringReadRequest) AllowStaleRead() bool {
return false
}
func (msg *PeeringReadRequest) TokenSecret() string {
return ""
}
func (msg *PeeringReadRequest) SetTokenSecret(s string) {
return
}
func (msg *PeeringReadRequest) HasTimedOut(start time.Time, rpcHoldTimeout, maxQueryTime, defaultQueryTime time.Duration) (bool, error) {
return time.Since(start) > rpcHoldTimeout, nil
}
// Timeout implements structs.RPCInfo
func (msg *PeeringReadRequest) Timeout(rpcHoldTimeout time.Duration, maxQueryTime time.Duration, defaultQueryTime time.Duration) time.Duration {
return rpcHoldTimeout
}
func (msg *PeeringListRequest) RequestDatacenter() string {
return msg.Datacenter
}
func (msg *PeeringListRequest) IsRead() bool {
return true
}
func (msg *PeeringListRequest) AllowStaleRead() bool {
return false
}
func (msg *PeeringListRequest) TokenSecret() string {
return ""
}
func (msg *PeeringListRequest) SetTokenSecret(s string) {
return
}
func (msg *PeeringListRequest) HasTimedOut(start time.Time, rpcHoldTimeout, maxQueryTime, defaultQueryTime time.Duration) (bool, error) {
return time.Since(start) > rpcHoldTimeout, nil
}
// Timeout implements structs.RPCInfo
func (msg *PeeringListRequest) Timeout(rpcHoldTimeout time.Duration, maxQueryTime time.Duration, defaultQueryTime time.Duration) time.Duration {
return rpcHoldTimeout
}
func (msg *PeeringWriteRequest) RequestDatacenter() string {
return msg.Datacenter
}
func (msg *PeeringWriteRequest) IsRead() bool {
return false
}
func (msg *PeeringWriteRequest) AllowStaleRead() bool {
return false
}
func (msg *PeeringWriteRequest) TokenSecret() string {
return ""
}
func (msg *PeeringWriteRequest) SetTokenSecret(s string) {
return
}
func (msg *PeeringWriteRequest) HasTimedOut(start time.Time, rpcHoldTimeout, maxQueryTime, defaultQueryTime time.Duration) (bool, error) {
return time.Since(start) > rpcHoldTimeout, nil
}
// Timeout implements structs.RPCInfo
func (msg *PeeringWriteRequest) Timeout(rpcHoldTimeout time.Duration, maxQueryTime time.Duration, defaultQueryTime time.Duration) time.Duration {
return rpcHoldTimeout
}
func (msg *PeeringDeleteRequest) RequestDatacenter() string {
return msg.Datacenter
}
func (msg *PeeringDeleteRequest) IsRead() bool {
return false
}
func (msg *PeeringDeleteRequest) AllowStaleRead() bool {
return false
}
func (msg *PeeringDeleteRequest) TokenSecret() string {
return ""
}
func (msg *PeeringDeleteRequest) SetTokenSecret(s string) {
return
}
func (msg *PeeringDeleteRequest) HasTimedOut(start time.Time, rpcHoldTimeout, maxQueryTime, defaultQueryTime time.Duration) (bool, error) {
return time.Since(start) > rpcHoldTimeout, nil
}
// Timeout implements structs.RPCInfo
func (msg *PeeringDeleteRequest) Timeout(rpcHoldTimeout time.Duration, maxQueryTime time.Duration, defaultQueryTime time.Duration) time.Duration {
return rpcHoldTimeout
}
// RequestDatacenter implements structs.RPCInfo
func (req *GenerateTokenRequest) RequestDatacenter() string {
return req.Datacenter
@ -158,11 +42,6 @@ func (msg *GenerateTokenRequest) Timeout(rpcHoldTimeout time.Duration, maxQueryT
return rpcHoldTimeout
}
// RequestDatacenter implements structs.RPCInfo
func (req *InitiateRequest) RequestDatacenter() string {
return req.Datacenter
}
// IsRead implements structs.RPCInfo
func (req *InitiateRequest) IsRead() bool {
return false

View File

@ -385,6 +385,7 @@ func (x *PeeringTrustBundle) GetModifyIndex() uint64 {
return 0
}
// @consul-rpc-glue: Datacenter,ReadTODO
type PeeringReadRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -495,6 +496,7 @@ func (x *PeeringReadResponse) GetPeering() *Peering {
return nil
}
// @consul-rpc-glue: Datacenter,ReadTODO
type PeeringListRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -597,6 +599,7 @@ func (x *PeeringListResponse) GetPeerings() []*Peering {
return nil
}
// @consul-rpc-glue: Datacenter,WriteTODO
type PeeringWriteRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -701,6 +704,7 @@ func (*PeeringWriteResponse) Descriptor() ([]byte, []int) {
return file_proto_pbpeering_peering_proto_rawDescGZIP(), []int{7}
}
// @consul-rpc-glue: Datacenter,WriteTODO
type PeeringDeleteRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -888,6 +892,7 @@ func (*PeeringTerminateByIDResponse) Descriptor() ([]byte, []int) {
return file_proto_pbpeering_peering_proto_rawDescGZIP(), []int{11}
}
// @consul-rpc-glue: Datacenter
type PeeringTrustBundleWriteRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -982,6 +987,7 @@ func (*PeeringTrustBundleWriteResponse) Descriptor() ([]byte, []int) {
return file_proto_pbpeering_peering_proto_rawDescGZIP(), []int{13}
}
// @consul-rpc-glue: Datacenter
type PeeringTrustBundleDeleteRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -1217,6 +1223,7 @@ func (x *GenerateTokenResponse) GetPeeringToken() string {
return ""
}
// @consul-rpc-glue: Datacenter
type InitiateRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache

View File

@ -108,6 +108,7 @@ message PeeringTrustBundle {
uint64 ModifyIndex = 6;
}
// @consul-rpc-glue: Datacenter,ReadTODO
message PeeringReadRequest {
string Name = 1;
string Partition = 2;
@ -123,6 +124,7 @@ message PeeringReadResponse {
//TODO(peering) query metadata
}
// @consul-rpc-glue: Datacenter,ReadTODO
message PeeringListRequest {
string Partition = 1;
@ -137,6 +139,7 @@ message PeeringListResponse {
//TODO(peering) query metadata
}
// @consul-rpc-glue: Datacenter,WriteTODO
message PeeringWriteRequest {
Peering Peering = 1;
@ -150,6 +153,7 @@ message PeeringWriteRequest {
// TODO(peering): Consider returning Peering if we keep this endpoint around
message PeeringWriteResponse{}
// @consul-rpc-glue: Datacenter,WriteTODO
message PeeringDeleteRequest {
string Name = 1;
@ -167,6 +171,7 @@ message PeeringTerminateByIDRequest {
message PeeringTerminateByIDResponse {}
// @consul-rpc-glue: Datacenter
message PeeringTrustBundleWriteRequest {
PeeringTrustBundle PeeringTrustBundle = 1;
@ -176,6 +181,7 @@ message PeeringTrustBundleWriteRequest {
message PeeringTrustBundleWriteResponse{}
// @consul-rpc-glue: Datacenter
message PeeringTrustBundleDeleteRequest {
string Name = 1;
@ -209,6 +215,7 @@ message GenerateTokenResponse {
string PeeringToken = 1;
}
// @consul-rpc-glue: Datacenter
message InitiateRequest {
// Name of the remote peer.
string PeerName = 1;

View File

@ -0,0 +1,221 @@
// Code generated by proto-gen-rpc-glue. DO NOT EDIT.
package pbpeering
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
// RequestDatacenter implements structs.RPCInfo
func (msg *PeeringReadRequest) RequestDatacenter() string {
if msg == nil {
return ""
}
return msg.Datacenter
}
// IsRead implements structs.RPCInfo
func (msg *PeeringReadRequest) IsRead() bool {
// TODO(peering): figure out read semantics here
return true
}
// AllowStaleRead implements structs.RPCInfo
func (msg *PeeringReadRequest) AllowStaleRead() bool {
// TODO(peering): figure out read semantics here
return false
}
// HasTimedOut implements structs.RPCInfo
func (msg *PeeringReadRequest) 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 *PeeringReadRequest) 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 *PeeringReadRequest) SetTokenSecret(s string) {
// TODO(peering): figure out read semantics here
}
// TokenSecret implements structs.RPCInfo
func (msg *PeeringReadRequest) TokenSecret() string {
// TODO(peering): figure out read semantics here
return ""
}
// Token implements structs.RPCInfo
func (msg *PeeringReadRequest) Token() string {
// TODO(peering): figure out read semantics here
return ""
}
// RequestDatacenter implements structs.RPCInfo
func (msg *PeeringListRequest) RequestDatacenter() string {
if msg == nil {
return ""
}
return msg.Datacenter
}
// IsRead implements structs.RPCInfo
func (msg *PeeringListRequest) IsRead() bool {
// TODO(peering): figure out read semantics here
return true
}
// AllowStaleRead implements structs.RPCInfo
func (msg *PeeringListRequest) AllowStaleRead() bool {
// TODO(peering): figure out read semantics here
return false
}
// HasTimedOut implements structs.RPCInfo
func (msg *PeeringListRequest) 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 *PeeringListRequest) 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 *PeeringListRequest) SetTokenSecret(s string) {
// TODO(peering): figure out read semantics here
}
// TokenSecret implements structs.RPCInfo
func (msg *PeeringListRequest) TokenSecret() string {
// TODO(peering): figure out read semantics here
return ""
}
// Token implements structs.RPCInfo
func (msg *PeeringListRequest) Token() string {
// TODO(peering): figure out read semantics here
return ""
}
// RequestDatacenter implements structs.RPCInfo
func (msg *PeeringWriteRequest) RequestDatacenter() string {
if msg == nil {
return ""
}
return msg.Datacenter
}
// IsRead implements structs.RPCInfo
func (msg *PeeringWriteRequest) IsRead() bool {
// TODO(peering): figure out write semantics here
return false
}
// AllowStaleRead implements structs.RPCInfo
func (msg *PeeringWriteRequest) AllowStaleRead() bool {
// TODO(peering): figure out write semantics here
return false
}
// HasTimedOut implements structs.RPCInfo
func (msg *PeeringWriteRequest) 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 *PeeringWriteRequest) 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 *PeeringWriteRequest) SetTokenSecret(s string) {
// TODO(peering): figure out write semantics here
}
// TokenSecret implements structs.RPCInfo
func (msg *PeeringWriteRequest) TokenSecret() string {
// TODO(peering): figure out write semantics here
return ""
}
// RequestDatacenter implements structs.RPCInfo
func (msg *PeeringDeleteRequest) RequestDatacenter() string {
if msg == nil {
return ""
}
return msg.Datacenter
}
// IsRead implements structs.RPCInfo
func (msg *PeeringDeleteRequest) IsRead() bool {
// TODO(peering): figure out write semantics here
return false
}
// AllowStaleRead implements structs.RPCInfo
func (msg *PeeringDeleteRequest) AllowStaleRead() bool {
// TODO(peering): figure out write semantics here
return false
}
// HasTimedOut implements structs.RPCInfo
func (msg *PeeringDeleteRequest) 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 *PeeringDeleteRequest) 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 *PeeringDeleteRequest) SetTokenSecret(s string) {
// TODO(peering): figure out write semantics here
}
// TokenSecret implements structs.RPCInfo
func (msg *PeeringDeleteRequest) TokenSecret() string {
// TODO(peering): figure out write semantics here
return ""
}
// RequestDatacenter implements structs.RPCInfo
func (msg *PeeringTrustBundleWriteRequest) RequestDatacenter() string {
if msg == nil {
return ""
}
return msg.Datacenter
}
// RequestDatacenter implements structs.RPCInfo
func (msg *PeeringTrustBundleDeleteRequest) RequestDatacenter() string {
if msg == nil {
return ""
}
return msg.Datacenter
}
// RequestDatacenter implements structs.RPCInfo
func (msg *InitiateRequest) RequestDatacenter() string {
if msg == nil {
return ""
}
return msg.Datacenter
}