Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Objectbox in Isolate #18

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions foodb/lib/foodb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ library foodb;

import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:isolate';
import 'package:crypto/crypto.dart' as crypto;
import 'package:foodb/src/common.dart';
import 'package:foodb/src/methods/purge.dart';
Expand All @@ -28,6 +30,7 @@ import 'package:synchronized/synchronized.dart';
import 'package:uuid/uuid.dart';

export 'package:foodb/src/replicate.dart';
export 'package:foodb/src/replication_utils.dart';
export 'package:foodb/src/selector.dart';
export 'package:foodb/src/common.dart';
export 'package:foodb/src/design_doc.dart';
Expand Down
12 changes: 6 additions & 6 deletions foodb/lib/src/key_value/collate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ _Encoder _getEncoderByCollationType(String key) {

String encodeToIndex(dynamic key) {
final encoder = _getEncoderByRuntimeType(key);
return encoder.COLLATION_TYPE_STR + encoder.encode(key) + RESERVED_DELIMITER;
return '${encoder.COLLATION_TYPE_STR}${encoder.encode(key)}$RESERVED_DELIMITER';
}

dynamic decodeFromIndex(String str) {
String strToParse = "";
StringBuffer buffer = StringBuffer();
_Encoder? encoder;
Queue<List<dynamic>> valueStack = Queue();
Queue<_Encoder> collectionStack = Queue();
Expand Down Expand Up @@ -235,15 +235,15 @@ dynamic decodeFromIndex(String str) {
if (encoder is _ArrEncoder || encoder is _ObjEncoder) {
valueStack.add([]);
collectionStack.addLast(encoder);
strToParse = '';
buffer = StringBuffer();
encoder = null;
}
continue;
}

// reached the end of string, time to run encoder
if (c == RESERVED_DELIMITER) {
final value = encoder.decode(strToParse);
final value = encoder.decode(buffer.toString());

// if the value is for the collection, add to stack
// else return
Expand All @@ -252,10 +252,10 @@ dynamic decodeFromIndex(String str) {
} else {
return value;
}
strToParse = '';
buffer = StringBuffer();
encoder = null;
continue;
}
strToParse += c;
buffer.write(c);
}
}
Loading