Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TrashSweep = &DBLocker{key: 10001} ContainerLogSweep = &DBLocker{key: 10002} KeepBalanceService = &DBLocker{key: 10003} // keep-balance service in periodic-sweep loop KeepBalanceActive = &DBLocker{key: 10004} // keep-balance sweep in progress (either -once=true or service loop) Dispatch = &DBLocker{key: 10005} // any dispatcher running RailsMigrations = &DBLocker{key: 10006} )
Functions ¶
This section is empty.
Types ¶
type DBLocker ¶
type DBLocker struct {
// contains filtered or unexported fields
}
DBLocker uses pg_advisory_lock to maintain a cluster-wide lock for a long-running task like "do X every N seconds".
func (*DBLocker) Check ¶
Check confirms that the lock is still active (i.e., the session is still alive), and re-acquires if needed. Panics if Lock is not acquired first.
Returns false if the context passed to Lock() is canceled before the lock is confirmed or reacquired.
func (*DBLocker) Lock ¶
Lock acquires the advisory lock, waiting/reconnecting if needed.
Returns false if ctx is canceled before the lock is acquired.
Click to show internal directories.
Click to hide internal directories.