Documentation
¶
Overview ¶
Package concurrency provides utilities for enforcing a handler's concurrency preference.
See dogma.ConcurrencyPreference for more information.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnforceConcurrencyPreference ¶
func EnforceConcurrencyPreference( ctx context.Context, tx *sql.Tx, key *uuidpb.UUID, pref dogma.ConcurrencyPreference, fn func() error, ) (err error)
EnforceConcurrencyPreference calls fn, optionally serializing execution using a PostgreSQL session-level advisory lock when the concurrency preference is dogma.MinimizeConcurrency. If the preference is any other value, fn is called directly without acquiring a lock.
Session-level advisory locks are used (rather than transaction-level) so that the lock can be released before the transaction commits, minimizing the duration of serialization.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.