MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / Online

Method Online

gateway/apinto/dynamic.go:70–92  ·  view source on GitHub ↗
(ctx context.Context, resources ...*gateway.DynamicRelease)

Source from the content-addressed store, hash-verified

68}
69
70func (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
94func (d *DynamicClient) Offline(ctx context.Context, resources ...*gateway.DynamicRelease) error {
95 err := d.client.Begin(ctx)

Callers

nothing calls this directly

Calls 6

NewWorkerItemFunction · 0.92
genWorkerIDFunction · 0.85
BeginMethod · 0.65
SetMethod · 0.65
RollbackMethod · 0.65
CommitMethod · 0.65

Tested by

no test coverage detected