ReadableNodeIDAllocator:
Filter:
Classes | Control

ReadableNodeIDAllocator : Object

an allocator for nodeIDs with human-readable ownership

Description

In multi-client setups, it is useful to know which client created which nodeIDs on a shared server. ReadableNodeIDAllocator provides that facility by using a decimal prefix based on the clientID.

Class Methods

ReadableNodeIDAllocator.new(clientID: 0, lowestTempID: 1000, numClients: 32)

make a new instance for given clientID, offset for lowest temporary id, and

Arguments:

clientID

the clientID for which to create an offset/prefix

lowestTempID

the offset for the lowest temporary id

numClients

the number of clients for which to split the number range

Inherited class methods

Instance Methods

.clientID

the clientID for which to create an offset/prefix

.numClients

the number of clients for which to split the number range

.lowestTempID

the offset from where temporary nodeID begin

.idOffset

the offset from where nodeID range begins

.maxPermID

the highest permanent nodeID

.numIDs

the number of IDs before the allocator will wrap

.alloc

allocate next temporary nodeID

.allocPerm

allocate next permanent nodeID

.freePerm(id)

free a permanent nodeID

Arguments:

id

.isPerm(num)

test whether num is in the allocator's range of permanent numbers

Arguments:

num

.reset

reset allocator to initial state

Inherited instance methods