X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fsharding%2FDistributedShardFactory.java;h=f1cdcd8dda9476c65e9637968fe11480b0ae4dfe;hp=6271bf576679df006c5a450b297fc8239618d158;hb=7204c455a1636a7fc89bcd28fe9e9000eaa81b3b;hpb=afba6e0dc3885261f7f205b5957347aa0744c777 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardFactory.java index 6271bf5766..f1cdcd8dda 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardFactory.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardFactory.java @@ -10,11 +10,10 @@ 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 @@ -31,18 +30,25 @@ 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 replicaMembers) - throws DOMDataTreeShardingConflictException, DOMDataTreeProducerException, - DOMDataTreeShardCreationFailedException; + CompletionStage + createDistributedShard(DOMDataTreeIdentifier prefix, Collection replicaMembers) + throws DOMDataTreeShardingConflictException; - interface DistributedShardRegistration extends Registration { - @Override - void close(); + /** + * Registration of the CDS shard that allows you to remove the shard from the system by closing the registration. + * This removal is done asynchronously. + */ + interface DistributedShardRegistration { + + /** + * Removes the shard from the system, this removal is done asynchronously, the future completes once the + * backend shard is no longer present. + */ + CompletionStage close(); } } \ No newline at end of file