Documentation
¶
Overview ¶
Package deploymentpg stores the sandbox deployment, its retained generations and its nodes in PostgreSQL. It seals the deployment's provider credential with the Core credential key, bound to the installation and generation.
Index ¶
- func ResetSource(d sqlc.RuntimeDeployment) (adminaudit.Source, error)
- type Execution
- func (e *Execution) ClearWake(ctx context.Context, allocationID string, observed time.Time) error
- func (e *Execution) WithAllocation(ctx context.Context, key deployment.AllocationKey, ...) error
- func (e *Execution) WithAllocationCleanup(ctx context.Context, key deployment.AllocationKey, ...) error
- func (e *Execution) WithDeployment(ctx context.Context, apply func(deployment.DeploymentTx) error) error
- func (e *Execution) WithReservation(ctx context.Context, key deployment.AllocationKey, ...) error
- type Store
- func (s *Store) Activity(ctx context.Context, allocationID string) (deployment.Activity, error)
- func (s *Store) AddressBindings(ctx context.Context, publicURL string) (deployment.AddressBindings, error)
- func (s *Store) Allocation(ctx context.Context, ref sandbox.Reference) (deployment.AllocationRecord, error)
- func (s *Store) ConnectNode(ctx context.Context, nodeID, connectionID string, epoch uint64) (bool, error)
- func (s *Store) CountComputeReservations(ctx context.Context, installationID string) (int64, error)
- func (s *Store) CountRetainedAllocations(ctx context.Context, installationID string) (int64, error)
- func (s *Store) CredentialAllocations(ctx context.Context, after string) ([]deployment.Allocation, error)
- func (s *Store) Deployment(ctx context.Context) (deployment.Record, error)
- func (s *Store) DisconnectNode(ctx context.Context, nodeID, connectionID string, epoch uint64) error
- func (s *Store) EnvironmentAllocation(ctx context.Context, key deployment.AllocationKey) (deployment.Allocation, error)
- func (s *Store) Generations(ctx context.Context, after int64) ([]deployment.GenerationRecord, error)
- func (s *Store) LifecycleAllocations(ctx context.Context, nodeID, after string) ([]deployment.Allocation, error)
- func (s *Store) LifecycleNodes(ctx context.Context) ([]string, error)
- func (s *Store) LifecyclePlacement(ctx context.Context, key deployment.AllocationKey) (deployment.LifecyclePlacement, error)
- func (s *Store) NodeAllocations(ctx context.Context, nodeID string) ([]deployment.NodeAllocation, error)
- func (s *Store) NodeHistory(ctx context.Context, nodeID string, window coremetrics.Range) (deployment.NodeRecord, []deployment.HostHistoryPoint, error)
- func (s *Store) NodeOnline(ctx context.Context, nodeID string) (bool, error)
- func (s *Store) Nodes(ctx context.Context) ([]deployment.NodeRecord, error)
- func (s *Store) ObservationSessions(ctx context.Context, after string, limit int) (deployment.ObservationSessionPage, error)
- func (s *Store) OwnerEpoch(ctx context.Context) (uint64, error)
- func (s *Store) ReadNodes(ctx context.Context, apply func(deployment.NodeReads) error) error
- func (s *Store) ResetSessions(ctx context.Context, after string, force bool) ([]deployment.ResetSession, error)
- func (s *Store) SampleHostHistory(ctx context.Context) (int64, error)
- func (s *Store) Snapshot(ctx context.Context) (deployment.Snapshot, error)
- func (s *Store) UnallocatedEnvironments(ctx context.Context, nodeID, after string) ([]deployment.UnallocatedEnvironment, error)
- func (s *Store) WithActivity(ctx context.Context, key deployment.AllocationKey, ...) error
- func (s *Store) WithNodes(ctx context.Context, apply func(deployment.NodeTx) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResetSource ¶
func ResetSource(d sqlc.RuntimeDeployment) (adminaudit.Source, error)
ResetSource decodes the administrator source that started the running reset from the stored deployment row. Audit entries the reset records later carry that source.
Types ¶
type Execution ¶
type Execution struct {
// contains filtered or unexported fields
}
Execution is the deployment storage of the execution owner: every transaction runs on the connection that holds the execution lease.
func NewExecution ¶
func NewExecution(lease *pgunit.Lease, cipher *credentialcrypto.Cipher) *Execution
NewExecution binds deployment changes to the execution lease.
func (*Execution) WithAllocation ¶
func (e *Execution) WithAllocation(ctx context.Context, key deployment.AllocationKey, apply func(deployment.AllocationTx) error) error
func (*Execution) WithAllocationCleanup ¶
func (e *Execution) WithAllocationCleanup(ctx context.Context, key deployment.AllocationKey, apply func(deployment.AllocationCleanupTx) error) error
func (*Execution) WithDeployment ¶
func (e *Execution) WithDeployment(ctx context.Context, apply func(deployment.DeploymentTx) error) error
func (*Execution) WithReservation ¶
func (e *Execution) WithReservation(ctx context.Context, key deployment.AllocationKey, apply func(sessions.LockedSession, deployment.ReservationTx) error) error
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the deployment storage and reader on pooled connections. It grants no execution authority.
func New ¶
func New(pool *pgunit.Pool, cipher *credentialcrypto.Cipher) *Store
New returns the deployment store. cipher is nil when Core has no credential key; a stored credential then reads as credentialcrypto.ErrUnavailable.
func (*Store) AddressBindings ¶
func (s *Store) AddressBindings(ctx context.Context, publicURL string) (deployment.AddressBindings, error)
func (*Store) Allocation ¶
func (s *Store) Allocation(ctx context.Context, ref sandbox.Reference) (deployment.AllocationRecord, error)
func (*Store) ConnectNode ¶
func (*Store) CountComputeReservations ¶
func (*Store) CountRetainedAllocations ¶
func (*Store) CredentialAllocations ¶
func (s *Store) CredentialAllocations(ctx context.Context, after string) ([]deployment.Allocation, error)
func (*Store) Deployment ¶
Deployment bounds its read by the execution deadline: the execution owner reads the setup through it before provider work.
func (*Store) DisconnectNode ¶
func (*Store) EnvironmentAllocation ¶
func (s *Store) EnvironmentAllocation(ctx context.Context, key deployment.AllocationKey) (deployment.Allocation, error)
func (*Store) Generations ¶
func (s *Store) Generations(ctx context.Context, after int64) ([]deployment.GenerationRecord, error)
func (*Store) LifecycleAllocations ¶
func (s *Store) LifecycleAllocations(ctx context.Context, nodeID, after string) ([]deployment.Allocation, error)
func (*Store) LifecycleNodes ¶
func (*Store) LifecyclePlacement ¶
func (s *Store) LifecyclePlacement(ctx context.Context, key deployment.AllocationKey) (deployment.LifecyclePlacement, error)
func (*Store) NodeAllocations ¶
func (s *Store) NodeAllocations(ctx context.Context, nodeID string) ([]deployment.NodeAllocation, error)
func (*Store) NodeHistory ¶
func (s *Store) NodeHistory(ctx context.Context, nodeID string, window coremetrics.Range) (deployment.NodeRecord, []deployment.HostHistoryPoint, error)
func (*Store) NodeOnline ¶
func (*Store) Nodes ¶
func (s *Store) Nodes(ctx context.Context) ([]deployment.NodeRecord, error)
func (*Store) ObservationSessions ¶
func (s *Store) ObservationSessions(ctx context.Context, after string, limit int) (deployment.ObservationSessionPage, error)
func (*Store) ResetSessions ¶
func (s *Store) ResetSessions(ctx context.Context, after string, force bool) ([]deployment.ResetSession, error)
func (*Store) SampleHostHistory ¶
func (*Store) UnallocatedEnvironments ¶
func (s *Store) UnallocatedEnvironments(ctx context.Context, nodeID, after string) ([]deployment.UnallocatedEnvironment, error)
func (*Store) WithActivity ¶
func (s *Store) WithActivity(ctx context.Context, key deployment.AllocationKey, apply func(sessions.LockedSession, deployment.ActivityTx) error) error