Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.intent.impl; |
| 2 | |
| 3 | public class DummyIdBlockAllocator implements IdBlockAllocator { |
| 4 | private long blockTop; |
| 5 | private static final long BLOCK_SIZE = 0x1000000L; |
| 6 | |
| 7 | /** |
| 8 | * Returns a block of IDs which are unique and unused. |
| 9 | * Range of IDs is fixed size and is assigned incrementally as this method |
| 10 | * called. |
| 11 | * |
| 12 | * @return an IdBlock containing a set of unique IDs |
| 13 | */ |
| 14 | @Override |
| 15 | public IdBlock allocateUniqueIdBlock() { |
| 16 | synchronized (this) { |
| 17 | long blockHead = blockTop; |
| 18 | long blockTail = blockTop + BLOCK_SIZE; |
| 19 | |
| 20 | IdBlock block = new IdBlock(blockHead, BLOCK_SIZE); |
| 21 | blockTop = blockTail; |
| 22 | |
| 23 | return block; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | @Override |
| 28 | public IdBlock allocateUniqueIdBlock(long range) { |
| 29 | throw new UnsupportedOperationException("Not supported yet"); |
| 30 | } |
| 31 | } |