blob: f331aa2405cc13781c93c5547055645f4262e9ca [file] [log] [blame]
Brian O'Connor66630c82014-10-02 21:08:19 -07001package org.onlab.onos.net.intent.impl;
2
3public 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}