feat: add generic queue and subscription retirement
This commit is contained in:
@@ -196,6 +196,17 @@ func (s *Service) ConfigureQueue(ctx context.Context, token auth.Token, id core.
|
||||
return s.store.ConfigureQueue(ctx, token, id, key, in)
|
||||
}
|
||||
|
||||
// RetireQueue 只关闭已结清的通用资源,不删除任务、交付或审计。
|
||||
func (s *Service) RetireQueue(ctx context.Context, t auth.Token, id core.ID, key string, in RetireQueueInput) (QueueResult, error) {
|
||||
if err := ValidateKey(key); err != nil {
|
||||
return QueueResult{}, err
|
||||
}
|
||||
if id.Validate() != nil || in.ExpectedRevision == 0 || strings.TrimSpace(in.Reason) == "" || !utf8.ValidString(in.Reason) || utf8.RuneCountInString(in.Reason) > 1024 {
|
||||
return QueueResult{}, fault.Invalid("queue id, revision and reason are required")
|
||||
}
|
||||
return s.store.RetireQueue(ctx, t, id, key, in)
|
||||
}
|
||||
|
||||
// ValidateConcurrencyKey 不归一化资源键,字节精确相等才共享许可。
|
||||
func ValidateConcurrencyKey(key string) error {
|
||||
if key == "" {
|
||||
|
||||
Reference in New Issue
Block a user