Documentation
¶
Overview ¶
Package modelconfigurationpg stores deployment default model configurations in PostgreSQL.
Index ¶
- type Store
- func (s *Store) Delete(ctx context.Context, harness string) error
- func (s *Store) List(ctx context.Context) ([]modelconfiguration.Configuration, error)
- func (s *Store) LoadBundle(ctx context.Context, harness string) (modelconfiguration.Bundle, error)
- func (s *Store) ObserveDeploymentModelProvider(ctx context.Context, observation modelconfiguration.Observation) (int64, error)
- func (s *Store) Replace(ctx context.Context, record modelconfiguration.Record) (modelconfiguration.Configuration, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store keeps deployment defaults on pooled connections and seals and opens their bundles. It never uses the execution lease.
func New ¶
func New(pool *pgunit.Pool, cipher *credentialcrypto.Cipher) *Store
New returns a Store that seals and opens bundles with cipher.
func (*Store) Delete ¶
Delete removes the Harness's default, if any, and audits the request in the same transaction.
func (*Store) List ¶
func (s *Store) List(ctx context.Context) ([]modelconfiguration.Configuration, error)
List reads every default in Harness order without its sealed bundle.
func (*Store) LoadBundle ¶
LoadBundle reads the sealed bundle and its revision in one statement, so the pair always belongs to the same replacement, and opens the bundle.
func (*Store) ObserveDeploymentModelProvider ¶
func (s *Store) ObserveDeploymentModelProvider(ctx context.Context, observation modelconfiguration.Observation) (int64, error)
ObserveDeploymentModelProvider runs one metadata UPDATE in its own pooled transaction. The statement reads only committed state: the tenant's root Turn, its outcome, the Session's deployment source and the exact frozen revision. It locks only the matching default and samples the receipt time after that lock. The transaction sets server-side statement and lock timeouts, because client cancellation alone can leave PostgreSQL executing briefly after pgx has returned a deadline error.
func (*Store) Replace ¶
func (s *Store) Replace(ctx context.Context, record modelconfiguration.Record) (modelconfiguration.Configuration, error)
Replace seals the complete bundle to its Harness, upserts the record under a new revision, which clears the replaced revision's observations, and audits the write in the same transaction.