本文整理汇总了Golang中github.com/googleapis/gax-go.WithRetry函数的典型用法代码示例。如果您正苦于以下问题:Golang WithRetry函数的具体用法?Golang WithRetry怎么用?Golang WithRetry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WithRetry函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: defaultCallOptions
func defaultCallOptions() *CallOptions {
retry := map[[2]string][]gax.CallOption{
{"default", "idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 1000 * time.Millisecond,
Multiplier: 1.2,
})
}),
},
{"list", "idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 1000 * time.Millisecond,
Multiplier: 1.2,
})
}),
},
}
return &CallOptions{
DeleteLog: retry[[2]string{"default", "idempotent"}],
WriteLogEntries: retry[[2]string{"default", "non_idempotent"}],
ListLogEntries: retry[[2]string{"list", "idempotent"}],
ListMonitoredResourceDescriptors: retry[[2]string{"default", "idempotent"}],
}
}
示例2: defaultIamCallOptions
func defaultIamCallOptions() *IamCallOptions {
retry := map[[2]string][]gax.CallOption{
{"default", "idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.3,
})
}),
},
}
return &IamCallOptions{
ListServiceAccounts: retry[[2]string{"default", "idempotent"}],
GetServiceAccount: retry[[2]string{"default", "idempotent"}],
CreateServiceAccount: retry[[2]string{"default", "non_idempotent"}],
UpdateServiceAccount: retry[[2]string{"default", "idempotent"}],
DeleteServiceAccount: retry[[2]string{"default", "idempotent"}],
ListServiceAccountKeys: retry[[2]string{"default", "idempotent"}],
GetServiceAccountKey: retry[[2]string{"default", "idempotent"}],
CreateServiceAccountKey: retry[[2]string{"default", "non_idempotent"}],
DeleteServiceAccountKey: retry[[2]string{"default", "idempotent"}],
SignBlob: retry[[2]string{"default", "non_idempotent"}],
GetIamPolicy: retry[[2]string{"default", "non_idempotent"}],
SetIamPolicy: retry[[2]string{"default", "non_idempotent"}],
TestIamPermissions: retry[[2]string{"default", "non_idempotent"}],
QueryGrantableRoles: retry[[2]string{"default", "non_idempotent"}],
}
}
示例3: defaultSubscriberCallOptions
func defaultSubscriberCallOptions() *SubscriberCallOptions {
retry := map[[2]string][]gax.CallOption{
{"default", "idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.3,
})
}),
},
}
return &SubscriberCallOptions{
CreateSubscription: retry[[2]string{"default", "idempotent"}],
GetSubscription: retry[[2]string{"default", "idempotent"}],
ListSubscriptions: retry[[2]string{"default", "idempotent"}],
DeleteSubscription: retry[[2]string{"default", "idempotent"}],
ModifyAckDeadline: retry[[2]string{"default", "non_idempotent"}],
Acknowledge: retry[[2]string{"messaging", "non_idempotent"}],
Pull: retry[[2]string{"messaging", "non_idempotent"}],
StreamingPull: retry[[2]string{"messaging", "non_idempotent"}],
ModifyPushConfig: retry[[2]string{"default", "non_idempotent"}],
}
}
示例4: defaultMetricCallOptions
func defaultMetricCallOptions() *MetricCallOptions {
retry := map[[2]string][]gax.CallOption{
{"default", "idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.3,
})
}),
},
}
return &MetricCallOptions{
ListMonitoredResourceDescriptors: retry[[2]string{"default", "idempotent"}],
GetMonitoredResourceDescriptor: retry[[2]string{"default", "idempotent"}],
ListMetricDescriptors: retry[[2]string{"default", "idempotent"}],
GetMetricDescriptor: retry[[2]string{"default", "idempotent"}],
CreateMetricDescriptor: retry[[2]string{"default", "non_idempotent"}],
DeleteMetricDescriptor: retry[[2]string{"default", "idempotent"}],
ListTimeSeries: retry[[2]string{"default", "idempotent"}],
CreateTimeSeries: retry[[2]string{"default", "non_idempotent"}],
}
}
示例5: defaultPublisherCallOptions
func defaultPublisherCallOptions() *PublisherCallOptions {
retry := map[[2]string][]gax.CallOption{
{"default", "idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.3,
})
}),
},
{"messaging", "one_plus_delivery"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.3,
})
}),
},
}
return &PublisherCallOptions{
CreateTopic: retry[[2]string{"default", "idempotent"}],
Publish: retry[[2]string{"messaging", "one_plus_delivery"}],
GetTopic: retry[[2]string{"default", "idempotent"}],
ListTopics: retry[[2]string{"default", "idempotent"}],
ListTopicSubscriptions: retry[[2]string{"default", "idempotent"}],
DeleteTopic: retry[[2]string{"default", "idempotent"}],
}
}
示例6: defaultImageAnnotatorCallOptions
func defaultImageAnnotatorCallOptions() *ImageAnnotatorCallOptions {
retry := map[[2]string][]gax.CallOption{
{"default", "idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.3,
})
}),
},
}
return &ImageAnnotatorCallOptions{
BatchAnnotateImages: retry[[2]string{"default", "idempotent"}],
}
}
示例7: defaultController2CallOptions
func defaultController2CallOptions() *Controller2CallOptions {
retry := map[[2]string][]gax.CallOption{
{"default", "idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.3,
})
}),
},
}
return &Controller2CallOptions{
RegisterDebuggee: retry[[2]string{"default", "non_idempotent"}],
ListActiveBreakpoints: retry[[2]string{"default", "idempotent"}],
UpdateActiveBreakpoint: retry[[2]string{"default", "idempotent"}],
}
}
示例8: defaultCallOptions
func defaultCallOptions() *CallOptions {
retry := map[[2]string][]gax.CallOption{
{"default", "idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.3,
})
}),
},
}
return &CallOptions{
SyncRecognize: retry[[2]string{"default", "idempotent"}],
AsyncRecognize: retry[[2]string{"default", "idempotent"}],
StreamingRecognize: retry[[2]string{"default", "non_idempotent"}],
}
}
示例9: defaultErrorStatsCallOptions
func defaultErrorStatsCallOptions() *ErrorStatsCallOptions {
retry := map[[2]string][]gax.CallOption{
{"default", "idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.3,
})
}),
},
}
return &ErrorStatsCallOptions{
ListGroupStats: retry[[2]string{"default", "idempotent"}],
ListEvents: retry[[2]string{"default", "idempotent"}],
DeleteEvents: retry[[2]string{"default", "idempotent"}],
}
}
示例10: defaultCallOptions
func defaultCallOptions() *CallOptions {
retry := map[[2]string][]gax.CallOption{
{"default", "idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 1000 * time.Millisecond,
Multiplier: 1.2,
})
}),
},
}
return &CallOptions{
PatchTraces: retry[[2]string{"default", "idempotent"}],
GetTrace: retry[[2]string{"default", "idempotent"}],
ListTraces: retry[[2]string{"default", "idempotent"}],
}
}
示例11: defaultCallOptions
func defaultCallOptions() *CallOptions {
retry := map[[2]string][]gax.CallOption{
{"default", "idempotent"}: {
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.3,
})
}),
},
}
return &CallOptions{
AnalyzeSentiment: retry[[2]string{"default", "idempotent"}],
AnalyzeEntities: retry[[2]string{"default", "idempotent"}],
AnalyzeSyntax: retry[[2]string{"default", "idempotent"}],
AnnotateText: retry[[2]string{"default", "idempotent"}],
}
}