Download this file
| 1 | package hostclaim |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "time" |
| 6 | ) |
| 7 | |
| 8 | func BeginSelectedCreate(nh NewHolder, body []byte, id, by string, now time.Time, box, enrollment, appID string, epoch uint64, ownershipEffect, recordEffect string) func(*Claim) error { |
| 9 | return func(c *Claim) error { |
| 10 | if !validBoxReference(box) || enrollment == "" || appID == "" || epoch == 0 || ownershipEffect == "" || recordEffect == "" || ownershipEffect == recordEffect { |
| 11 | return ErrMalformed |
| 12 | } |
| 13 | if err := BeginCreateOn(nh, body, id, by, now, ExecutorSelection{Box: box, Enrollment: enrollment})(c); err != nil { |
| 14 | return err |
| 15 | } |
| 16 | c.Op.Participants = []string{box} |
| 17 | c.Op.Intent["app_id"] = appID |
| 18 | c.Op.Intent["admission_epoch"] = fmt.Sprint(epoch) |
| 19 | c.Op.Intent["ownership_effect"] = ownershipEffect |
| 20 | c.Op.Intent["record_effect"] = recordEffect |
| 21 | return nil |
| 22 | } |
| 23 | } |
| 24 | |