-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: executeUpdate * refactor: fail_ci_if_error: false due to codecov/codecov-action#598 * export 'src/interface/transactionally_storage.dart'; * changelog
- Loading branch information
Showing
9 changed files
with
88 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,3 +58,5 @@ jobs: | |
run: dart pub global run coverage:format_coverage --lcov --in=coverage.json --out=lcov.info --report-on=lib | ||
|
||
- uses: codecov/[email protected] | ||
with: | ||
fail_ci_if_error: false |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import 'package:meta/meta.dart'; | ||
import 'dart:async'; | ||
|
||
import 'storage.dart'; | ||
|
||
/// Transform a value to another value of the same type. | ||
typedef Transformer<T> = FutureOr<T> Function(T); | ||
|
||
/// A persistent store for simple data. | ||
/// Data is persisted to disk asynchronously and transactionally. | ||
abstract class TransactionallyStorage<Key extends Object, Options> | ||
implements Storage<Key, Options> { | ||
/// `Read–modify–write`. | ||
/// | ||
/// Updates the data transactionally in an atomic read-modify-write operation. | ||
/// All operations are serialized, and the [transformer] can perform asynchronous computations | ||
/// such as RPCs, database queries, API calls, etc. | ||
/// | ||
/// The future completes when the data has been persisted durably to disk. | ||
/// If the transform or write to disk fails, the transaction is aborted and the error is rethrown. | ||
/// | ||
/// When calling this, logic will be executed in the following order: | ||
/// - Read raw value by [key], then decode it with [decoder]. | ||
/// - Transform the decoded value with [transformer]. | ||
/// - Encode the transformed value with [encoder]. | ||
/// - Finally, save encoded value to persistent storage. | ||
@experimental | ||
Future<void> executeUpdate<T extends Object>({ | ||
required Key key, | ||
required Decoder<T?> decoder, | ||
required Transformer<T?> transformer, | ||
required Encoder<T?> encoder, | ||
Options? options, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters