readLock<T> method

Future<T> readLock<T>(
  1. Future<T> callback(
    1. SqliteReadContext tx
    ), {
  2. Duration? lockTimeout,
  3. String? debugContext,
})

Takes a read lock, without starting a transaction.

The lock only applies to a single SqliteConnection, and multiple connections may hold read locks at the same time.

In most cases, readTransaction should be used instead.

If a timeout is set and no read connection becomes available in time, an AbortException will be thrown.

Implementation

Future<T> readLock<T>(Future<T> Function(SqliteReadContext tx) callback,
    {Duration? lockTimeout, String? debugContext}) {
  return abortableReadLock(callback,
      debugContext: debugContext, abortTrigger: lockTimeout?.asTimeout);
}