-
Notifications
You must be signed in to change notification settings - Fork 998
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Azure blob storage support in Java feature server (#2319)
- Add azure blob storage support in java feature server - Fix S3 integration test to work without a real AWS account - Add GCS mock to integration tests to be able to run them without a real google cloud account - Adding dependency management in maven for libraries with older incompatible versions as transitive dependencies
- Loading branch information
1 parent
34cabfb
commit 7aab7d7
Showing
10 changed files
with
335 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,7 @@ feast-serving.jar | |
/.nb-gradle/ | ||
|
||
## Feast Temporary Files ## | ||
/temp/ | ||
/temp/ | ||
|
||
## Generated test data ## | ||
**/*.parquet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
java/serving/src/main/java/feast/serving/registry/AzureRegistryFile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Copyright 2018-2021 The Feast Authors | ||
* | ||
* Licensed 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 | ||
* | ||
* https://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 feast.serving.registry; | ||
|
||
import com.azure.storage.blob.BlobClient; | ||
import com.azure.storage.blob.BlobServiceClient; | ||
import com.google.protobuf.InvalidProtocolBufferException; | ||
import feast.proto.core.RegistryProto; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
|
||
public class AzureRegistryFile implements RegistryFile { | ||
private final BlobClient blobClient; | ||
private String lastKnownETag; | ||
|
||
public AzureRegistryFile(BlobServiceClient blobServiceClient, String url) { | ||
String[] split = url.replace("az://", "").split("/"); | ||
String objectPath = String.join("/", java.util.Arrays.copyOfRange(split, 1, split.length)); | ||
this.blobClient = blobServiceClient.getBlobContainerClient(split[0]).getBlobClient(objectPath); | ||
} | ||
|
||
@Override | ||
public RegistryProto.Registry getContent() { | ||
try { | ||
return RegistryProto.Registry.parseFrom(blobClient.downloadContent().toBytes()); | ||
} catch (InvalidProtocolBufferException e) { | ||
throw new RuntimeException( | ||
String.format( | ||
"Couldn't read remote registry: %s. Error: %s", | ||
blobClient.getBlobUrl(), e.getMessage())); | ||
} | ||
} | ||
|
||
@Override | ||
public Optional<RegistryProto.Registry> getContentIfModified() { | ||
String eTag = blobClient.getProperties().getETag(); | ||
if (Objects.equals(eTag, this.lastKnownETag)) { | ||
return Optional.empty(); | ||
} else this.lastKnownETag = eTag; | ||
|
||
return Optional.of(getContent()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.