@@ -0,0 +1,2882 @@
+/*%0A * Copyright 2021 LinkedIn Corp. All rights reserved.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A *%0A */%0A%0Apackage com.github.ambry.frontend;%0A%0Aimport java.util.Collections;%0Aimport java.util.Map;%0Aimport java.util.concurrent.CompletableFuture;%0A%0A%0A/**%0A * A layer for getting mapping Ambry blob Ids for external service url paths. Implementations of this could also do other%0A * operations such as validations of incoming request based on its headers such as authorization, date etc.%0A */%0Apublic interface BlobMappingExtension %7B%0A%0A  /**%0A   * Return a mapping record %7B@link BlobMappingRecord%7D from external service url paths to Ambry blob Ids.%0A   * @param externalPath path of external url.%0A   * @param requestHeaders map of incoming request headers like authorization, date etc that might be used to validate%0A   *                       incoming request before fetching Ambry blob mapping.%0A   * @return a %7B@link CompletableFuture%7D that will eventually contain either the %7B@link BlobMappingRecord%7D record%0A   *         or an exception given by the external service.%0A   */%0A  CompletableFuture%3CBlobMappingRecord%3E getBlobMapping(String externalPath, Map%3CString, String%3E requestHeaders);%0A%0A  /**%0A   * Represents a mapping record of external url path to Ambry blob Id and any headers such as cache-control, etc which%0A   * might need to be included in response to the request.%0A   */%0A  class BlobMappingRecord %7B%0A    private final String externalPath;%0A    private final String ambryId;%0A    private final Map%3CString, String%3E responseHeaders;%0A%0A    /**%0A     * @param externalPath external url path.%0A     * @param ambryId Ambry blob Id.%0A     * @param responseHeaders headers which needs to be included in response for this request. For example, cache-control, etc.%0A     */%0A    public BlobMappingRecord(String externalPath, String ambryId, Map%3CString, String%3E responseHeaders) %7B%0A      this.externalPath = externalPath;%0A      this.ambryId = ambryId;%0A      this.responseHeaders = responseHeaders;%0A    %7D%0A%0A    /**%0A     * @return the external url path.%0A     */%0A    public String getExternalId() %7B%0A      return externalPath;%0A    %7D%0A%0A    /**%0A     * @return the mapping Ambry blob ID.%0A     */%0A    public String getAmbryId() %7B%0A      return ambryId;%0A    %7D%0A%0A    /**%0A     * @return headers which needs to be included in response for this request. For example, cache-control, etc.%0A     */%0A    public Map%3CString, String%3E getResponseHeaders() %7B%0A      return Collections.unmodifiableMap(responseHeaders);%0A    %7D%0A  %7D%0A%7D%0A

Define BlobMappingExtension interface for getting mapping Ambry blob Ids for external url paths (#1850)