mesh/check failed: unit: git.novox.be/novox/mesh-sdk/go/process.TestStatePutWritesAKeyWhole: a Put through a short blackout: 0, mesh-mail's state send…
mesh/delivery-group group feat/sdk1 rejected: composed together: the checker's verdict at the members' heads (428d048dd50a): unit: git.novox.be/novox/mesh-sdk/…
mesh/delivery closed: a newer head of the same pull request
Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
62 lines
2.7 KiB
Go
62 lines
2.7 KiB
Go
package catalogue
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
// KeptBinding is one consumer this resolution would have moved, and did not.
|
|
type KeptBinding struct {
|
|
// Machine is where the consumer runs, and Consumer the module there that is bound.
|
|
Machine string
|
|
Consumer string
|
|
// Provision is what it is bound for.
|
|
Provision string
|
|
// Bound is the provider it was recorded at, and still is; Would is the one the resolution chose.
|
|
Bound Chosen
|
|
Would Chosen
|
|
}
|
|
|
|
// String is the condition's sentence: the move, where the data is, and the act that confirms it.
|
|
func (k KeptBinding) String() string {
|
|
return fmt.Sprintf("would move %s's %s from %s to %s — its data is on %s; kept there. "+
|
|
"`pin %s %s %s %s` to confirm a move (and move the data first)",
|
|
k.Consumer, k.Provision, k.Bound, k.Would, k.Bound, k.Machine, k.Provision, k.Would.Node, k.Would.Module)
|
|
}
|
|
|
|
// Unbound is one consumer that still asks for a provision and whose own resolution binds it to
|
|
// another provider than the one a pair credential on record was made with (novox/hq issue 274).
|
|
//
|
|
// **A provider is granted exactly the consumers bound to it.** The credential from the old provider
|
|
// stays on record — it is the key to a login that provider keeps, disabled, with the consumer's data,
|
|
// until a person deletes it with `cleanup delete` (ADR 0230), and a pin back must find it — but it is
|
|
// no longer granted, so the provider stops being asked for it and retires it. Said on every plan and
|
|
// push of the provider, so a credential the mesh keeps and does not use is never kept silently.
|
|
type Unbound struct {
|
|
// Provision is what was required, Provider the machine the credential on record is from.
|
|
Provision string `json:"provision"`
|
|
Provider string `json:"provider"`
|
|
// Consumer is the machine, Module the module on it that requires it, Local the credential's
|
|
// name inside it where it keeps several (ADR 0094).
|
|
Consumer string `json:"consumer"`
|
|
Module string `json:"module"`
|
|
Local string `json:"local,omitempty"`
|
|
// BoundTo is every provider the consumer's resolution binds this credential to now; empty when
|
|
// it binds it nowhere — the module asks for the provision under other local names.
|
|
BoundTo []string `json:"bound_to,omitempty"`
|
|
}
|
|
|
|
func (u Unbound) String() string {
|
|
who := u.Module
|
|
if u.Local != "" {
|
|
who += " (as " + u.Local + ")"
|
|
}
|
|
now := "is bound to no provider under that name"
|
|
if len(u.BoundTo) > 0 {
|
|
now = "is bound to " + strings.Join(u.BoundTo, ", ")
|
|
}
|
|
return fmt.Sprintf("%s on %s %s for %s, not to %s — %s no longer grants it, so it retires that "+
|
|
"login and keeps its data until `cleanup delete` (ADR 0230); the credential from %s stays on "+
|
|
"record while that login does", who, u.Consumer, now, u.Provision, u.Provider, u.Provider, u.Provider)
|
|
}
|