Documentation
¶
Overview ¶
Package postgres provides native durable fenced leases for PostgreSQL.
Index ¶
- func GoMigration() (migrations.Migration, error)
- type Migration
- type Store
- func (store *Store) Cleanup(ctx context.Context, batch uint32) (uint32, error)
- func (store *Store) Release(ctx context.Context, owned lease.Record) error
- func (store *Store) Renew(ctx context.Context, owned lease.Record, ttl time.Duration) (lease.Record, error)
- func (store *Store) TryAcquire(ctx context.Context, key lease.Key, owner string, ttl time.Duration) (lease.Record, error)
- func (store *Store) Validate(ctx context.Context, owned lease.Record) (lease.Record, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoMigration ¶
func GoMigration() (migrations.Migration, error)
GoMigration returns the schema in migrations' immutable format.
Types ¶
type Migration ¶
Migration describes the reversible PostgreSQL schema contract.
func SchemaMigration ¶
func SchemaMigration() Migration
SchemaMigration returns the durable lease and persistent-fence schema.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists leases and fencing counters in PostgreSQL server time.
func (*Store) Cleanup ¶
Cleanup removes a bounded batch of old inactive lease rows. Fence rows are deliberately retained so cleanup cannot reset monotonic continuity.
func (*Store) Renew ¶
func (store *Store) Renew( ctx context.Context, owned lease.Record, ttl time.Duration, ) (lease.Record, error)
Renew atomically compares owner and token before extending backend expiry.
Click to show internal directories.
Click to hide internal directories.