Bump versions to 4.0.0-SNAPSHOT
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / sharding / DistributedShardFactory.java
index 6271bf576679df006c5a450b297fc8239618d158..c3c3a25a2bc645242291f2758b48692577fc319f 100644 (file)
@@ -5,16 +5,14 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.controller.cluster.sharding;
 
 import com.google.common.annotations.Beta;
 import java.util.Collection;
+import java.util.concurrent.CompletionStage;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeProducerException;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeShardingConflictException;
-import org.opendaylight.yangtools.concepts.Registration;
 
 /**
  * A factory that handles addition of new clustered shard's based on a prefix. This factory is a QoL class that handles
@@ -22,8 +20,8 @@ import org.opendaylight.yangtools.concepts.Registration;
  * shard/replicas that come along with it.
  */
 @Beta
+@Deprecated(forRemoval = true)
 public interface DistributedShardFactory {
-
     /**
      * Register a new shard that is rooted at the desired prefix with replicas on the provided members.
      * Note to register a shard without replicas you still need to provide at least one Member for the shard.
@@ -31,18 +29,12 @@ public interface DistributedShardFactory {
      * @param prefix         Shard root
      * @param replicaMembers Members that this shard is replicated on, has to have at least one Member even if the shard
      *                       should not be replicated.
-     * @return ShardRegistration that should be closed if the shard should be destroyed
-     * @throws DOMDataTreeShardingConflictException If the prefix already has a shard registered
-     * @throws DOMDataTreeProducerException in case there is a problem closing the initial producer that is used to
-     *                                      register the shard into the ShardingService
+     * @return A future that will be completed with a DistributedShardRegistration once the backend and frontend shards
+     *         are spawned.
+     * @throws DOMDataTreeShardingConflictException If the initial check for a conflict on the local node fails, the
+     *         sharding configuration won't be updated if this exception is thrown.
      */
-    DistributedShardRegistration createDistributedShard(DOMDataTreeIdentifier prefix,
-                                                        Collection<MemberName> replicaMembers)
-            throws DOMDataTreeShardingConflictException, DOMDataTreeProducerException,
-            DOMDataTreeShardCreationFailedException;
-
-    interface DistributedShardRegistration extends Registration {
-        @Override
-        void close();
-    }
+    CompletionStage<DistributedShardRegistration>
+        createDistributedShard(DOMDataTreeIdentifier prefix, Collection<MemberName> replicaMembers)
+            throws DOMDataTreeShardingConflictException;
 }
\ No newline at end of file