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.datastore;
11 import java.util.Collection;
12 import org.opendaylight.controller.cluster.access.concepts.MemberName;
13 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
14 import org.opendaylight.mdsal.dom.api.DOMDataTreeProducerException;
15 import org.opendaylight.mdsal.dom.api.DOMDataTreeShardingConflictException;
16 import org.opendaylight.yangtools.concepts.Registration;
19 * A factory that handles addition of new clustered shard's based on a prefix. This factory is a QoL class that handles
20 * all the boilerplate that comes with registration of a new clustered shard into the system and creating the backend
21 * shard/replicas that come along with it.
23 public interface DistributedShardFactory {
26 * Register a new shard that is rooted at the desired prefix with replicas on the provided members.
27 * Note to register a shard without replicas you still need to provide at least one Member for the shard.
29 * @param prefix Shard root
30 * @param replicaMembers Members that this shard is replicated on, has to have at least one Member even if the shard
31 * should not be replicated.
32 * @return ShardRegistration that should be closed if the shard should be destroyed
33 * @throws DOMDataTreeShardingConflictException If the prefix already has a shard registered
34 * @throws DOMDataTreeProducerException in case there is a problem closing the initial producer that is used to
35 * register the shard into the ShardingService
37 DistributedShardRegistration createDistributedShard(DOMDataTreeIdentifier prefix,
38 Collection<MemberName> replicaMembers)
39 throws DOMDataTreeShardingConflictException, DOMDataTreeProducerException;
41 interface DistributedShardRegistration extends Registration {