Documentation
¶
Overview ¶
Package state coordinates immutable inventory publication and MCP operation admission. Persistence belongs to the host; no network or database I/O is performed while the publication lock is held.
Index ¶
- Variables
- type Change
- type Coordinator
- func (c *Coordinator) BeginUpdate(ctx context.Context, expected string, next ports.OperationSnapshot) (*Update, error)
- func (c *Coordinator) Close() error
- func (c *Coordinator) DomainID() string
- func (c *Coordinator) Enter(ctx context.Context, admission ports.Admission) (ports.Permit, error)
- func (c *Coordinator) List(ctx context.Context, query ports.NodeQuery) (ports.InventorySnapshot, error)
- func (c *Coordinator) Pending() bool
- func (c *Coordinator) Resolve(ctx context.Context, request ports.ResolveRequest) (ports.OperationSnapshot, error)
- func (c *Coordinator) Snapshot() ports.OperationSnapshot
- type Options
- type Retire
- type Update
Constants ¶
This section is empty.
Variables ¶
var ( ErrUpdating = errors.New("affected inventory is being published") ErrConflict = errors.New("inventory revision conflict") ErrClosed = errors.New("inventory coordinator is closed") ErrPersistenceUnknown = errors.New("persistence may have committed; reload before releasing admission") ErrUpdateState = errors.New("inventory update state does not permit this operation") ErrIdentityReuse = errors.New("deleted node identity cannot be reused") ErrCapacity = errors.New("operation admission capacity exhausted") )
Functions ¶
This section is empty.
Types ¶
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
func New ¶
func New(initial ports.OperationSnapshot, options Options) (*Coordinator, error)
func (*Coordinator) BeginUpdate ¶
func (c *Coordinator) BeginUpdate(ctx context.Context, expected string, next ports.OperationSnapshot) (*Update, error)
BeginUpdate reserves the complete candidate before external persistence. Only one update can persist at a time; unrelated node operations continue.
func (*Coordinator) Close ¶
func (c *Coordinator) Close() error
func (*Coordinator) DomainID ¶
func (c *Coordinator) DomainID() string
func (*Coordinator) List ¶
func (c *Coordinator) List(ctx context.Context, query ports.NodeQuery) (ports.InventorySnapshot, error)
func (*Coordinator) Pending ¶
func (c *Coordinator) Pending() bool
func (*Coordinator) Resolve ¶
func (c *Coordinator) Resolve(ctx context.Context, request ports.ResolveRequest) (ports.OperationSnapshot, error)
func (*Coordinator) Snapshot ¶
func (c *Coordinator) Snapshot() ports.OperationSnapshot
Snapshot is an administrative view. It can include a committed publication whose activation is still blocked; Pending reports that distinction.
type Retire ¶
type Retire func(context.Context, []ssh.ConnectionPlan) error
Retire must stop reuse of the supplied old connection generations. It runs outside the publication lock while affected admission remains blocked. Implementations must honor ctx; retry after a failure must be idempotent.
type Update ¶
type Update struct {
// contains filtered or unexported fields
}
func (*Update) BeginPersistence ¶
BeginPersistence marks the point after which an error may mean a committed write. Call it before sending a database commit; Abort then fails closed.
func (*Update) ConfirmCommit ¶
ConfirmCommit records an authoritative successful transaction (or a host's explicit in-memory publication). It does not release admission.
func (*Update) ConfirmRollback ¶
ConfirmRollback is used only after the host has proved the write did not apply. It cannot undo a known commit or a partially activated publication.