carlos / platform Public

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

Plain git — no account needed to clone.

Download

Download this file

1package host
2
3import (
4 "github.com/carlosframework/platform/internal/hostbox"
5 "github.com/carlosframework/platform/internal/hostguard"
6 "github.com/carlosframework/platform/internal/registry"
7)
8
9// relocationSourceRows sets the box's Reconciler hooks for region HA
10// §5.3 (R5-3, Task 10b), with CARLOS_REGION_HA on only: FenceClosed reads
11// this box's admission fence for the host from the host guard
12// (hostbox.AdmissionFenceClosed), and HoldRow holds the row for the op in
13// "relocating" (hostbox.RegistryHoldRow). The source in releasing is then
14// held at its fence's close, and every other relocating participant keeps
15// an existing row held. A source whose reconcile is delayed past the
16// completion is held then, for the completed op, by reconcile's catch-up
17// hold while it owes that op's park-local (L18 joint round, finding 3).
18// Nothing here releases a source's hold: the fenced installation never
19// serves again, so the completion queues the source's park-local
20// (hostclaim.CompleteRelocation), whose retirement deletes the row by
21// ownership, held or not. With the flag off both hooks
22// stay nil and reconcile is main's: Serving alone, which refuses every
23// relocating claim with every row unchanged.
24func relocationSourceRows(getenv func(string) string, r *hostbox.Reconciler, guard hostguard.Guard, reg *registry.Registry) {
25 if r == nil {
26 return
27 }
28 r.FenceClosed, r.HoldRow = nil, nil
29 if getenv == nil || !regionHAEnabled(getenv) {
30 return
31 }
32 r.FenceClosed = hostbox.AdmissionFenceClosed(guard)
33 r.HoldRow = hostbox.RegistryHoldRow(reg)
34}
35