carlos / platform Public

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

Plain git — no account needed to clone.

Download

Download this file

1package activator
2
3import (
4 "context"
5 "time"
6
7 "github.com/carlosframework/platform/internal/registry"
8 "github.com/carlosframework/platform/internal/release"
9)
10
11// Plan 5 of the zero-downtime deploys work consumes these names. The index
12// fixes the first block; plans 1 to 4 fix the rest in their own documents
13// (the index's "Cross-plan interface ledger"). If this file does not
14// compile, a plan merged a different name, and plan 5 stops until it is
15// reconciled with that plan's owner.
16var (
17 _ func(*Service, string) (string, bool) = (*Service).AppSocket
18 _ func(*Service, context.Context, Attempt, func(string) uint64) SwapResult = (*Service).Swap
19 _ = Gen{N: 1, Socket: "", Control: "", Build: "", StagedPath: "", Digest: "", Demand: ""}
20 _ = Attempt{Host: "", Cause: CauseRelease, Build: "", StagedPath: "", Digest: "", Demand: "", Mode: ModeOverlap, ConfigRev: "", RestartID: "", SchedRev: 0, Canary: false}
21 _ = SwapResult{Outcome: SwapDone, Gen: Gen{}, Reason: "", Drain: time.Second}
22 _ = []SwapOutcome{SwapDone, SwapFailed, SwapAbandoned, SwapDown}
23 _ = []Cause{CauseRelease, CauseInstall, CauseRetry, CauseRestart, CauseConfig}
24 _ = []SwapMode{ModeOverlap, ModeHold}
25
26 _ func(bool) = SetGenerations // plan 1
27 _ func(*ExecBackend, context.Context, registry.Route, uint64) error = (*ExecBackend).KillGen // plan 2
28 _ func(*SplitBackend, context.Context, registry.Route, uint64) error = (*SplitBackend).KillGen // plan 2
29 _ SwapBackend = (*SplitBackend)(nil) // plan 3
30 _ genKiller = (*SplitBackend)(nil) // plan 3 Task 2 declares genKiller; plan 5 declares none
31 _ func(*Service, *actEntry, Attempt, func(string) uint64) error = (*Service).swapChecksLocked // plan 3
32 _ func(*Service, context.Context, registry.Route, Gen) (Proc, string, Gen, error) = (*Service).startPinned // plan 3
33 _ func(context.Context, Proc, time.Duration) settleResult = observeSettle // plan 3
34 _ = []settleResult{settleOK, settleExited, settleCancelled}
35 _ = []error{errSwapNotAwake, errSwapBusy, errSwapStopped} // plan 3
36 _ = StartPolicy{Pin: &Gen{}, Fallback: &Gen{}, HealthBy: time.Time{}} // plan 3
37
38 // Adapted: the plan pinned startWorker as returning (Proc,
39 // release.StagedIdentity, error) with no gate. Main
40 // (workerbuild.go:77) takes a gate and also returns a pendingGeneration.
41 _ func(*Service, context.Context, registry.Route, map[string]string, *release.StagedIdentity, func() error) (Proc, release.StagedIdentity, pendingGeneration, error) = (*Service).startWorker // plan 4
42 _ func(*Service, *actEntry, Proc, string, *release.StagedIdentity) = (*Service).respawnWorkerLocked // plan 4
43
44 // Added by the controller: later tasks build on these merged names.
45 _ func(*Service, context.Context, registry.Route, Gen, func() error, time.Time) (Proc, string, Gen, error) = (*Service).startPinnedAt // swaphold.go; plan 5 Task 9 added the health deadline
46 _ func(*Service, context.Context, *actEntry, registry.Route, Gen, Lease) (Proc, string, Gen, error) = (*Service).startPinnedChecked // swaphold.go
47 _ error = ErrBuildNotPublished // workerbuild.go
48 _ func(*Service) error = (*Service).persistGenerations // generations_file.go
49)
50
51// Fields plan 5 reads or sets.
52func _(a *Service, e *actEntry, w *wokenInstance, m *genMember, eb *ExecBackend) {
53 a.gens = true // plan 1
54 eb.GenContainment = true // plan 2
55 a.genHealth = func(context.Context, Gen) error { return nil } // plan 3, test seam
56 a.CoalesceRecycle = func(string) bool { return false } // plan 4
57 var _ Gen = e.gen // plan 1
58 var _ Gen = w.gen // plan 1
59 var _ *Gen = e.pin // plan 3
60 var _ *Gen = e.pinFailed // plan 3
61 var _ string = e.pinFailReason // plan 3
62 var _ map[uint64]*genMember = e.ops.members // plan 3
63 var _ Gen = m.gen // plan 3
64 var _ release.StagedIdentity = e.workerServing // plan 4
65 var _ chan struct{} = e.respawnDone // main
66 var _ string = a.GenerationsFile // generations_file.go
67}
68