carlos / platform Public

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

Plain git — no account needed to clone.

Download

Download this file

1package hostops
2
3import (
4 "time"
5
6 "github.com/carlosframework/platform/internal/hostbox"
7 "github.com/carlosframework/platform/internal/hostclaim"
8)
9
10func retirementScope(host, incarnation, target string, refs map[string]hostclaim.RetirementEvidenceRef) (hostclaim.ParkScope, error) {
11 if target == "" || len(refs) == 0 {
12 return hostclaim.ParkScope{}, ErrPending
13 }
14 var latest time.Time
15 for box, ref := range refs {
16 if ref.Box != box || ref.EvidenceAt.IsZero() {
17 return hostclaim.ParkScope{}, ErrIdentity
18 }
19 if ref.EvidenceAt.After(latest) {
20 latest = ref.EvidenceAt
21 }
22 }
23 scope := hostclaim.ParkScope{Location: target, Incarnation: incarnation, EvidenceAt: latest, RequestLimit: hostbox.RequestLimit}
24 return scope, scope.Validate(host)
25}
26