Help us shape the future of Go! Take the 2026 Go Developer Survey

postgres

package
v0.0.0-...-0290435 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(ctx context.Context, database *sql.DB) error

func OpenDatabase

func OpenDatabase(
	ctx context.Context, databaseURL string, maxOpenConnections, maxIdleConnections int,
) (*sql.DB, error)

OpenDatabase configures both query and dedicated lock pools. Raw pgx connections reserved for LISTEN inherit the same driver tracer.

Types

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

func New

func New(database, lockDatabase *sql.DB, retention time.Duration, maxRows int64) (*Repository, error)

func (*Repository) AdmitSkillPreparation

func (r *Repository) AdmitSkillPreparation(ctx context.Context, input skillset.PrepareRequest) (skillset.PreparationReceipt, error)

AdmitSkillPreparation records an intent independently of Environment and lifecycle mutation locks. It does not perform downloads or Docker I/O.

func (*Repository) AppendObservation

func (r *Repository) AppendObservation(
	ctx context.Context, epoch repository.ObservationEpoch, observation deployment.Observation,
) (deployment.Observation, error)

func (*Repository) BeginTransition

func (r *Repository) BeginTransition(
	ctx context.Context, candidate deployment.Operation,
) (deployment.Operation, bool, error)

func (*Repository) CheckpointSkillPackage

func (r *Repository) CheckpointSkillPackage(ctx context.Context, setID int64, worker string, skill skillset.FrozenSkill, pkg skillset.Package, now time.Time) error

func (*Repository) ClaimSkillCleanup

func (r *Repository) ClaimSkillCleanup(ctx context.Context, scope, worker string, now time.Time, lease time.Duration) (*skillset.CleanupJob, error)

func (*Repository) ClaimSkillPreparation

func (r *Repository) ClaimSkillPreparation(ctx context.Context, scope, worker string, now time.Time, lease time.Duration, capacity int) (*skillset.PreparationJob, error)

ClaimSkillPreparation serializes the global concurrency budget across RC replicas, then leases one persistent set. Expired leases retain package checkpoints and the same physical volume identity.

func (*Repository) CompleteOperation

func (r *Repository) CompleteOperation(
	ctx context.Context,
	operation deployment.Operation,
	observation *deployment.Observation,
) (*deployment.Observation, error)

func (*Repository) CompleteSkillCleanup

func (r *Repository) CompleteSkillCleanup(ctx context.Context, setID int64, worker string, now time.Time) error

func (*Repository) CompleteSkillPreparation

func (r *Repository) CompleteSkillPreparation(ctx context.Context, setID int64, worker, manifestDigest string, now time.Time) error

func (*Repository) FindRegistration

func (r *Repository) FindRegistration(ctx context.Context, scope, member, incarnation string) (*acpincarnation.Record, error)

func (*Repository) GenerationClaim

func (r *Repository) GenerationClaim(
	ctx context.Context, key deployment.Key,
) (repository.GenerationClaim, error)

func (*Repository) GenerationOperation

func (r *Repository) GenerationOperation(ctx context.Context, key deployment.Key) (deployment.Operation, error)

func (*Repository) GetEnvironment

func (r *Repository) GetEnvironment(
	ctx context.Context, agentID string,
) (deployment.Environment, error)

func (*Repository) GetOperation

func (r *Repository) GetOperation(
	ctx context.Context, requestID string,
) (deployment.Operation, error)

func (*Repository) GetRegistration

func (r *Repository) GetRegistration(ctx context.Context, scope, id string) (*acpincarnation.Record, error)

func (*Repository) GetSkillPreparation

func (r *Repository) GetSkillPreparation(ctx context.Context, scope, organizationID, agentID, requestID string) (skillset.PreparationReceipt, error)

func (*Repository) ListEnvironments

func (r *Repository) ListEnvironments(
	ctx context.Context,
) (result []deployment.Environment, resultErr error)

func (*Repository) ListObservations

func (r *Repository) ListObservations(
	ctx context.Context, after uint64, limit int,
) (deployment.ObservationWindow, error)

func (*Repository) ListenObservationNotifications

func (r *Repository) ListenObservationNotifications(
	ctx context.Context, ready func(), notify func(string),
) (resultErr error)

func (*Repository) MarkDriftedReadySkillVolume

func (r *Repository) MarkDriftedReadySkillVolume(ctx context.Context, prepared skillset.PreparedMaterialization) error

MarkDriftedReadySkillVolume fences an owned but corrupt ready collection before the cleanup worker removes it. Existing logical preparation requests remain durable and will observe queued again after cleanup settles.

func (*Repository) MaxClaimedGeneration

func (r *Repository) MaxClaimedGeneration(ctx context.Context, agentID string) (uint64, error)

func (*Repository) ObservationMonitorReady

func (r *Repository) ObservationMonitorReady(ctx context.Context) (ready bool, resultErr error)

func (*Repository) PostponeSkillCleanup

func (r *Repository) PostponeSkillCleanup(ctx context.Context, setID int64, worker string, now time.Time, delay time.Duration, code string) error

func (*Repository) ProbeObservationJournal

func (r *Repository) ProbeObservationJournal(ctx context.Context) error

func (*Repository) ProbeObservationNotification

func (r *Repository) ProbeObservationNotification(ctx context.Context, payload string) error

func (*Repository) PruneObservationBatch

func (r *Repository) PruneObservationBatch(ctx context.Context, epoch repository.ObservationEpoch) (int64, error)

func (*Repository) ReadRegistrationHistory

func (r *Repository) ReadRegistrationHistory(ctx context.Context, scope, member string, cursor *acpincarnation.HistoryCursor) (acpincarnation.HistoryPage, error)

func (*Repository) Ready

func (r *Repository) Ready(ctx context.Context) error

func (*Repository) RecordStopped

func (r *Repository) RecordStopped(ctx context.Context, scope, id string, expected acpincarnation.Binding, candidate acpincarnation.StopReceipt) (acpincarnation.Record, error)

func (*Repository) RegisterVerified

func (r *Repository) RegisterVerified(ctx context.Context, candidate acpincarnation.Record) (acpincarnation.Record, error)

func (*Repository) ReleaseSkillPreparation

func (r *Repository) ReleaseSkillPreparation(ctx context.Context, scope, organizationID, agentID, requestID, ownerOperationID string) error

func (*Repository) RenewSkillPreparation

func (r *Repository) RenewSkillPreparation(ctx context.Context, setID int64, worker string, now time.Time, lease time.Duration) error

func (*Repository) ResetMissingReadySkillVolume

func (r *Repository) ResetMissingReadySkillVolume(ctx context.Context, prepared skillset.PreparedMaterialization) error

ResetMissingReadySkillVolume replaces a physically absent collection only when no active Runtime or accepted lifecycle operation references that set. A running source Runtime may use another set while the missing Rebuild target is rematerialized. Old operation/current-reference snapshots stay immutable.

func (*Repository) ResetMissingSkillVolume

func (r *Repository) ResetMissingSkillVolume(ctx context.Context, setID int64, worker string, now time.Time) error

ResetMissingSkillVolume abandons only a proven missing physical identity. The immutable logical set and its operation references survive; the next claim uses a new materialization and downloads a fresh candidate volume.

func (*Repository) ResolvePreparedSkillSet

func (r *Repository) ResolvePreparedSkillSet(ctx context.Context, reference skillset.PreparedReference) (skillset.PreparedMaterialization, error)

ResolvePreparedSkillSet is a read-only preflight. BeginTransition must repeat the same check and retain the selected materialization in its transaction; this read alone does not protect against a concurrent release or deletion.

func (*Repository) SetSkillPreparationFailure

func (r *Repository) SetSkillPreparationFailure(ctx context.Context, setID int64, worker string, state skillset.PreparationState, errorCode string, retryAfter *time.Time, now time.Time) error

func (*Repository) TryAcquireObservationLeadership

func (r *Repository) TryAcquireObservationLeadership(
	ctx context.Context,
) (repository.Leadership, bool, error)

func (*Repository) WithAgentLock

func (r *Repository) WithAgentLock(
	ctx context.Context, agentID string, execute func(context.Context) error,
) (resultErr error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL