tanishqgandhi1908 commented on code in PR #7760:
URL: https://github.com/apache/texera/pull/7760#discussion_r3810555384
##########
common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/model/LakeFSFileDocument.scala:
##########
@@ -36,21 +37,50 @@ object LakeFSFileDocument {
// In the local development or other architectures, this token can be empty.
lazy val userJwtToken: String =
sys.env.getOrElse(EnvironmentalVariable.ENV_USER_JWT_TOKEN, "").trim
+
+ private lazy val datasetPresignEndpoint: String =
+ sys.env
+ .getOrElse(
+
EnvironmentalVariable.ENV_FILE_SERVICE_GET_DATASET_PRESIGNED_URL_ENDPOINT,
+ "http://localhost:9092/api/dataset/presign-download"
+ )
+ .trim
+
+ private lazy val modelPresignEndpoint: String =
+ sys.env
+ .getOrElse(
+
EnvironmentalVariable.ENV_FILE_SERVICE_GET_MODEL_PRESIGNED_URL_ENDPOINT,
+ "http://localhost:9092/api/model/presign-download"
+ )
+ .trim
+
+ /**
+ * The file-service presign-download endpoint serving this resource type.
Each resource type
+ * owns an endpoint because they enforce different access control
+ */
+ def presignEndpointOf(resourceType: ResourceType.Value): String =
+ resourceType match {
+ case ResourceType.Datasets => datasetPresignEndpoint
+ case ResourceType.Models => modelPresignEndpoint
+ }
}
/**
* A read-only document over a single file stored in a LakeFS repository,
addressed by the URI
- * {scheme}:///{repositoryName}/{versionHash}/{fileRelativePath}. This is the
shared behavior
- * for every versioned-file resource (datasets, models, …): the file bytes
are fetched via a
- * presigned URL, falling back to a direct LakeFS fetch.
+ * {scheme}:///{repositoryName}/{versionHash}/{fileRelativePath}.
+ *
+ * Every versioned-file resource (datasets, models, …) reads its files the
same way — fetch the
+ * bytes through a presigned URL, falling back to a direct LakeFS fetch
*
- * @param uri the resolved
{scheme}:///{repositoryName}/{versionHash}/{file} URI
- * @param presignEndpoint the file-service presign-download endpoint for this
resource kind
+ * @param uri the resolved
{scheme}:///{repositoryName}/{versionHash}/{file} URI
+ * @param resourceType which resource this file belongs to, selecting the
presign endpoint
*/
-private[storage] abstract class LakeFSFileDocument(uri: URI, presignEndpoint:
String)
+private[storage] class LakeFSFileDocument(uri: URI, val resourceType:
ResourceType.Value)
Review Comment:
Added a short paragraph covering it.
--
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]