alamar commented on a change in pull request #8897:
URL: https://github.com/apache/ignite/pull/8897#discussion_r602374215
##########
File path: modules/ignite-azure/README.txt
##########
@@ -0,0 +1,32 @@
+Apache Ignite Azure Module
Review comment:
please rename the module to just 'azure' in accordance with e.g. aws
module.
##########
File path: modules/ignite-azure/pom.xml
##########
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>apache-ignite</artifactId>
+ <groupId>org.apache.ignite</groupId>
+ <version>2.11.0-SNAPSHOT</version>
+ <relativePath>../../parent</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>ignite-azure</artifactId>
Review comment:
please add this module to root pom.xml's list of modules. It is never
built currently.
##########
File path:
modules/ignite-azure/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryAzureBlobStoreIpFinder.java
##########
@@ -0,0 +1,344 @@
+package org.apache.ignite.spi.discovery.tcp.ipfinder;
+/*
+ * 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.
+ */
+import com.azure.storage.blob.BlobContainerClient;
+import com.azure.storage.blob.BlobServiceClient;
+import com.azure.storage.blob.BlobServiceClientBuilder;
+import com.azure.storage.blob.models.BlobStorageException;
+import com.azure.storage.blob.specialized.BlockBlobClient;
+import com.azure.storage.common.StorageSharedKeyCredential;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.spi.IgniteSpiConfiguration;
+import org.apache.ignite.spi.IgniteSpiException;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * Azure Blob Storage based IP Finder
+ * <p>
+ * For information about Blob Storage visit <a
href="https://azure.microsoft.com/en-in/services/storage/blobs/">azure.microsoft.com</a>.
+ * <h1 class="header">Configuration</h1>
+ * <h2 class="header">Mandatory</h2>
+ * <ul>
+ * <li>AccountName (see {@link #setAccountName(String)})</li>
+ * <li>AccountKey (see {@link #setAccountKey(String)})</li>
+ * <li>Account Endpoint (see {@link #setAccountEndpoint(String)})</li>
+ * <li>Container Name (see {@link #setContainerName(String)})</li>
+ * </ul>
+ * <h2 class="header">Optional</h2>
+ * <ul>
+ * <li>Shared flag (see {@link #setShared(boolean)})</li>
+ * </ul>
+ * <p>
+ * The finder will create a container with the provided name. The container
will contain entries named
+ * like the following: {@code 192.168.1.136#1001}.
+ * <p>
+ * Note that storing data in Azure Blob Storage service will result in charges
to your Azure account.
+ * Choose another implementation of {@link
org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder} for local
+ * or home network tests.
+ * <p>
+ * Note that this finder is shared by default (see {@link
org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder#isShared()}.
+ */
+public class TcpDiscoveryAzureBlobStoreIpFinder extends
TcpDiscoveryIpFinderAdapter {
+ /** Default object's content. */
+ private static final ByteArrayInputStream OBJECT_CONTENT = new
ByteArrayInputStream(new byte[0]);
+
+ /** Grid logger. */
+ @LoggerResource
+ private IgniteLogger log;
+
+ /** Azure Blob Storage's account name*/
+ private String accountName;
+
+ /** Azure Blob Storage's account key */
+ private String accountKey;
+
+ /** End point URL */
+ private String endPoint;
+
+ /** Container name */
+ private String containerName;
+
+ /** Storage credential */
+ StorageSharedKeyCredential credential;
+
+ /** Blob service client */
+ private BlobServiceClient blobServiceClient;
+
+ /** Blob container client */
+ private BlobContainerClient blobContainerClient;
+
+ /** Init routine guard. */
+ private final AtomicBoolean initGuard = new AtomicBoolean();
+
+ /** Init routine latch. */
+ private final CountDownLatch initLatch = new CountDownLatch(1);
+
+ /**
+ * Default constructor
+ */
+ public TcpDiscoveryAzureBlobStoreIpFinder() {
+ setShared(true);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<InetSocketAddress> getRegisteredAddresses()
throws IgniteSpiException {
+ init();
+
+ Collection<InetSocketAddress> addrs = new ArrayList<>();
+
+ blobContainerClient.listBlobs()
+ .forEach(blobItem -> {
+ try {
+ if (!blobItem.isDeleted())
+ addrs.add(addrFromString(blobItem.getName()));
+ }
+ catch (Exception e) {
+ throw new IgniteSpiException("Failed to get content
from the container: " + containerName, e);
+ }
+ });
+
+ return addrs;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void registerAddresses(Collection<InetSocketAddress>
addrs) throws IgniteSpiException {
+ assert !F.isEmpty(addrs);
+
+ init();
+
+ for (InetSocketAddress addr : addrs) {
+ String key = keyFromAddr(addr);
+
+ BlockBlobClient blobClient =
blobContainerClient.getBlobClient(key).getBlockBlobClient();
+ InputStream dataStream = new
ByteArrayInputStream(OBJECT_CONTENT.readAllBytes());
+
+ try {
+ blobClient.upload(dataStream,
OBJECT_CONTENT.readAllBytes().length);
+ } catch (BlobStorageException e) {
Review comment:
catch ( is still not located on next line regarding the preceding }
##########
File path: modules/ignite-azure/pom.xml
##########
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>apache-ignite</artifactId>
+ <groupId>org.apache.ignite</groupId>
+ <version>2.11.0-SNAPSHOT</version>
+ <relativePath>../../parent</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>ignite-azure</artifactId>
+ <version>2.11.0-SNAPSHOT</version>
+ <url>http://ignite.apache.org</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-core</artifactId>
+ <version>2.11.0-SNAPSHOT</version>
Review comment:
Please use ${project.version}
##########
File path: modules/ignite-azure/README.txt
##########
@@ -0,0 +1,32 @@
+Apache Ignite Azure Module
Review comment:
Module directory should be modules/azure but module name ignite-azure.
##########
File path:
modules/ignite-azure/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryAzureBlobStoreIpFinder.java
##########
@@ -0,0 +1,344 @@
+package org.apache.ignite.spi.discovery.tcp.ipfinder;
+/*
+ * 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.
+ */
+import com.azure.storage.blob.BlobContainerClient;
+import com.azure.storage.blob.BlobServiceClient;
+import com.azure.storage.blob.BlobServiceClientBuilder;
+import com.azure.storage.blob.models.BlobStorageException;
+import com.azure.storage.blob.specialized.BlockBlobClient;
+import com.azure.storage.common.StorageSharedKeyCredential;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.spi.IgniteSpiConfiguration;
+import org.apache.ignite.spi.IgniteSpiException;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * Azure Blob Storage based IP Finder
+ * <p>
+ * For information about Blob Storage visit <a
href="https://azure.microsoft.com/en-in/services/storage/blobs/">azure.microsoft.com</a>.
+ * <h1 class="header">Configuration</h1>
+ * <h2 class="header">Mandatory</h2>
+ * <ul>
+ * <li>AccountName (see {@link #setAccountName(String)})</li>
+ * <li>AccountKey (see {@link #setAccountKey(String)})</li>
+ * <li>Account Endpoint (see {@link #setAccountEndpoint(String)})</li>
+ * <li>Container Name (see {@link #setContainerName(String)})</li>
+ * </ul>
+ * <h2 class="header">Optional</h2>
+ * <ul>
+ * <li>Shared flag (see {@link #setShared(boolean)})</li>
+ * </ul>
+ * <p>
+ * The finder will create a container with the provided name. The container
will contain entries named
+ * like the following: {@code 192.168.1.136#1001}.
+ * <p>
+ * Note that storing data in Azure Blob Storage service will result in charges
to your Azure account.
+ * Choose another implementation of {@link
org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder} for local
+ * or home network tests.
+ * <p>
+ * Note that this finder is shared by default (see {@link
org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder#isShared()}.
+ */
+public class TcpDiscoveryAzureBlobStoreIpFinder extends
TcpDiscoveryIpFinderAdapter {
+ /** Default object's content. */
+ private static final ByteArrayInputStream OBJECT_CONTENT = new
ByteArrayInputStream(new byte[0]);
+
+ /** Grid logger. */
+ @LoggerResource
+ private IgniteLogger log;
+
+ /** Azure Blob Storage's account name*/
+ private String accountName;
+
+ /** Azure Blob Storage's account key */
+ private String accountKey;
+
+ /** End point URL */
+ private String endPoint;
+
+ /** Container name */
+ private String containerName;
+
+ /** Storage credential */
+ StorageSharedKeyCredential credential;
+
+ /** Blob service client */
+ private BlobServiceClient blobServiceClient;
+
+ /** Blob container client */
+ private BlobContainerClient blobContainerClient;
+
+ /** Init routine guard. */
+ private final AtomicBoolean initGuard = new AtomicBoolean();
+
+ /** Init routine latch. */
+ private final CountDownLatch initLatch = new CountDownLatch(1);
+
+ /**
+ * Default constructor
+ */
+ public TcpDiscoveryAzureBlobStoreIpFinder() {
+ setShared(true);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<InetSocketAddress> getRegisteredAddresses()
throws IgniteSpiException {
+ init();
+
+ Collection<InetSocketAddress> addrs = new ArrayList<>();
+
+ blobContainerClient.listBlobs()
+ .forEach(blobItem -> {
+ try {
+ if (!blobItem.isDeleted())
+ addrs.add(addrFromString(blobItem.getName()));
+ }
+ catch (Exception e) {
+ throw new IgniteSpiException("Failed to get content
from the container: " + containerName, e);
+ }
+ });
+
+ return addrs;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void registerAddresses(Collection<InetSocketAddress>
addrs) throws IgniteSpiException {
+ assert !F.isEmpty(addrs);
+
+ init();
+
+ for (InetSocketAddress addr : addrs) {
+ String key = keyFromAddr(addr);
+
+ BlockBlobClient blobClient =
blobContainerClient.getBlobClient(key).getBlockBlobClient();
+ InputStream dataStream = new
ByteArrayInputStream(OBJECT_CONTENT.readAllBytes());
Review comment:
readAllBytes() not available under Java 8. Why not just have a
zero-length byte[] here?
##########
File path: modules/ignite-azure/pom.xml
##########
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>apache-ignite</artifactId>
Review comment:
artifact should be ignite-parent and version "1"
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]