Skip to content

Commit

Permalink
mongo and postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
tejainece committed Jul 8, 2018
1 parent 29a65b7 commit 823b691
Show file tree
Hide file tree
Showing 50 changed files with 692 additions and 944 deletions.
4 changes: 4 additions & 0 deletions conn_pool/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change log

## 2.1.5

+ Minor improvements to `SharedPool` release

## 2.1.3

+ Documentation
Expand Down
4 changes: 1 addition & 3 deletions conn_pool/example/example.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'package:conn_pool/conn_pool.dart';

main() {

}
main() {}
16 changes: 7 additions & 9 deletions conn_pool/lib/src/counted_set.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ class CountedSet<T> {

Set<T> set = _set[count];
if (set == null) throw Exception('$value is not located at $count!');
if (!set.remove(value))
throw Exception('$value is not located at $count!');
if(set.isEmpty) _set.remove(count);
if (!set.remove(value)) throw Exception('$value is not located at $count!');
if (set.isEmpty) _set.remove(count);

count++;
set = _set[count] ??= Set<T>();
Expand All @@ -59,9 +58,8 @@ class CountedSet<T> {

Set<T> set = _set[count];
if (set == null) throw Exception('$value is not located at $count!');
if (!set.remove(value))
throw Exception('$value is not located at $count!');
if(set.isEmpty) _set.remove(count);
if (!set.remove(value)) throw Exception('$value is not located at $count!');
if (set.isEmpty) _set.remove(count);

count--;
set = _set[count] ??= Set<T>();
Expand All @@ -77,15 +75,15 @@ class CountedSet<T> {

int numAt(int count) {
Set<T> set = _set[count];
if(set == null) return 0;
if (set == null) return 0;
return set.length;
}

List<T> removeAllAt(int count) {
Set<T> set = _set[count];
if(set == null) return [];
if (set == null) return [];

for(T t in set) _values.remove(t);
for (T t in set) _values.remove(t);
_set.remove(count);

return set.toList();
Expand Down
9 changes: 6 additions & 3 deletions conn_pool/lib/src/pool.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ class SharedPool<T> implements Pool<T> {

/// Releases [connection] back to the pool
void release(Connection<T> connection) {
int count = _pool.countOf(connection);
if (count == null || count == 0) return;
_pool.dec(connection);
if (_d <= 0) return;
if (!connection.isReleased) {
try {
_pool.dec(connection);
} catch (e) {}
}
if (_pool.length != maxSize) return;
if (_pool.numAt(0) < _d) return;
var removes = _pool.removeAllAt(0);
Expand Down
2 changes: 1 addition & 1 deletion conn_pool/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: conn_pool
description: A starting point for Dart libraries or applications.
version: 2.1.4
version: 2.1.5
homepage: https://github.com/Jaguar-dart/db
author: Ravi Teja Gudapati <[email protected]>

Expand Down
6 changes: 2 additions & 4 deletions conn_pool/test/conn_pool_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import 'package:test/test.dart';

void main() {
group('A group of tests', () {
setUp(() {
});
setUp(() {});

test('First Test', () {
});
test('First Test', () {});
});
}
13 changes: 0 additions & 13 deletions jaguar_mongo/.analysis_options

This file was deleted.

14 changes: 0 additions & 14 deletions jaguar_mongo/CHANGELOG.md

This file was deleted.

97 changes: 0 additions & 97 deletions jaguar_mongo/README.md

This file was deleted.

62 changes: 0 additions & 62 deletions jaguar_mongo/example/main.dart

This file was deleted.

2 changes: 0 additions & 2 deletions jaguar_mongo/jaguar.yaml

This file was deleted.

99 changes: 0 additions & 99 deletions jaguar_mongo/lib/src/interceptor.dart

This file was deleted.

Loading

0 comments on commit 823b691

Please sign in to comment.