blob: 02ccccacd603b46774a6a887f04285c984e8cdd3 [file] [log] [blame]
Jonathan Hart74c83132015-02-02 18:37:57 -08001/*
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'Connor87ba7a72015-03-11 14:40:09 -070016package org.onosproject.net.intent;
Jonathan Hart74c83132015-02-02 18:37:57 -080017
Brian O'Connor9476fa12015-06-25 15:17:17 -040018import com.google.common.annotations.Beta;
Brian O'Connor5eb77c82015-03-02 18:09:39 -080019import org.onosproject.cluster.NodeId;
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070020import org.onosproject.event.ListenerService;
Jonathan Hart5ec32ba2015-02-05 13:33:58 -080021
Jonathan Hart74c83132015-02-02 18:37:57 -080022/**
23 * Service for interacting with the partition-to-instance assignments.
24 */
Brian O'Connor9476fa12015-06-25 15:17:17 -040025@Beta
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070026public interface PartitionService
27 extends ListenerService<PartitionEvent, PartitionEventListener> {
Jonathan Hart74c83132015-02-02 18:37:57 -080028
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 Hart5ec32ba2015-02-05 13:33:58 -080036 boolean isMine(Key intentKey);
Jonathan Hart74c83132015-02-02 18:37:57 -080037
Brian O'Connor5eb77c82015-03-02 18:09:39 -080038 /**
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 Hart74c83132015-02-02 18:37:57 -080046 // TODO add API for rebalancing partitions
Brian O'Connor69d6ac72015-05-29 16:24:06 -070047
Jonathan Hart74c83132015-02-02 18:37:57 -080048}