Toshio Koide | 106d449 | 2014-10-28 11:22:02 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 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 | */ |
| 16 | package org.onlab.onos.net.resource; |
| 17 | |
| 18 | import java.util.Set; |
| 19 | |
| 20 | import org.onlab.onos.net.Link; |
| 21 | import org.onlab.onos.net.intent.IntentId; |
| 22 | |
Toshio Koide | 106d449 | 2014-10-28 11:22:02 -0700 | [diff] [blame] | 23 | /** |
| 24 | * Manages link resources. |
| 25 | */ |
| 26 | public interface LinkResourceStore { |
Toshio Koide | 07df706 | 2014-10-30 10:54:25 -0700 | [diff] [blame] | 27 | /** |
| 28 | * Returns free resources for given link. |
| 29 | * |
| 30 | * @param link a target link |
| 31 | * @return free resources for given link |
| 32 | */ |
Toshio Koide | 106d449 | 2014-10-28 11:22:02 -0700 | [diff] [blame] | 33 | Set<ResourceAllocation> getFreeResources(Link link); |
| 34 | |
Toshio Koide | 07df706 | 2014-10-30 10:54:25 -0700 | [diff] [blame] | 35 | /** |
| 36 | * Allocates resources. |
| 37 | * |
| 38 | * @param allocations resources to be allocated |
| 39 | */ |
Toshio Koide | 106d449 | 2014-10-28 11:22:02 -0700 | [diff] [blame] | 40 | void allocateResources(LinkResourceAllocations allocations); |
| 41 | |
Toshio Koide | 07df706 | 2014-10-30 10:54:25 -0700 | [diff] [blame] | 42 | /** |
| 43 | * Releases resources. |
| 44 | * |
| 45 | * @param allocations resources to be released |
| 46 | */ |
Toshio Koide | 106d449 | 2014-10-28 11:22:02 -0700 | [diff] [blame] | 47 | void releaseResources(LinkResourceAllocations allocations); |
| 48 | |
Toshio Koide | 07df706 | 2014-10-30 10:54:25 -0700 | [diff] [blame] | 49 | /** |
| 50 | * Returns resources allocated for an Intent. |
| 51 | * |
| 52 | * @param intentId the target Intent's ID |
| 53 | * @return allocated resources |
| 54 | */ |
Toshio Koide | 106d449 | 2014-10-28 11:22:02 -0700 | [diff] [blame] | 55 | LinkResourceAllocations getAllocations(IntentId intentId); |
| 56 | |
Toshio Koide | 07df706 | 2014-10-30 10:54:25 -0700 | [diff] [blame] | 57 | /** |
| 58 | * Returns resources allocated for a link. |
| 59 | * |
| 60 | * @param link the target link |
| 61 | * @return allocated resources |
| 62 | */ |
Toshio Koide | 106d449 | 2014-10-28 11:22:02 -0700 | [diff] [blame] | 63 | Iterable<LinkResourceAllocations> getAllocations(Link link); |
| 64 | |
Toshio Koide | 07df706 | 2014-10-30 10:54:25 -0700 | [diff] [blame] | 65 | /** |
| 66 | * Returns all allocated resources. |
| 67 | * |
| 68 | * @return allocated resources |
| 69 | */ |
Toshio Koide | 106d449 | 2014-10-28 11:22:02 -0700 | [diff] [blame] | 70 | Iterable<LinkResourceAllocations> getAllocations(); |
| 71 | } |