postgres

package
v0.0.0-...-b6fd3ca Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout         = 5 * time.Second
	DefaultCleanupInterval = 10 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresProvider

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

func NewPostgresProvider

func NewPostgresProvider(log *slog.Logger, postgresOpts PostgresProviderOptions, providerConfig components.ProviderConfig) (*PostgresProvider, error)

func (*PostgresProvider) DeleteAlarm

func (p *PostgresProvider) DeleteAlarm(ctx context.Context, ref ref.AlarmRef) error

func (*PostgresProvider) DeleteLeasedAlarm

func (p *PostgresProvider) DeleteLeasedAlarm(ctx context.Context, lease *ref.AlarmLease) error

func (*PostgresProvider) DeleteState

func (p *PostgresProvider) DeleteState(ctx context.Context, ref ref.ActorRef) error

func (*PostgresProvider) FetchAndLeaseUpcomingAlarms

func (p *PostgresProvider) FetchAndLeaseUpcomingAlarms(ctx context.Context, req components.FetchAndLeaseUpcomingAlarmsReq) ([]*ref.AlarmLease, error)

func (*PostgresProvider) GetAlarm

func (p *PostgresProvider) GetAlarm(ctx context.Context, req ref.AlarmRef) (res components.GetAlarmRes, err error)

func (*PostgresProvider) GetLeasedAlarm

func (p *PostgresProvider) GetLeasedAlarm(ctx context.Context, lease *ref.AlarmLease) (res components.GetLeasedAlarmRes, err error)

func (*PostgresProvider) GetState

func (p *PostgresProvider) GetState(ctx context.Context, ref ref.ActorRef) (data []byte, err error)

func (*PostgresProvider) HealthCheckInterval

func (p *PostgresProvider) HealthCheckInterval() time.Duration

func (*PostgresProvider) Init

func (p *PostgresProvider) Init(ctx context.Context) error

func (*PostgresProvider) LookupActor

func (*PostgresProvider) RegisterHost

func (*PostgresProvider) ReleaseAlarmLease

func (p *PostgresProvider) ReleaseAlarmLease(ctx context.Context, lease *ref.AlarmLease) error

func (*PostgresProvider) RemoveActor

func (p *PostgresProvider) RemoveActor(ctx context.Context, ref ref.ActorRef) error

func (*PostgresProvider) RenewAlarmLeases

func (*PostgresProvider) RenewLeaseInterval

func (p *PostgresProvider) RenewLeaseInterval() time.Duration

func (*PostgresProvider) Run

func (p *PostgresProvider) Run(ctx context.Context) error

func (*PostgresProvider) SetAlarm

func (*PostgresProvider) SetState

func (p *PostgresProvider) SetState(ctx context.Context, ref ref.ActorRef, data []byte, opts components.SetStateOpts) error

func (*PostgresProvider) UnregisterHost

func (p *PostgresProvider) UnregisterHost(ctx context.Context, hostID string) error

func (*PostgresProvider) UpdateActorHost

func (p *PostgresProvider) UpdateActorHost(ctx context.Context, hostID string, req components.UpdateActorHostReq) error

func (*PostgresProvider) UpdateLeasedAlarm

func (p *PostgresProvider) UpdateLeasedAlarm(ctx context.Context, lease *ref.AlarmLease, req components.UpdateLeasedAlarmReq) (err error)

type PostgresProviderOptions

type PostgresProviderOptions struct {
	components.ProviderOptions

	// Connection string for the Postgres database
	// This allows the provider to establish a new database connection
	ConnectionString string

	// Connection to an existing database
	DB *pgxpool.Pool

	// Timeout for requests to the database
	Timeout time.Duration

	// Interval at which to perform garbage collection
	CleanupInterval time.Duration
	// contains filtered or unexported fields
}

func (PostgresProviderOptions) GetPgxPoolConfig

func (o PostgresProviderOptions) GetPgxPoolConfig() (*pgxpool.Config, error)

GetPgxPoolConfig parses the database connection string and returns the pgxpool.Config object

Jump to

Keyboard shortcuts

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