Committed by
Ray Milkey
update and get available link resource consindering existing linkAllocations
Change-Id: Iee93253d253ff38d23630a2c5ac9c0a14329d92f
Showing
3 changed files
with
10 additions
and
7 deletions
| ... | @@ -86,7 +86,7 @@ public interface LinkResourceService { | ... | @@ -86,7 +86,7 @@ public interface LinkResourceService { |
| 86 | * @param allocations allocations to be included as available | 86 | * @param allocations allocations to be included as available |
| 87 | * @return available resources for the target link | 87 | * @return available resources for the target link |
| 88 | */ | 88 | */ |
| 89 | - ResourceRequest getAvailableResources(Link link, | 89 | + Iterable<ResourceRequest> getAvailableResources(Link link, |
| 90 | LinkResourceAllocations allocations); | 90 | LinkResourceAllocations allocations); |
| 91 | 91 | ||
| 92 | } | 92 | } | ... | ... |
| ... | @@ -269,7 +269,7 @@ public class IntentTestsMocks { | ... | @@ -269,7 +269,7 @@ public class IntentTestsMocks { |
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | @Override | 271 | @Override |
| 272 | - public ResourceRequest getAvailableResources(Link link, LinkResourceAllocations allocations) { | 272 | + public Iterable<ResourceRequest> getAvailableResources(Link link, LinkResourceAllocations allocations) { |
| 273 | return null; | 273 | return null; |
| 274 | } | 274 | } |
| 275 | } | 275 | } | ... | ... |
| ... | @@ -156,8 +156,8 @@ public class LinkResourceManager implements LinkResourceService { | ... | @@ -156,8 +156,8 @@ public class LinkResourceManager implements LinkResourceService { |
| 156 | @Override | 156 | @Override |
| 157 | public LinkResourceAllocations updateResources(LinkResourceRequest req, | 157 | public LinkResourceAllocations updateResources(LinkResourceRequest req, |
| 158 | LinkResourceAllocations oldAllocations) { | 158 | LinkResourceAllocations oldAllocations) { |
| 159 | - // TODO | 159 | + releaseResources(oldAllocations); |
| 160 | - return null; | 160 | + return requestResources(req); |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | @Override | 163 | @Override |
| ... | @@ -196,10 +196,13 @@ public class LinkResourceManager implements LinkResourceService { | ... | @@ -196,10 +196,13 @@ public class LinkResourceManager implements LinkResourceService { |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | @Override | 198 | @Override |
| 199 | - public ResourceRequest getAvailableResources(Link link, | 199 | + public Iterable<ResourceRequest> getAvailableResources(Link link, |
| 200 | LinkResourceAllocations allocations) { | 200 | LinkResourceAllocations allocations) { |
| 201 | - // TODO | 201 | + Set<ResourceRequest> result = new HashSet<>(); |
| 202 | - return null; | 202 | + Set<ResourceAllocation> allocatedRes = allocations.getResourceAllocation(link); |
| 203 | + result = (Set<ResourceRequest>) getAvailableResources(link); | ||
| 204 | + result.addAll(allocatedRes); | ||
| 205 | + return result; | ||
| 203 | } | 206 | } |
| 204 | 207 | ||
| 205 | } | 208 | } | ... | ... |
-
Please register or login to post a comment