| 48 | } |
| 49 | |
| 50 | func (d *DynamicClient) Versions(ctx context.Context, matchLabels map[string]string) (map[string]string, error) { |
| 51 | workers, err := d.client.MatchLabels(ctx, d.profession, matchLabels) |
| 52 | if err != nil { |
| 53 | if errors.Is(err, proto.Nil) { |
| 54 | return nil, nil |
| 55 | } |
| 56 | return nil, err |
| 57 | } |
| 58 | versions := make(map[string]string) |
| 59 | for _, worker := range workers { |
| 60 | var item entity.BasicInfo |
| 61 | err = worker.Scan(encoding.Json[entity.BasicInfo](&item)) |
| 62 | if err != nil { |
| 63 | return nil, err |
| 64 | } |
| 65 | versions[item.Name] = item.Version |
| 66 | } |
| 67 | return versions, nil |
| 68 | } |
| 69 | |
| 70 | func (d *DynamicClient) Online(ctx context.Context, resources ...*gateway.DynamicRelease) error { |
| 71 | err := d.client.Begin(ctx) |