BUG-3128: Update RPC router concepts
[controller.git] / opendaylight / md-sal / sal-dom-api / src / main / java / org / opendaylight / controller / md / sal / dom / api / DOMDataTreeShardingService.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.md.sal.dom.api;
9
10 import javax.annotation.Nonnull;
11 import org.opendaylight.yangtools.concepts.ListenerRegistration;
12
13 /**
14  * A {@link DOMService} providing access to details on how the conceptual data tree
15  * is distributed among providers (also known as shards). Each shard is tied to a
16  * single {@link DOMDataTreeIdentifier}. Based on those data tree identifiers, the
17  * shards are organized in a tree, where there is a logical parent/child relationship.
18  *
19  * It is not allowed to attach two shards to the same data tree identifier, which means
20  * the mapping of each piece of information has an unambiguous home. When accessing
21  * the information, the shard with the longest matching data tree identifier is used,
22  * which is why this interface treats it is a prefix.
23  *
24  * Whenever a parent/child relationship is changed, the parent is notified, so it can
25  * understand that a logical child has been attached.
26  */
27 public interface DOMDataTreeShardingService extends DOMService {
28     /**
29      * Register a shard as responsible for a particular subtree prefix.
30      *
31      * @param prefix Data tree identifier, may not be null.
32      * @param shard Responsible shard instance
33      * @return A registration. To remove the shard's binding, close the registration.
34      * @throws DOMDataTreeShardingConflictException if the prefix is already bound
35      */
36     @Nonnull <T extends DOMDataTreeShard> ListenerRegistration<T> registerDataTreeShard(@Nonnull DOMDataTreeIdentifier prefix, @Nonnull T shard) throws DOMDataTreeShardingConflictException;
37 }