pavel-avilov commented on a change in pull request #16484:
URL: https://github.com/apache/beam/pull/16484#discussion_r791815557
##########
File path: playground/backend/internal/utils/precompiled_objects_utils.go
##########
@@ -34,7 +43,61 @@ func PutPrecompiledObjectsToCategory(categoryName string,
precompiledObjects *cl
Type: object.Type,
PipelineOptions: object.PipelineOptions,
Link: object.Link,
+ DefaultExample: object.DefaultExample,
})
}
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) {
+ value, err := cacheService.GetValue(ctx, ExamplesDataPipelineId,
cache.ExamplesCatalog)
+ if err != nil {
+ logger.Errorf("%s: cache.GetValue: %s\n",
ExamplesDataPipelineId, err.Error())
+ return nil, err
+ }
+ catalog, converted := value.([]*pb.Categories)
+ if !converted {
+ logger.Errorf("%s: couldn't convert value to catalog: %s",
cache.ExamplesCatalog, value)
+ return nil, errors.InternalError("Error during getting the
catalog from cache", "Error during getting catalog")
+ }
+ return catalog, nil
+}
+
+// GetPrecompiledObjectsCatalogFromStorage returns the precompiled objects
catalog from the cloud storage
+func GetPrecompiledObjectsCatalogFromStorage(ctx context.Context, sdk pb.Sdk,
category string) ([]*pb.Categories, error) {
Review comment:
This goes from [[BEAM-13632]](https://github.com/apache/beam/pull/16493)
--
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]