(ctx context.Context, resources ...*gateway.SubscribeRelease)
| 31 | } |
| 32 | |
| 33 | func (s *SubscribeClient) Offline(ctx context.Context, resources ...*gateway.SubscribeRelease) error { |
| 34 | s.client.Begin(ctx) |
| 35 | var err error |
| 36 | for _, r := range resources { |
| 37 | err = s.client.HDel(ctx, fmt.Sprintf("%s:%s", KeySubscribeService, r.Application), r.Service) |
| 38 | if err != nil { |
| 39 | s.client.Rollback(ctx) |
| 40 | return err |
| 41 | } |
| 42 | } |
| 43 | return s.client.Commit(ctx) |
| 44 | } |
| 45 | |
| 46 | func NewSubscribeClient(client admin_client.Client) *SubscribeClient { |
| 47 | return &SubscribeClient{client: client} |