postgres

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

Backend stores ownership in PostgreSQL using transactions and row locks.

func New

func New(db *sql.DB, opts ...Option) *Backend

New wraps an existing *sql.DB. Call Migrate to create tables (opt-in).

func (*Backend) AbortTransfer

func (b *Backend) AbortTransfer(ctx context.Context, req shiftlock.AbortRequest) (*shiftlock.ClaimRecord, error)

func (*Backend) AcquireClaim

func (b *Backend) AcquireClaim(ctx context.Context, req shiftlock.AcquireRequest) (*shiftlock.ClaimRecord, error)

func (*Backend) Capabilities

func (b *Backend) Capabilities() shiftlock.Capabilities

Capabilities implements shiftlock.Capabler.

func (*Backend) Close

func (b *Backend) Close() error

func (*Backend) CommitTransfer

func (b *Backend) CommitTransfer(ctx context.Context, req shiftlock.CommitRequest) (*shiftlock.ClaimRecord, error)

func (*Backend) GetClaim

func (b *Backend) GetClaim(ctx context.Context, claimName string) (*shiftlock.ClaimRecord, error)

func (*Backend) GetGeneration

func (b *Backend) GetGeneration(ctx context.Context, generationID string) (*shiftlock.Generation, error)

func (*Backend) Migrate

func (b *Backend) Migrate(ctx context.Context) error

Migrate creates required tables. Opt-in; not run automatically.

func (*Backend) PrepareTransfer

func (b *Backend) PrepareTransfer(ctx context.Context, req shiftlock.TransferRequest) (*shiftlock.ClaimRecord, error)

func (*Backend) RegisterGeneration

func (b *Backend) RegisterGeneration(ctx context.Context, gen shiftlock.Generation) error

func (*Backend) ReleaseClaim

func (b *Backend) ReleaseClaim(ctx context.Context, req shiftlock.ReleaseRequest) error

func (*Backend) RenewClaim

func (*Backend) UpdateGeneration

func (b *Backend) UpdateGeneration(ctx context.Context, gen shiftlock.Generation) error

func (*Backend) WatchClaim

func (b *Backend) WatchClaim(ctx context.Context, claimName string) (<-chan shiftlock.ClaimEvent, error)

type Option

type Option func(*Backend)

Option configures the postgres backend.

func WithSchema

func WithSchema(schema string) Option

WithSchema sets the schema name (default public).

Jump to

Keyboard shortcuts

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