2021-09-22 18:14:26 +00:00
|
|
|
package pbsubscribe
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
// RequestDatacenter implements structs.RPCInfo
|
|
|
|
func (req *SubscribeRequest) RequestDatacenter() string {
|
|
|
|
return req.Datacenter
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsRead implements structs.RPCInfo
|
|
|
|
func (req *SubscribeRequest) IsRead() bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
// AllowStaleRead implements structs.RPCInfo
|
|
|
|
func (req *SubscribeRequest) AllowStaleRead() bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
// TokenSecret implements structs.RPCInfo
|
|
|
|
func (req *SubscribeRequest) TokenSecret() string {
|
|
|
|
return req.Token
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetTokenSecret implements structs.RPCInfo
|
|
|
|
func (req *SubscribeRequest) SetTokenSecret(token string) {
|
|
|
|
req.Token = token
|
|
|
|
}
|
|
|
|
|
|
|
|
// HasTimedOut implements structs.RPCInfo
|
2022-03-16 16:12:29 +00:00
|
|
|
func (req *SubscribeRequest) HasTimedOut(start time.Time, rpcHoldTimeout, maxQueryTime, defaultQueryTime time.Duration) (bool, error) {
|
2022-04-21 20:21:35 +00:00
|
|
|
return time.Since(start) > req.Timeout(rpcHoldTimeout, maxQueryTime, defaultQueryTime), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Timeout implements structs.RPCInfo
|
|
|
|
func (req *SubscribeRequest) Timeout(rpcHoldTimeout, maxQueryTime, defaultQueryTime time.Duration) time.Duration {
|
|
|
|
return rpcHoldTimeout
|
2021-09-22 18:14:26 +00:00
|
|
|
}
|