carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package hostclaim
2
3func ToScopedParking(opID string, regions, boxes []string, newID func() string) func(*Claim) error {
4 return func(c *Claim) error {
5 if err := ToParking(opID, regions, boxes, newID)(c); err != nil {
6 return err
7 }
8 var staging []Obligation
9 for i := range c.Obligations {
10 o := &c.Obligations[i]
11 if o.Op != opID || o.Kind != "park-replica" || o.Park != nil || o.ParkTarget != c.Holder.Location {
12 continue
13 }
14 o.ParkTarget = c.Holder.Location
15 copy := *o
16 copy.ID = newID()
17 copy.Retirement = newID()
18 copy.ParkTarget = "moves/" + c.Host
19 staging = append(staging, copy)
20 }
21 c.Obligations = append(c.Obligations, staging...)
22 return nil
23 }
24}
25