Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: pkg/barback/lib/src/package_provider.dart

Issue 554783003: Add the ability for a PackageProvider to declare static packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/barback/lib/src/graph/static_asset_cascade.dart ('k') | pkg/barback/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/barback/lib/src/package_provider.dart
diff --git a/pkg/barback/lib/src/package_provider.dart b/pkg/barback/lib/src/package_provider.dart
index fe440f72ae07ed5a2d357bf0aa796e2b42926c48..ce6ee23355e7f5882a88d3d515b2a61057772665 100644
--- a/pkg/barback/lib/src/package_provider.dart
+++ b/pkg/barback/lib/src/package_provider.dart
@@ -24,5 +24,26 @@ abstract class PackageProvider {
///
/// This should be re-entrant; it may be called multiple times with the same
/// id before the previously returned future has completed.
+ ///
+ /// If no asset with [id] exists, the provider should throw an
+ /// [AssetNotFoundException].
Future<Asset> getAsset(AssetId id);
}
+
+/// A PackageProvider for which some packages are known to be static—that is,
+/// the package has no transformers and its assets won't ever change.
+///
+/// For static packages, rather than telling barback up-front which assets that
+/// package contains via [Barback.updateSources], barback will lazily query the
+/// provider for an asset when it's needed. This is much more efficient.
+abstract class StaticPackageProvider implements PackageProvider {
+ /// The names of all static packages provided by this provider.
+ ///
+ /// This must be disjoint from [packages].
+ Iterable<String> get staticPackages;
+
+ /// Returns all ids of assets in [package].
+ ///
+ /// This is used for [Barback.getAllAssets].
+ Stream<AssetId> getAllAssetIds(String package);
+}
« no previous file with comments | « pkg/barback/lib/src/graph/static_asset_cascade.dart ('k') | pkg/barback/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698