(ctx context.Context, resources ...*gateway.DynamicRelease)
| 68 | } |
| 69 | |
| 70 | func (d *DynamicClient) Online(ctx context.Context, resources ...*gateway.DynamicRelease) error { |
| 71 | err := d.client.Begin(ctx) |
| 72 | if err != nil { |
| 73 | return err |
| 74 | } |
| 75 | for _, r := range resources { |
| 76 | id := genWorkerID(r.ID, d.profession) |
| 77 | worker := entity.NewWorkerItem[map[string]interface{}](&entity.BasicInfo{ |
| 78 | ID: id, |
| 79 | Name: r.ID, |
| 80 | Description: r.Description, |
| 81 | Driver: d.driver, |
| 82 | Version: r.Version, |
| 83 | Matches: r.MatchLabels, |
| 84 | }, &r.Attr) |
| 85 | err = d.client.Set(ctx, id, worker) |
| 86 | if err != nil { |
| 87 | d.client.Rollback(ctx) |
| 88 | return err |
| 89 | } |
| 90 | } |
| 91 | return d.client.Commit(ctx) |
| 92 | } |
| 93 | |
| 94 | func (d *DynamicClient) Offline(ctx context.Context, resources ...*gateway.DynamicRelease) error { |
| 95 | err := d.client.Begin(ctx) |
nothing calls this directly
no test coverage detected