Class IdUtils
- java.lang.Object
-
- org.opendaylight.genius.idmanager.IdUtils
-
@Singleton public class IdUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_DELAY_TIME
static int
RETRY_COUNT
-
Constructor Summary
Constructors Constructor Description IdUtils()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
computeBlockSize(long low, long high)
AvailableIdsHolder
createAvailableIdsHolder(long low, long high, long cursor)
protected ChildPools
createChildPool(java.lang.String childPoolName)
DelayedIdEntries
createDelayedIdEntry(long idValue, long delayTime)
protected IdPool
createGlobalPool(java.lang.String poolName, long low, long high, long blockSize)
IdEntries
createIdEntries(java.lang.String idKey, java.util.List<org.opendaylight.yangtools.yang.common.Uint32> newIdVals)
protected ReleasedIdsHolder
createReleasedIdsHolder(long availableIdCount, long delayTime)
void
decrementPoolUpdatedMap(java.lang.String localPoolName)
void
freeExcessAvailableIds(ReleasedIdHolder releasedIdHolder, ReleasedIdsHolderBuilder releasedIdsParent, long idCountToBeFreed)
Changes made to the parameters passed are not persisted to the Datastore.long
getAvailableIdsCount(AvailableIdsHolderBuilder availableIds)
protected AvailableIdsHolderBuilder
getAvailableIdsHolderBuilder(IdPool pool)
protected org.opendaylight.yangtools.yang.binding.InstanceIdentifier<ChildPools>
getChildPoolsInstanceIdentifier(java.lang.String poolName, java.lang.String localPoolName)
org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IdEntries>
getIdEntriesInstanceIdentifier(java.lang.String poolName, java.lang.String idKey)
org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IdEntries>
getIdEntry(org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IdPool> poolName, java.lang.String idKey)
org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IdPool>
getIdPoolInstance(java.lang.String poolName)
org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IdPools>
getIdPools()
java.lang.String
getLocalPoolName(java.lang.String poolName)
boolean
getPoolUpdatedMap(java.lang.String localPoolName)
org.opendaylight.yangtools.yang.binding.InstanceIdentifier<ReleasedIdsHolder>
getReleasedIdsHolderInstance(java.lang.String poolName)
java.util.concurrent.CountDownLatch
getReleaseIdLatch(java.lang.String uniqueIdKey)
protected static ReleasedIdsHolderBuilder
getReleaseIdsHolderBuilder(IdPool pool)
java.lang.String
getUniqueKey(java.lang.String parentPoolName, java.lang.String idKey)
void
incrementPoolUpdatedMap(java.lang.String localPoolName)
protected boolean
isIdAvailable(AvailableIdsHolderBuilder availableIds)
void
lock(LockManagerService lockManager, java.lang.String poolName)
java.util.concurrent.CompletableFuture<java.util.List<org.opendaylight.yangtools.yang.common.Uint32>>
putAllocatedIdsIfAbsent(java.lang.String uniqueIdKey, java.util.concurrent.CompletableFuture<java.util.List<org.opendaylight.yangtools.yang.common.Uint32>> futureIdValues)
void
putReleaseIdLatch(java.lang.String uniqueIdKey, java.util.concurrent.CountDownLatch latch)
java.util.concurrent.CompletableFuture<java.util.List<org.opendaylight.yangtools.yang.common.Uint32>>
removeAllocatedIds(java.lang.String uniqueIdKey)
void
removeFromPoolUpdatedMap(java.lang.String localPoolName)
java.util.concurrent.CountDownLatch
removeReleaseIdLatch(java.lang.String uniqueIdKey)
void
syncAvailableIdHolder(AvailableIdHolder availableIdHolder, IdPoolBuilder idPool)
void
syncReleaseIdHolder(ReleasedIdHolder releasedIdHolder, IdPoolBuilder idPool)
void
unlock(LockManagerService lockManager, java.lang.String poolName)
void
updateChildPool(org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> tx, java.lang.String poolName, java.lang.String localPoolName)
-
-
-
Field Detail
-
DEFAULT_DELAY_TIME
public static final long DEFAULT_DELAY_TIME
- See Also:
- Constant Field Values
-
RETRY_COUNT
public static final int RETRY_COUNT
- See Also:
- Constant Field Values
-
-
Method Detail
-
removeAllocatedIds
public java.util.concurrent.CompletableFuture<java.util.List<org.opendaylight.yangtools.yang.common.Uint32>> removeAllocatedIds(java.lang.String uniqueIdKey)
-
putAllocatedIdsIfAbsent
public java.util.concurrent.CompletableFuture<java.util.List<org.opendaylight.yangtools.yang.common.Uint32>> putAllocatedIdsIfAbsent(java.lang.String uniqueIdKey, java.util.concurrent.CompletableFuture<java.util.List<org.opendaylight.yangtools.yang.common.Uint32>> futureIdValues)
-
putReleaseIdLatch
public void putReleaseIdLatch(java.lang.String uniqueIdKey, java.util.concurrent.CountDownLatch latch)
-
getReleaseIdLatch
public java.util.concurrent.CountDownLatch getReleaseIdLatch(java.lang.String uniqueIdKey)
-
removeReleaseIdLatch
public java.util.concurrent.CountDownLatch removeReleaseIdLatch(java.lang.String uniqueIdKey)
-
getIdEntry
public org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IdEntries> getIdEntry(org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IdPool> poolName, java.lang.String idKey)
-
createIdEntries
public IdEntries createIdEntries(java.lang.String idKey, java.util.List<org.opendaylight.yangtools.yang.common.Uint32> newIdVals)
-
createDelayedIdEntry
public DelayedIdEntries createDelayedIdEntry(long idValue, long delayTime)
-
createGlobalPool
protected IdPool createGlobalPool(java.lang.String poolName, long low, long high, long blockSize)
-
createAvailableIdsHolder
public AvailableIdsHolder createAvailableIdsHolder(long low, long high, long cursor)
-
createReleasedIdsHolder
protected ReleasedIdsHolder createReleasedIdsHolder(long availableIdCount, long delayTime)
-
getIdPoolInstance
public org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IdPool> getIdPoolInstance(java.lang.String poolName)
-
getReleasedIdsHolderInstance
public org.opendaylight.yangtools.yang.binding.InstanceIdentifier<ReleasedIdsHolder> getReleasedIdsHolderInstance(java.lang.String poolName)
-
isIdAvailable
protected boolean isIdAvailable(AvailableIdsHolderBuilder availableIds)
-
getLocalPoolName
public java.lang.String getLocalPoolName(java.lang.String poolName)
-
createChildPool
protected ChildPools createChildPool(java.lang.String childPoolName)
-
getAvailableIdsHolderBuilder
protected AvailableIdsHolderBuilder getAvailableIdsHolderBuilder(IdPool pool)
-
getReleaseIdsHolderBuilder
protected static ReleasedIdsHolderBuilder getReleaseIdsHolderBuilder(IdPool pool)
-
freeExcessAvailableIds
public void freeExcessAvailableIds(ReleasedIdHolder releasedIdHolder, ReleasedIdsHolderBuilder releasedIdsParent, long idCountToBeFreed)
Changes made to the parameters passed are not persisted to the Datastore. Method invoking should ensure that these gets persisted.
-
getIdEntriesInstanceIdentifier
public org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IdEntries> getIdEntriesInstanceIdentifier(java.lang.String poolName, java.lang.String idKey)
-
getChildPoolsInstanceIdentifier
protected org.opendaylight.yangtools.yang.binding.InstanceIdentifier<ChildPools> getChildPoolsInstanceIdentifier(java.lang.String poolName, java.lang.String localPoolName)
-
computeBlockSize
public long computeBlockSize(long low, long high)
-
getAvailableIdsCount
public long getAvailableIdsCount(AvailableIdsHolderBuilder availableIds)
-
lock
public void lock(LockManagerService lockManager, java.lang.String poolName) throws IdManagerException
- Throws:
IdManagerException
-
unlock
public void unlock(LockManagerService lockManager, java.lang.String poolName)
-
getIdPools
public org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IdPools> getIdPools()
-
syncReleaseIdHolder
public void syncReleaseIdHolder(ReleasedIdHolder releasedIdHolder, IdPoolBuilder idPool)
-
syncAvailableIdHolder
public void syncAvailableIdHolder(AvailableIdHolder availableIdHolder, IdPoolBuilder idPool)
-
updateChildPool
public void updateChildPool(org.opendaylight.mdsal.binding.util.TypedWriteTransaction<org.opendaylight.mdsal.binding.util.Datastore.Configuration> tx, java.lang.String poolName, java.lang.String localPoolName)
-
incrementPoolUpdatedMap
public void incrementPoolUpdatedMap(java.lang.String localPoolName)
-
decrementPoolUpdatedMap
public void decrementPoolUpdatedMap(java.lang.String localPoolName)
-
getPoolUpdatedMap
public boolean getPoolUpdatedMap(java.lang.String localPoolName)
-
removeFromPoolUpdatedMap
public void removeFromPoolUpdatedMap(java.lang.String localPoolName)
-
getUniqueKey
public java.lang.String getUniqueKey(java.lang.String parentPoolName, java.lang.String idKey)
-
-