You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Specify the minimum interval, in milliseconds, between queries.
82
-
*/
83
116
throttleMs:Long? = null,
84
117
mapper: (SqlCursor) ->RowType,
85
118
): Flow<List<RowType>>
86
119
87
120
/**
88
-
* Takes a global lock, without starting a transaction.
89
-
*
90
-
* This takes a global lock - only one write transaction can execute against
91
-
* the database at a time. This applies even when constructing separate
92
-
* database instances for the same database file.
121
+
* Takes a global lock without starting a transaction.
93
122
*
94
-
* Locks for separate database instances on the same database file
95
-
* may be held concurrently.
123
+
* This lock ensures that only one write transaction can execute against the database at a time, even across separate database instances for the same file.
96
124
*
97
-
* In most cases, [writeTransaction] should be used instead.
125
+
* @param callback The callback to execute while holding the lock.
126
+
* @return The result of the callback.
127
+
* @throws PowerSyncException If a database error occurs.
128
+
* @throws CancellationException If the operation is cancelled.
publicsuspendfun <R> writeLock(callback:ThrowableLockCallback<R>): R
101
132
102
133
/**
103
-
* Open a read-write transaction.
134
+
* Opens a read-write transaction.
104
135
*
105
-
* This takes a global lock - only one write transaction can execute against
106
-
* the database at a time. This applies even when constructing separate
107
-
* database instances for the same database file.
136
+
* This takes a global lock, ensuring that only one write transaction can execute against the database at a time, even across separate database instances for the same file.
108
137
*
109
-
* Statements within the transaction must be done on the provided
110
-
* [PowerSyncTransaction] - attempting statements on the database
111
-
* instance will error cause a dead-lock.
138
+
* @param callback The callback to execute within the transaction.
139
+
* @return The result of the callback.
140
+
* @throws PowerSyncException If a database error occurs.
141
+
* @throws CancellationException If the operation is cancelled.
0 commit comments