@react-native-firebase/database 26.4.0 → 27.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/RNFBDatabase.podspec +8 -2
- package/android/build.gradle +5 -0
- package/android/src/main/java/io/invertase/firebase/database/RNFBDatabaseKeepSyncedRegistry.java +106 -0
- package/android/src/main/java/io/invertase/firebase/database/RNFBDatabaseListenerRegistry.kt +133 -0
- package/android/src/main/java/io/invertase/firebase/database/RNFBDatabaseQueryRegistry.kt +76 -0
- package/android/src/main/java/io/invertase/firebase/database/RNFBDatabaseTransactionRegistry.kt +67 -0
- package/android/src/main/java/io/invertase/firebase/database/UniversalFirebaseDatabaseOnDisconnectModule.java +102 -9
- package/android/src/reactnative/java/io/invertase/firebase/database/NativeRNFBTurboDatabaseOnDisconnect.java +6 -11
- package/android/src/reactnative/java/io/invertase/firebase/database/NativeRNFBTurboDatabaseQuery.java +93 -2
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboDatabaseQuerySpec.java +4 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/jni/RNFBDatabaseTurboModules-generated.cpp +6 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/jni/react/renderer/components/RNFBDatabaseTurboModules/RNFBDatabaseTurboModulesJSI.h +12 -0
- package/android/src/test/java/io/invertase/firebase/database/RNFBDatabaseKeepSyncedRegistryTest.java +174 -0
- package/android/src/test/java/io/invertase/firebase/database/RNFBDatabaseListenerRegistryTest.java +31 -0
- package/android/src/test/java/io/invertase/firebase/database/RNFBDatabaseQueryRegistryTest.java +55 -0
- package/android/src/test/java/io/invertase/firebase/database/UniversalFirebaseDatabaseOnDisconnectCancelErrorTest.java +137 -0
- package/dist/module/DatabaseQuery.js +52 -1
- package/dist/module/DatabaseQuery.js.map +1 -1
- package/dist/module/DatabaseSyncTree.js +1 -1
- package/dist/module/DatabaseSyncTree.js.map +1 -1
- package/dist/module/index.js +1 -2
- package/dist/module/index.js.map +1 -1
- package/dist/module/modular/query.js +1 -1
- package/dist/module/modular/query.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/module/web/RNFBDatabaseModule.js +7 -0
- package/dist/module/web/RNFBDatabaseModule.js.map +1 -1
- package/dist/typescript/lib/DatabaseQuery.d.ts +25 -0
- package/dist/typescript/lib/DatabaseQuery.d.ts.map +1 -1
- package/dist/typescript/lib/index.d.ts +1 -1
- package/dist/typescript/lib/types/internal.d.ts +2 -0
- package/dist/typescript/lib/types/internal.d.ts.map +1 -1
- package/dist/typescript/lib/version.d.ts +1 -1
- package/dist/typescript/lib/web/RNFBDatabaseModule.d.ts.map +1 -1
- package/ios/RNFBDatabase/RNFBDatabaseListenerRegistry.m +24 -17
- package/ios/RNFBDatabase/RNFBDatabaseListenerRegistryStorage.swift +81 -0
- package/ios/RNFBDatabase/RNFBDatabaseNullSentinelDecoder.h +36 -0
- package/ios/RNFBDatabase/RNFBDatabaseNullSentinelDecoder.m +48 -0
- package/ios/RNFBDatabase/RNFBDatabaseOnDisconnectHelper.m +29 -26
- package/ios/RNFBDatabase/RNFBDatabaseQueryHelper.h +7 -0
- package/ios/RNFBDatabase/RNFBDatabaseQueryHelper.m +20 -0
- package/ios/RNFBDatabase/RNFBDatabaseQueryModule.mm +14 -0
- package/ios/RNFBDatabase/RNFBDatabaseQueryRegistry.m +25 -51
- package/ios/RNFBDatabase/RNFBDatabaseQueryRegistryStorage.swift +104 -0
- package/ios/RNFBDatabase/RNFBDatabaseReferenceHelper.m +14 -12
- package/ios/RNFBDatabase/RNFBDatabaseTransactionHelper.m +3 -1
- package/ios/RNFBDatabase.xcodeproj/project.pbxproj +12 -0
- package/ios/RNFBDatabaseUnitTests/RNFBDatabaseListenerRegistryStorageTests.swift +86 -0
- package/ios/RNFBDatabaseUnitTests/RNFBDatabaseNullSentinelDecodeTests.m +118 -0
- package/ios/RNFBDatabaseUnitTests/RNFBDatabaseQueryRegistryStorageTests.swift +181 -0
- package/ios/RNFBDatabaseUnitTests/RNFBDatabaseUnitTests.xcodeproj/project.pbxproj +42 -0
- package/ios/generated/RNFBDatabaseTurboModules/RNFBDatabaseTurboModules-generated.mm +7 -0
- package/ios/generated/RNFBDatabaseTurboModules/RNFBDatabaseTurboModules.h +6 -0
- package/ios/generated/RNFBDatabaseTurboModulesJSI.h +12 -0
- package/lib/DatabaseQuery.ts +56 -0
- package/lib/DatabaseSyncTree.ts +1 -1
- package/lib/index.ts +1 -1
- package/lib/modular/query.ts +1 -1
- package/lib/types/internal.ts +2 -0
- package/lib/version.ts +1 -1
- package/lib/web/RNFBDatabaseModule.ts +13 -0
- package/package.json +4 -4
- package/specs/NativeRNFBTurboDatabaseQuery.ts +1 -0
- package/android/src/main/java/io/invertase/firebase/database/RNFBDatabaseListenerRegistry.java +0 -117
- package/android/src/main/java/io/invertase/firebase/database/RNFBDatabaseQueryRegistry.java +0 -78
- package/android/src/main/java/io/invertase/firebase/database/RNFBDatabaseTransactionRegistry.java +0 -71
package/lib/types/internal.ts
CHANGED
|
@@ -151,6 +151,7 @@ export interface RNFBDatabaseModule {
|
|
|
151
151
|
modifiers: DatabaseQueryModifier[],
|
|
152
152
|
eventType: EventType,
|
|
153
153
|
): Promise<DatabaseSnapshotInternal | DatabaseChildSnapshotResultInternal>;
|
|
154
|
+
get(path: string, modifiers: DatabaseQueryModifier[]): Promise<DatabaseSnapshotInternal>;
|
|
154
155
|
on(props: DatabaseListenPropsInternal): void;
|
|
155
156
|
off(queryKey: string, eventRegistrationKey: string): void | Promise<void>;
|
|
156
157
|
keepSynced(
|
|
@@ -223,6 +224,7 @@ export interface QueryWithSubscriptionMethodsInternal extends Query {
|
|
|
223
224
|
failureCallbackContext?: ((error: Error) => void) | null,
|
|
224
225
|
context?: ListenOptions,
|
|
225
226
|
): Promise<DataSnapshot>;
|
|
227
|
+
_get(): Promise<DataSnapshot>;
|
|
226
228
|
}
|
|
227
229
|
|
|
228
230
|
/** Query constraint instance that can apply itself to a query. */
|
package/lib/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '
|
|
2
|
+
export const version = '27.1.0';
|
|
@@ -225,6 +225,19 @@ const databaseFallbackModule: Record<string, unknown> = {
|
|
|
225
225
|
});
|
|
226
226
|
},
|
|
227
227
|
|
|
228
|
+
get(
|
|
229
|
+
appName: string,
|
|
230
|
+
dbURL: string,
|
|
231
|
+
path: string,
|
|
232
|
+
modifiers: DatabaseQueryModifier[],
|
|
233
|
+
): Promise<unknown> {
|
|
234
|
+
return guard(async () => {
|
|
235
|
+
const db = getCachedDatabaseInstance(appName, dbURL);
|
|
236
|
+
const queryRef = getQueryInstance(ref(db, path), modifiers);
|
|
237
|
+
return snapshotToObject(await get(queryRef));
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
|
|
228
241
|
once(
|
|
229
242
|
appName: string,
|
|
230
243
|
dbURL: string,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-firebase/database",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "27.1.0",
|
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
|
5
5
|
"description": "React Native Firebase - The Firebase Realtime Database is a cloud-hosted database. Data is stored as JSON and synchronized in realtime to every connected client. React Native Firebase provides native integration with the Android & iOS Firebase SDKs, supporting both realtime data sync and offline capabilities.",
|
|
6
6
|
"main": "./dist/module/index.js",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"realtome database"
|
|
50
50
|
],
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@react-native-firebase/app": "
|
|
52
|
+
"@react-native-firebase/app": "27.1.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@react-native-firebase/app": "
|
|
55
|
+
"@react-native-firebase/app": "27.1.0",
|
|
56
56
|
"react-native-builder-bob": "^0.41.0"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"node_modules/",
|
|
91
91
|
"dist/"
|
|
92
92
|
],
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "c65e1ee3b78bcd0c5b66996100d7d1e579ca1614"
|
|
94
94
|
}
|
|
@@ -10,6 +10,7 @@ export interface Spec extends TurboModule {
|
|
|
10
10
|
modifiers: ReadonlyArray<Object>,
|
|
11
11
|
eventType: string,
|
|
12
12
|
): Promise<Object>;
|
|
13
|
+
get(app: string, dbURL: string, path: string, modifiers: ReadonlyArray<Object>): Promise<Object>;
|
|
13
14
|
on(app: string, dbURL: string, props: Object): void;
|
|
14
15
|
off(queryKey: string, eventRegistrationKey: string): void;
|
|
15
16
|
keepSynced(
|
package/android/src/main/java/io/invertase/firebase/database/RNFBDatabaseListenerRegistry.java
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
package io.invertase.firebase.database;
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this library except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import io.invertase.firebase.common.RNFBHandleCollisionException;
|
|
21
|
-
import io.invertase.firebase.common.RNFBHandleMap;
|
|
22
|
-
import java.util.ArrayList;
|
|
23
|
-
import java.util.List;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Per-query value/child listener maps. Unique {@link #putValue}/{@link #putChild}; callers {@link
|
|
27
|
-
* #takeValue}/{@link #takeChild} or {@link #takeAll} then remove the SDK listener outside the
|
|
28
|
-
* HandleMap lock. Null values are not stored so {@link #hasListeners} can use occupancy.
|
|
29
|
-
*/
|
|
30
|
-
final class RNFBDatabaseListenerRegistry {
|
|
31
|
-
private final Object occupancyLock = new Object();
|
|
32
|
-
private final RNFBHandleMap<String, Object> valueListeners = new RNFBHandleMap<>();
|
|
33
|
-
private final RNFBHandleMap<String, Object> childListeners = new RNFBHandleMap<>();
|
|
34
|
-
private int occupancy;
|
|
35
|
-
|
|
36
|
-
void putValue(String eventRegistrationKey, Object listener) throws RNFBHandleCollisionException {
|
|
37
|
-
if (listener == null) {
|
|
38
|
-
throw new NullPointerException("listener");
|
|
39
|
-
}
|
|
40
|
-
synchronized (occupancyLock) {
|
|
41
|
-
valueListeners.put(eventRegistrationKey, listener);
|
|
42
|
-
occupancy++;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
void putChild(String eventRegistrationKey, Object listener) throws RNFBHandleCollisionException {
|
|
47
|
-
if (listener == null) {
|
|
48
|
-
throw new NullPointerException("listener");
|
|
49
|
-
}
|
|
50
|
-
synchronized (occupancyLock) {
|
|
51
|
-
childListeners.put(eventRegistrationKey, listener);
|
|
52
|
-
occupancy++;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
Object getValue(String eventRegistrationKey) {
|
|
57
|
-
return valueListeners.get(eventRegistrationKey);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
Object getChild(String eventRegistrationKey) {
|
|
61
|
-
return childListeners.get(eventRegistrationKey);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
Object takeValue(String eventRegistrationKey) {
|
|
65
|
-
synchronized (occupancyLock) {
|
|
66
|
-
Object listener = valueListeners.take(eventRegistrationKey);
|
|
67
|
-
if (listener != null) {
|
|
68
|
-
occupancy--;
|
|
69
|
-
}
|
|
70
|
-
return listener;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
Object takeChild(String eventRegistrationKey) {
|
|
75
|
-
synchronized (occupancyLock) {
|
|
76
|
-
Object listener = childListeners.take(eventRegistrationKey);
|
|
77
|
-
if (listener != null) {
|
|
78
|
-
occupancy--;
|
|
79
|
-
}
|
|
80
|
-
return listener;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
List<Object> takeAllValues() {
|
|
85
|
-
synchronized (occupancyLock) {
|
|
86
|
-
List<Object> remaining = valueListeners.takeAll();
|
|
87
|
-
occupancy -= remaining.size();
|
|
88
|
-
return remaining;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
List<Object> takeAllChildren() {
|
|
93
|
-
synchronized (occupancyLock) {
|
|
94
|
-
List<Object> remaining = childListeners.takeAll();
|
|
95
|
-
occupancy -= remaining.size();
|
|
96
|
-
return remaining;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
List<Object> takeAll() {
|
|
101
|
-
List<Object> remaining = new ArrayList<>();
|
|
102
|
-
remaining.addAll(takeAllValues());
|
|
103
|
-
remaining.addAll(takeAllChildren());
|
|
104
|
-
return remaining;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
boolean hasEventListener(String eventRegistrationKey) {
|
|
108
|
-
return valueListeners.get(eventRegistrationKey) != null
|
|
109
|
-
|| childListeners.get(eventRegistrationKey) != null;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
boolean hasListeners() {
|
|
113
|
-
synchronized (occupancyLock) {
|
|
114
|
-
return occupancy > 0;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
package io.invertase.firebase.database;
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this library except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import io.invertase.firebase.common.RNFBHandleCollisionException;
|
|
21
|
-
import io.invertase.firebase.common.RNFBHandleMap;
|
|
22
|
-
import java.util.List;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Cached query map. Unique {@link #put}; callers {@link #take}, {@link #takeIfIdle}, or {@link
|
|
26
|
-
* #takeAllAndRemove} then {@code removeAllEventListeners()} outside the HandleMap lock.
|
|
27
|
-
*/
|
|
28
|
-
final class RNFBDatabaseQueryRegistry {
|
|
29
|
-
private final RNFBHandleMap<String, DatabaseQueryHandle> map = new RNFBHandleMap<>();
|
|
30
|
-
|
|
31
|
-
void put(String queryKey, DatabaseQueryHandle query) throws RNFBHandleCollisionException {
|
|
32
|
-
map.put(queryKey, query);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
DatabaseQueryHandle get(String queryKey) {
|
|
36
|
-
return map.get(queryKey);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
DatabaseQueryHandle take(String queryKey) {
|
|
40
|
-
return map.take(queryKey);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Removes the mapping when the query has no listeners. Reads {@link
|
|
45
|
-
* DatabaseQueryHandle#hasListeners()} outside the HandleMap lock (avoids nesting {@code
|
|
46
|
-
* occupancyLock}), then identity-takes and put-backs if listeners appeared.
|
|
47
|
-
*/
|
|
48
|
-
void takeIfIdle(String queryKey) {
|
|
49
|
-
DatabaseQueryHandle query = map.get(queryKey);
|
|
50
|
-
if (query == null) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (Boolean.TRUE.equals(query.hasListeners())) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
DatabaseQueryHandle taken = map.takeIf(queryKey, q -> q == query);
|
|
57
|
-
if (taken == null) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (Boolean.TRUE.equals(taken.hasListeners())) {
|
|
61
|
-
// Prefer put-back so an active query stays registered. If a concurrent put claimed the
|
|
62
|
-
// slot, putIfAbsent fails and this taken query would be an orphan with listeners — clear
|
|
63
|
-
// them so SDK callbacks are not left attached outside the registry.
|
|
64
|
-
if (!map.putIfAbsent(queryKey, taken)) {
|
|
65
|
-
taken.removeAllEventListeners();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
void takeAllAndRemove() {
|
|
71
|
-
List<DatabaseQueryHandle> remaining = map.takeAll();
|
|
72
|
-
for (DatabaseQueryHandle query : remaining) {
|
|
73
|
-
if (query != null) {
|
|
74
|
-
query.removeAllEventListeners();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
package/android/src/main/java/io/invertase/firebase/database/RNFBDatabaseTransactionRegistry.java
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
package io.invertase.firebase.database;
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this library except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import io.invertase.firebase.common.RNFBHandleCollisionException;
|
|
21
|
-
import io.invertase.firebase.common.RNFBHandleMap;
|
|
22
|
-
import java.util.List;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Transaction handler map. Unique {@link #put} (occupied id aborts the incoming handler, then
|
|
26
|
-
* throws); callers {@link #take} or {@link #takeAllAndAbort} then {@code abort()} outside the
|
|
27
|
-
* HandleMap lock. Replace is {@link #registerReplacing} (atomic last wins).
|
|
28
|
-
*/
|
|
29
|
-
final class RNFBDatabaseTransactionRegistry {
|
|
30
|
-
private final RNFBHandleMap<Integer, DatabaseAbortable> map = new RNFBHandleMap<>();
|
|
31
|
-
|
|
32
|
-
void put(int transactionId, DatabaseAbortable handler) throws RNFBHandleCollisionException {
|
|
33
|
-
try {
|
|
34
|
-
map.put(transactionId, handler);
|
|
35
|
-
} catch (RNFBHandleCollisionException collision) {
|
|
36
|
-
if (handler != null) {
|
|
37
|
-
handler.abort();
|
|
38
|
-
}
|
|
39
|
-
throw collision;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** Atomic replace (last wins). The replaced handler is not aborted (Firebase retry). */
|
|
44
|
-
void registerReplacing(int transactionId, DatabaseAbortable handler) {
|
|
45
|
-
map.putReplacing(transactionId, handler);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
DatabaseAbortable get(int transactionId) {
|
|
49
|
-
return map.get(transactionId);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
DatabaseAbortable take(int transactionId) {
|
|
53
|
-
return map.take(transactionId);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
void takeAndAbort(int transactionId) {
|
|
57
|
-
DatabaseAbortable handler = map.take(transactionId);
|
|
58
|
-
if (handler != null) {
|
|
59
|
-
handler.abort();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
void takeAllAndAbort() {
|
|
64
|
-
List<DatabaseAbortable> remaining = map.takeAll();
|
|
65
|
-
for (DatabaseAbortable handler : remaining) {
|
|
66
|
-
if (handler != null) {
|
|
67
|
-
handler.abort();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|