lasdf1234 commented on code in PR #12194: URL: https://github.com/apache/gravitino/pull/12194#discussion_r3664512613
########## iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/PlanTaskToken.java: ########## @@ -0,0 +1,166 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.gravitino.iceberg.service; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.Optional; +import org.apache.iceberg.catalog.TableIdentifier; +import org.apache.iceberg.rest.requests.PlanTableScanRequest; +import org.apache.iceberg.rest.requests.PlanTableScanRequestParser; +import org.apache.iceberg.util.JsonUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A {@code plan-task} token handed out by {@code POST .../tables/{table}/plan} and redeemed at + * {@code POST .../tables/{table}/tasks}. + * + * <p>The token is self-describing: it carries the table, the scan request it was planned from (with + * the snapshot pinned at planning time) and the slice of the planned file scan tasks it stands for. + * Nothing about the token is stored server side, so it stays valid across server restarts and can + * be redeemed by any Gravitino instance that serves the same catalog. + * + * <p>The token is opaque to clients but is not a capability: it grants no access on its own. {@code + * POST .../tasks} authorizes the table in the request path and rejects a token minted for a + * different table, so a forged token can at most express a scan the caller could already submit + * through {@code POST .../plan}. + */ +class PlanTaskToken { + Review Comment: This is a very good design. But I think there are some properties that don't need to be done.May be 'table‘ + 'limit' + 'offset' + 'scan' can meet the requirements. -- 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]
