Skip to content

Commit

Permalink
Merge branch 'trunk' into exception_handling_changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sitaram-kalluri authored May 19, 2022
2 parents 52ba744 + 1ab3f3b commit 23032dc
Show file tree
Hide file tree
Showing 17 changed files with 119 additions and 40 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<img src="https://atsign.dev/assets/img/@dev.png?sanitize=true">

### Now for a little internet optimism
<img width=250px src="https://atsign.dev/assets/img/@platform_logo_grey.svg?sanitize=true">

[![Build Status](https://github.com/atsign-foundation/at_tools/actions/workflows/at_tools.yaml/badge.svg)](https://github.com/atsign-foundation/at_tools/actions/workflows/at_tools.yaml)
[![GitHub License](https://img.shields.io/badge/license-BSD3-blue.svg)](./LICENSE)

## at_tools

This repository contains @protocol tools and libraries for developers
This repository contains @protocol tools and libraries for developers
building @platform applications who wish to utilize the authentication
methods and commonly used components of the @protocol:

Expand Down
4 changes: 1 addition & 3 deletions at_cli/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<img src="https://atsign.dev/assets/img/@dev.png?sanitize=true">

### Now for a little internet optimism
<img width=250px src="https://atsign.dev/assets/img/@platform_logo_grey.svg?sanitize=true">

# at_cli

Expand Down
4 changes: 4 additions & 0 deletions at_commons/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.0.16
- Hide at_client_exceptions.dart to prevent at_client_exception being referred from at_commons
## 3.0.15
- FEAT: support to bypass cache in lookup and plookup verbs
## 3.0.14
- Remove unnecessary print statements
## 3.0.13
Expand Down
4 changes: 1 addition & 3 deletions at_commons/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<img src="https://atsign.dev/assets/img/@dev.png?sanitize=true">

### Now for a little internet optimism
<img width=250px src="https://atsign.dev/assets/img/@platform_logo_grey.svg?sanitize=true">

[![Pub Package](https://img.shields.io/pub/v/at_commons)](https://pub.dev/packages/at_commons)

Expand Down
1 change: 1 addition & 0 deletions at_commons/lib/src/at_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ const String commitLogCompactionKey = 'privatekey:commitLogCompactionStats';
const String accessLogCompactionKey = 'privatekey:accessLogCompactionStats';
const String notificationCompactionKey =
'privatekey:notificationCompactionStats';
const String byPassCache = 'bypassCache';
15 changes: 10 additions & 5 deletions at_commons/lib/src/verb/lookup_verb_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,20 @@ class LookupVerbBuilder implements VerbBuilder {

String? operation;

// if set to true, returns the value of key on the remote server instead of the cached copy
bool byPassCache = false;

@override
String buildCommand() {
String command;
String command = 'lookup:';
if (byPassCache == true) {
command += 'bypassCache:$byPassCache:';
}
if (operation != null) {
command = 'lookup:$operation:$atKey${VerbUtil.formatAtSign(sharedBy)}\n';
} else {
command = 'lookup:$atKey${VerbUtil.formatAtSign(sharedBy)}\n';
command += '$operation:';
}
return command;
command += atKey!;
return '$command${VerbUtil.formatAtSign(sharedBy)}\n';
}

@override
Expand Down
15 changes: 10 additions & 5 deletions at_commons/lib/src/verb/plookup_verb_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,20 @@ class PLookupVerbBuilder implements VerbBuilder {

String? operation;

// if set to true, returns the value of key on the remote server instead of the cached copy
bool byPassCache = false;

@override
String buildCommand() {
String command;
String command = 'plookup:';
if (byPassCache == true) {
command += 'bypassCache:$byPassCache:';
}
if (operation != null) {
command = 'plookup:$operation:$atKey${VerbUtil.formatAtSign(sharedBy)}\n';
} else {
command = 'plookup:$atKey${VerbUtil.formatAtSign(sharedBy)}\n';
command += '$operation:';
}
return command;
command += atKey!;
return '$command${VerbUtil.formatAtSign(sharedBy)}\n';
}

@override
Expand Down
4 changes: 2 additions & 2 deletions at_commons/lib/src/verb/syntax.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class VerbSyntax {
static const llookup =
r'^llookup:((?<operation>meta|all):)?(?:cached:)?((?:public:)|(@(?<forAtSign>[^@:\s]*):))?(?<atKey>[^:]((?!:{2})[^@])+)@(?<atSign>[^@\s]+)$';
static const plookup =
r'^plookup:((?<operation>meta|all):)?(?<atKey>[^@\s]+)@(?<atSign>[^@\s]+)$';
r'^plookup:(bypassCache:(?<bypassCache>true|false):)?((?<operation>meta|all):)?(?<atKey>[^@\s]+)@(?<atSign>[^@\s]+)$';
static const lookup =
r'^lookup:((?<operation>meta|all):)?(?<atKey>(?:[^:]).+)@(?<atSign>[^@\s]+)$';
r'^lookup:(bypassCache:(?<bypassCache>true|false):)?((?<operation>meta|all):)?(?<atKey>(?:[^:]).+)@(?<atSign>[^@\s]+)$';
static const scan =
r'^scan$|scan(:(?<forAtSign>@[^:@\s]+))?(:page:(?<page>\d+))?( (?<regex>\S+))?$';
static const config =
Expand Down
2 changes: 1 addition & 1 deletion at_commons/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: at_commons
description: A library of Dart and Flutter utility classes that are used across other components of the @‎platform.
version: 3.0.14
version: 3.0.16
repository: https://github.com/atsign-foundation/at_tools
homepage: https://atsign.dev

Expand Down
37 changes: 37 additions & 0 deletions at_commons/test/lookup_verb_builder_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import 'package:at_commons/at_builders.dart';
import 'package:test/test.dart';

void main() {
group('A group of lookup verb builder tests', () {
test('verify simple lookup command', () {
var lookupVerbBuilder = LookupVerbBuilder()
..atKey = 'phone'
..sharedBy = 'alice';
expect(lookupVerbBuilder.buildCommand(), 'lookup:phone@alice\n');
});
test('verify lookup meta command', () {
var lookupVerbBuilder = LookupVerbBuilder()
..operation = 'meta'
..atKey = 'email'
..sharedBy = 'alice';
expect(lookupVerbBuilder.buildCommand(), 'lookup:meta:email@alice\n');
});

test('verify lookup all command', () {
var lookupVerbBuilder = LookupVerbBuilder()
..operation = 'all'
..atKey = 'email'
..sharedBy = 'alice';
expect(lookupVerbBuilder.buildCommand(), 'lookup:all:email@alice\n');
});

test('verify lookup bypass cache command', () {
var lookupVerbBuilder = LookupVerbBuilder()
..byPassCache = true
..atKey = 'email'
..sharedBy = 'alice';
expect(lookupVerbBuilder.buildCommand(),
'lookup:bypassCache:true:email@alice\n');
});
});
}
37 changes: 37 additions & 0 deletions at_commons/test/plookup_verb_builder_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import 'package:at_commons/at_builders.dart';
import 'package:test/test.dart';

void main() {
group('A group of lookup verb builder tests', () {
test('verify simple plookup command', () {
var plookupVerbBuilder = PLookupVerbBuilder()
..atKey = 'phone'
..sharedBy = 'alice';
expect(plookupVerbBuilder.buildCommand(), 'plookup:phone@alice\n');
});
test('verify plookup meta command', () {
var plookupVerbBuilder = PLookupVerbBuilder()
..operation = 'meta'
..atKey = 'email'
..sharedBy = 'alice';
expect(plookupVerbBuilder.buildCommand(), 'plookup:meta:email@alice\n');
});

test('verify plookup all command', () {
var plookupVerbBuilder = PLookupVerbBuilder()
..operation = 'all'
..atKey = 'email'
..sharedBy = 'alice';
expect(plookupVerbBuilder.buildCommand(), 'plookup:all:email@alice\n');
});

test('verify plookup bypass cache command', () {
var plookupVerbBuilder = PLookupVerbBuilder()
..byPassCache = true
..atKey = 'email'
..sharedBy = 'alice';
expect(plookupVerbBuilder.buildCommand(),
'plookup:bypassCache:true:email@alice\n');
});
});
}
4 changes: 1 addition & 3 deletions at_cram/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<img src="https://atsign.dev/assets/img/@dev.png?sanitize=true">

### Now for a little internet optimism
<img width=250px src="https://atsign.dev/assets/img/@platform_logo_grey.svg?sanitize=true">

## at_cram

Expand Down
4 changes: 1 addition & 3 deletions at_dump_atKeys/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<img src="https://atsign.dev/assets/img/@dev.png?sanitize=true">

### Now for a little internet optimism
<img width=250px src="https://atsign.dev/assets/img/@platform_logo_grey.svg?sanitize=true">

## at_dump_atKeys

Expand Down
10 changes: 8 additions & 2 deletions at_hive_recovery/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# at_hive_recovery #
<img width=250px src="https://atsign.dev/assets/img/@platform_logo_grey.svg?sanitize=true">

# at_hive_recovery

**at_hive_recovery** tool for recovering corrupted hive boxes.

Usage:

```
dart bin/main.dart <atsign> <dir_path_of_hive_box>
```

e.g

dart bin/main.dart @alice /home/alice/storage/hive
```
dart bin/main.dart @alice /home/alice/storage/hive
```
4 changes: 1 addition & 3 deletions at_pkam/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<img src="https://atsign.dev/assets/img/@dev.png?sanitize=true">

### Now for a little internet optimism
<img width=250px src="https://atsign.dev/assets/img/@platform_logo_grey.svg?sanitize=true">

## at_pkam

Expand Down
4 changes: 1 addition & 3 deletions at_utils/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<img src="https://atsign.dev/assets/img/@dev.png?sanitize=true">

### Now for a little internet optimism
<img width=250px src="https://atsign.dev/assets/img/@platform_logo_grey.svg?sanitize=true">

[![Pub Package](https://img.shields.io/pub/v/at_utils)](https://pub.dev/packages/at_utils)

Expand Down
4 changes: 1 addition & 3 deletions at_ve_doctor/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<img src="https://atsign.dev/assets/img/@dev.png?sanitize=true">

### Now for a little internet optimism
<img width=250px src="https://atsign.dev/assets/img/@platform_logo_grey.svg?sanitize=true">

## at_ve_doctor

Expand Down

0 comments on commit 23032dc

Please sign in to comment.