ilya-kozyrev commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r786793309
##########
File path: playground/backend/cmd/server/controller.go
##########
@@ -241,22 +241,27 @@ func (controller *playgroundController) Cancel(ctx
context.Context, info *pb.Can
}
// GetPrecompiledObjects returns the list of examples
+// - If SDK and category are unspecified in the request, gets the whole
catalog from the cache
+// - If there is no catalog in the cache, gets the catalog from the
Storage and saves it to the cache
+// - If SDK or category is specified in the request, gets the specific catalog
from the Storage
func (controller *playgroundController) GetPrecompiledObjects(ctx
context.Context, info *pb.GetPrecompiledObjectsRequest)
(*pb.GetPrecompiledObjectsResponse, error) {
- bucket := cloud_bucket.New()
- sdkToCategories, err := bucket.GetPrecompiledObjects(ctx, info.Sdk,
info.Category)
+ if info.Sdk == pb.Sdk_SDK_UNSPECIFIED && info.Category == "" {
Review comment:
why we need this if here?
##########
File path: playground/backend/internal/cache/cache.go
##########
@@ -55,6 +55,9 @@ const (
// LogsIndex is the index of the start of the log
LogsIndex SubKey = "LOGS_INDEX"
+
+ // ExamplesCatalog is catalog of examples available in Playground
+ ExamplesCatalog SubKey = "EXAMPLES_CATALOG"
Review comment:
Instead, make workarounds with subkey without pipeline id. Can we extend
the Cache interface and implementation with SetCatalog, GetKatalog?
##########
File path: playground/backend/internal/utils/precompiled_objects_utils.go
##########
@@ -37,3 +46,37 @@ func PutPrecompiledObjectsToCategory(categoryName string,
precompiledObjects *cl
}
sdkCategory.Categories = append(sdkCategory.Categories, &category)
}
+
+// GetPrecompiledObjectsCatalogFromCache returns the precompiled objects
catalog from the cache
+func GetPrecompiledObjectsCatalogFromCache(ctx context.Context, cacheService
cache.Cache) ([]*pb.Categories, error) {
Review comment:
can we make this name shorter?
GetPrecompiledObjectsFromCache
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]