2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.cluster.sharding;
11 import com.google.common.annotations.Beta;
12 import java.util.Collection;
13 import org.opendaylight.controller.cluster.access.concepts.MemberName;
14 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
15 import org.opendaylight.mdsal.dom.api.DOMDataTreeProducerException;
16 import org.opendaylight.mdsal.dom.api.DOMDataTreeShardingConflictException;
17 import org.opendaylight.yangtools.concepts.Registration;
20 * A factory that handles addition of new clustered shard's based on a prefix. This factory is a QoL class that handles
21 * all the boilerplate that comes with registration of a new clustered shard into the system and creating the backend
22 * shard/replicas that come along with it.
25 public interface DistributedShardFactory {
28 * Register a new shard that is rooted at the desired prefix with replicas on the provided members.
29 * Note to register a shard without replicas you still need to provide at least one Member for the shard.
31 * @param prefix Shard root
32 * @param replicaMembers Members that this shard is replicated on, has to have at least one Member even if the shard
33 * should not be replicated.
34 * @return ShardRegistration that should be closed if the shard should be destroyed
35 * @throws DOMDataTreeShardingConflictException If the prefix already has a shard registered
36 * @throws DOMDataTreeProducerException in case there is a problem closing the initial producer that is used to
37 * register the shard into the ShardingService
39 DistributedShardRegistration createDistributedShard(DOMDataTreeIdentifier prefix,
40 Collection<MemberName> replicaMembers)
41 throws DOMDataTreeShardingConflictException, DOMDataTreeProducerException,
42 DOMDataTreeShardCreationFailedException;
44 interface DistributedShardRegistration extends Registration {