carlos / platform Public

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

Plain git — no account needed to clone.

Download

Download this file

1package console
2
3import (
4 "github.com/carlosframework/platform/internal/boxchoice"
5)
6
7// The box eligibility predicate and the choice live in internal/boxchoice,
8// the contract console and moves share. These names keep console's own
9// vocabulary.
10type (
11 boxCandidate = boxchoice.Candidate
12 rosterBox = boxchoice.RosterBox
13 boxLoad = boxchoice.Load
14)
15
16// eligibleBoxes is boxchoice.Eligible on console's edges snapshot. The
17// snapshot is complete only when both its files and its liveness are
18// (edgesfile.Snapshot.EvidenceComplete).
19func eligibleBoxes(snap edgesSnapshot, roster map[string]rosterBox, placement, awsRegion, homeName, expectedFP string, lost map[string]bool) []boxCandidate {
20 return boxchoice.Eligible(boxSnapshot(snap), roster, placement, awsRegion, homeName, expectedFP, lost)
21}
22
23// boxSnapshot is edgesfile.Snapshot.BoxChoice.
24func boxSnapshot(snap edgesSnapshot) boxchoice.Snapshot { return snap.BoxChoice() }
25
26// chooseBox is boxchoice.Choose.
27func chooseBox(host string, cands []boxCandidate, running map[string]boxLoad, app string) (boxCandidate, bool) {
28 return boxchoice.Choose(host, cands, running, app)
29}
30