Skip to content

Commit

Permalink
fix: fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
wxxedu committed Feb 21, 2024
2 parents 37ccb09 + ec784b2 commit f26799c
Show file tree
Hide file tree
Showing 42 changed files with 335 additions and 315 deletions.
15 changes: 6 additions & 9 deletions example/integration_test/integration_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import 'package:dust/reactive.dart';
import 'package:dust/serializers.dart';
import 'package:dust/store.dart';
import 'package:dust/annotations.dart';
import 'package:dust/dust.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:path_provider/path_provider.dart';
Expand Down Expand Up @@ -74,18 +71,18 @@ void main() {
group('object_store', () {
setUpAll(() async {
final dir = await getTemporaryDirectory();
Store.open('${dir.path}/data.sqlite3', [
Dust.open('${dir.path}/data.sqlite3', [
const $TrivialRepository(),
const $SomethingRepository(),
]);
});

tearDownAll(() {
Store.close();
Dust.close();
});

test('object_store_no_barrier', () {
final store = Store.instance;
final store = Dust.instance;
final id0 = store.randomId();
final id1 = store.randomId();
store.setAtom(id0, (id0, 233, 666, const Int64Serializer()));
Expand Down Expand Up @@ -158,8 +155,8 @@ void main() {

something.delete();
assert(const $SomethingRepository().get(something.id).peek() == null);
Store.instance.setAtom(somethingElse.atomOne.id, null);
Store.instance.barrier();
Dust.instance.setAtom(somethingElse.atomOne.id, null);
Dust.instance.barrier();
assert(const $SomethingRepository().get(somethingElse.id).peek() == null);
});

Expand Down
14 changes: 7 additions & 7 deletions example/integration_test/integration_test.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/test/reactive/example_fixed_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:dust/reactive.dart';
import 'package:dust/dust.dart';

void main() {
test('Example should work', () {
Expand Down
2 changes: 1 addition & 1 deletion example/test/serializers/all_consistency_random_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:math';
import 'dart:typed_data';

import 'package:flutter_test/flutter_test.dart';
import 'package:dust/serializers.dart';
import 'package:dust/dust.dart';

String randomString(Random random, int maxLength) {
const chars =
Expand Down
2 changes: 1 addition & 1 deletion example/test/serializers/example_fixed_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:typed_data';
import 'package:flutter_test/flutter_test.dart';
import 'package:dust/serializers.dart';
import 'package:dust/dust.dart';

Uint8List serialize<T>(T value, Serializer<T> serializer) {
final builder = BytesBuilder();
Expand Down
3 changes: 1 addition & 2 deletions generator/example/lib/example.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:qinhuai/annotations.dart';
import 'package:qinhuai/store.dart';
import 'package:dust/dust.dart';

part 'example.dust.dart';

Expand Down
2 changes: 1 addition & 1 deletion generator/example/lib/example.dust.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generator/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ environment:
# Add regular dependencies here.
dependencies:
# path: ^1.8.0
qinhuai:
dust:
path: ../../

dev_dependencies:
lints: ^2.1.0
test: ^1.24.0
qinhuai_generator:
dust_generator:
path: ../
build_runner: ^2.4.8
3 changes: 2 additions & 1 deletion lib/annotations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import 'serializers.dart';
import 'src/serializer.dart';
export 'src/serializer.dart';

/// The annotation for a model class. A model is an object that can be
/// serialized and persisted to the database.
Expand Down
5 changes: 5 additions & 0 deletions lib/dust.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export 'annotations.dart';
export 'src/reactive.dart';
export 'src/store.dart';
export 'src/multimap.dart';
export 'src/serializers.dart';
23 changes: 23 additions & 0 deletions lib/ffi.dart → lib/src/ffi.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ export 'ffi/native_bindings.dart';
export 'ffi/native_structs.dart';

import 'dart:ffi';
import 'package:ffi/ffi.dart';
import 'package:flutter/foundation.dart';

import 'ffi/native_bindings.dart';
import 'store.dart';

class Ffi {
static final bindings = NativeBindings(library);
Expand All @@ -30,4 +32,25 @@ class Ffi {
TargetPlatform.windows => DynamicLibrary.open('dust.dll'),
_ => throw UnimplementedError('Unsupported platform'),
};

static void init(String databasePath, List<Repository> repositories) {
for (final repository in repositories) {
final schema = repository.init();
for (final label in schema.stickyNodes) {
bindings.dust_add_sticky_node(label);
}
for (final label in schema.stickyAtoms) {
bindings.dust_add_sticky_atom(label);
}
for (final label in schema.stickyEdges) {
bindings.dust_add_sticky_edge(label);
}
for (final label in schema.acyclicEdges) {
bindings.dust_add_acyclic_edge(label);
}
}
final ptr = databasePath.toNativeUtf8(allocator: malloc);
bindings.dust_open(ptr.length, ptr.cast<Uint8>());
malloc.free(ptr);
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit f26799c

Please sign in to comment.