postgres

package
v0.0.0-...-98211a5 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: ISC Imports: 18 Imported by: 0

Documentation

Overview

Package postgres is a store.Store in PostgreSQL, shared by the almanacs of one deployment and separated by almanac.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(ctx context.Context, pool *pgxpool.Pool) error

Migrate brings the store's schema up to date. It is safe to call from several processes at once.

Types

type Store

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

Store is one almanac's state in PostgreSQL.

func Connect

func Connect(ctx context.Context, url, almanac string) (*Store, error)

Connect reaches the database at url, brings the schema up to date, and returns almanac's state in it. Close the store when done with it.

func New

func New(pool *pgxpool.Pool, almanac string) *Store

New is almanac's state in the database pool reaches. The schema must already be up to date: see Migrate. Several stores may share one pool.

func (*Store) Admit

func (s *Store) Admit(ctx context.Context, source, deliveryID string, admission store.Admission) (store.Ingest, error)

Admit implements store.Store.

func (*Store) Claim

func (s *Store) Claim(ctx context.Context, request store.ClaimRequest) (store.Claim, error)

Claim implements store.Store.

func (*Store) Close

func (s *Store) Close()

Close closes the store's pool.

func (*Store) Delivered

func (s *Store) Delivered(ctx context.Context, key string) error

Delivered implements store.Store.

func (*Store) DeliveryFailed

func (s *Store) DeliveryFailed(ctx context.Context, key, reason string, giveUp int) error

DeliveryFailed implements store.Store. The reason is kept with the entry; a U+0000 in it, which PostgreSQL's text refuses, becomes U+FFFD.

func (*Store) Note

func (s *Store) Note(ctx context.Context, key string, value json.RawMessage, mode effect.Mode) error

Note implements store.Store.

func (*Store) Outbox

func (s *Store) Outbox(ctx context.Context, runID string) ([]store.Entry, error)

Outbox implements store.Store.

func (*Store) Ready

func (s *Store) Ready(ctx context.Context) error

Ready is nil when the database answers.

func (*Store) Record

func (s *Store) Record(ctx context.Context, runID, name string, occurrence int, value json.RawMessage) error

Record implements store.Store.

func (*Store) Recorded

func (s *Store) Recorded(ctx context.Context, runID, name string, occurrence int) (json.RawMessage, bool, error)

Recorded implements store.Store.

func (*Store) Recover

func (s *Store) Recover(ctx context.Context) (int, error)

Recover implements store.Store.

func (*Store) Release

func (s *Store) Release(ctx context.Context, runID string, links []workflow.Subject, effects []json.RawMessage, mode effect.Mode) error

Release implements store.Store.

func (*Store) Remember

func (s *Store) Remember(ctx context.Context, workflow, key string, trace store.Trace) error

Remember implements store.Store.

func (*Store) Run

func (s *Store) Run(ctx context.Context, runID string) (store.Run, bool, error)

Run implements store.Store.

func (*Store) RunsFor

func (s *Store) RunsFor(ctx context.Context, subject workflow.Subject) ([]string, error)

RunsFor implements store.Store.

func (*Store) RunsSince

func (s *Store) RunsSince(ctx context.Context, since time.Time) ([]store.Run, error)

RunsSince implements store.Store.

func (*Store) Traces

func (s *Store) Traces(ctx context.Context, workflow, key string, since time.Time) ([]store.Trace, error)

Traces implements store.Store.

func (*Store) Undelivered

func (s *Store) Undelivered(ctx context.Context) ([]store.Entry, error)

Undelivered implements store.Store.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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