File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -274,6 +274,17 @@ class Store {
274
274
}
275
275
}
276
276
277
+ /// Returns if an open store was found for the given directory
278
+ /// (i.e. opened before and not yet closed).
279
+ static bool isOpen (String directory) {
280
+ final cStr = directory.toNativeUtf8 ();
281
+ try {
282
+ return C .store_is_open (cStr.cast ());
283
+ } finally {
284
+ malloc.free (cStr);
285
+ }
286
+ }
287
+
277
288
/// Returns a store reference you can use to create a new store instance with
278
289
/// a single underlying native store. See [Store.fromReference] for more details.
279
290
ByteData get reference => _reference;
Original file line number Diff line number Diff line change @@ -77,6 +77,14 @@ void main() {
77
77
env.close ();
78
78
});
79
79
80
+ test ('store is open' , () {
81
+ expect (false , Store .isOpen ('testdata-basics' ));
82
+ final env = TestEnv ('basics' );
83
+ expect (true , Store .isOpen ('testdata-basics' ));
84
+ env.close ();
85
+ expect (false , Store .isOpen ('testdata-basics' ));
86
+ });
87
+
80
88
test ('transactions' , () {
81
89
final env = TestEnv ('basics' );
82
90
expect (TxMode .values.length, 2 );
You can’t perform that action at this time.
0 commit comments