Documentation
¶
Overview ¶
Package pool is the domain layer for the Pool entity: an ordered set of one host's keys, listed one by one or as whole provider accounts, plus the selection algorithm that picks among them. Policies link pools; many policies may draw on one pool, and nothing in a pool is reserved for any of them.
This package validates one row's shape, fills its defaults, and stores it. Out of scope: picking a key per request (app/keypool), checking that every key belongs to the pool's host (app/refcheck), and spend caps, which belong on the account.
Index ¶
Constants ¶
const DefaultSelection = keypool.KeySelectionPrioritized
DefaultSelection is the selection a pool that names none uses.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct {
Meta meta.Metadata `json:"metadata" yaml:"metadata"`
Spec Spec `json:"spec" yaml:"spec"`
}
Pool is a set of host keys at one host.
func (*Pool) Default ¶
func (p *Pool) Default()
Default fills the fields a wire form may omit, so a stored row and the manifest that declared it converge. Nil receiver is a no-op.
func (*Pool) Validate ¶
Validate runs intra-row rules via the shared meta.Validator and enforces:
- an owner of kind system, organization, team, project or user; team and project owners carry an id, an organization owner none.
- no key and no account listed twice.
Cross-row checks (the host exists; every key and account exists and is at that host) live in app/refcheck.
type Spec ¶
type Spec struct {
// HostID is the one host every key in the pool authenticates to.
HostID string `json:"hostId" yaml:"hostId" validate:"required,uuid" doc:"Id of the one host every key in the pool authenticates to."`
// AccountIDs are provider accounts the pool draws on whole: each contributes every key it holds now or later, a shared account the keys of its real account. They come before CredentialIDs in prioritized order.
AccountIDs []string `` /* 493-byte string literal not displayed */
// CredentialIDs are the pool's host keys. Order is the preference for prioritized selection. Empty is valid: deleting a key removes it from every pool, which may leave one empty.
CredentialIDs []string `` /* 247-byte string literal not displayed */
Selection keypool.KeySelection `` /* 354-byte string literal not displayed */
}
Spec names the host, its keys, and how a key is picked.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds a DB rather than Queries so Upsert can run a multi-table transaction.
func (*Store) Delete ¶
Delete removes a Pool by id and its credential and account rows. A policy linking it keeps the id, so it narrows rather than widens.