Jonathan Hart | 74c8313 | 2015-02-02 18:37:57 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Brian O'Connor | 87ba7a7 | 2015-03-11 14:40:09 -0700 | [diff] [blame] | 16 | package org.onosproject.net.intent; |
Jonathan Hart | 74c8313 | 2015-02-02 18:37:57 -0800 | [diff] [blame] | 17 | |
Brian O'Connor | 9476fa1 | 2015-06-25 15:17:17 -0400 | [diff] [blame] | 18 | import com.google.common.annotations.Beta; |
Brian O'Connor | 5eb77c8 | 2015-03-02 18:09:39 -0800 | [diff] [blame] | 19 | import org.onosproject.cluster.NodeId; |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 20 | import org.onosproject.event.ListenerService; |
Jonathan Hart | 5ec32ba | 2015-02-05 13:33:58 -0800 | [diff] [blame] | 21 | |
Jonathan Hart | 74c8313 | 2015-02-02 18:37:57 -0800 | [diff] [blame] | 22 | /** |
Madan Jampani | 1c96510 | 2016-01-13 14:34:16 -0800 | [diff] [blame] | 23 | * Service for interacting with the intent partition-to-instance assignments. |
Jonathan Hart | 74c8313 | 2015-02-02 18:37:57 -0800 | [diff] [blame] | 24 | */ |
Brian O'Connor | 9476fa1 | 2015-06-25 15:17:17 -0400 | [diff] [blame] | 25 | @Beta |
Madan Jampani | 1c96510 | 2016-01-13 14:34:16 -0800 | [diff] [blame] | 26 | public interface IntentPartitionService |
| 27 | extends ListenerService<IntentPartitionEvent, IntentPartitionEventListener> { |
Jonathan Hart | 74c8313 | 2015-02-02 18:37:57 -0800 | [diff] [blame] | 28 | |
| 29 | /** |
| 30 | * Returns whether the given intent key is in a partition owned by this |
| 31 | * instance or not. |
| 32 | * |
| 33 | * @param intentKey intent key to query |
| 34 | * @return true if the key is owned by this instance, otherwise false |
| 35 | */ |
Jonathan Hart | 5ec32ba | 2015-02-05 13:33:58 -0800 | [diff] [blame] | 36 | boolean isMine(Key intentKey); |
Jonathan Hart | 74c8313 | 2015-02-02 18:37:57 -0800 | [diff] [blame] | 37 | |
Brian O'Connor | 5eb77c8 | 2015-03-02 18:09:39 -0800 | [diff] [blame] | 38 | /** |
| 39 | * Returns the leader for a particular key. |
| 40 | * |
| 41 | * @param intentKey intent key to query |
| 42 | * @return the leader node |
| 43 | */ |
| 44 | NodeId getLeader(Key intentKey); |
| 45 | |
Jonathan Hart | 74c8313 | 2015-02-02 18:37:57 -0800 | [diff] [blame] | 46 | // TODO add API for rebalancing partitions |
Brian O'Connor | 69d6ac7 | 2015-05-29 16:24:06 -0700 | [diff] [blame] | 47 | |
Jonathan Hart | 74c8313 | 2015-02-02 18:37:57 -0800 | [diff] [blame] | 48 | } |